-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from egvijayanand/working
C# version of SpaceXhistory App
- Loading branch information
Showing
62 changed files
with
2,359 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 17.0.31611.283 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpaceXhistory", "SpaceXhistory\SpaceXhistory.csproj", "{68F3EA60-A5E8-4156-BD93-89448C8F4876}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{68F3EA60-A5E8-4156-BD93-89448C8F4876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{68F3EA60-A5E8-4156-BD93-89448C8F4876}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{68F3EA60-A5E8-4156-BD93-89448C8F4876}.Debug|Any CPU.Deploy.0 = Debug|Any CPU | ||
{68F3EA60-A5E8-4156-BD93-89448C8F4876}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{68F3EA60-A5E8-4156-BD93-89448C8F4876}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{68F3EA60-A5E8-4156-BD93-89448C8F4876}.Release|Any CPU.Deploy.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace SpaceXhistory; | ||
|
||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
InitializeComponent(); | ||
|
||
MainPage = new Views.BottomTabPage(); | ||
} | ||
} | ||
|
14 changes: 14 additions & 0 deletions
14
src/C#-Samples/SpaceXhistory/SpaceXhistory/App.designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
src/C#-Samples/SpaceXhistory/SpaceXhistory/Helpers/Constants.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
namespace SpaceXhistory.Helpers | ||
{ | ||
public static class Constants | ||
{ | ||
public static string BaseUrl = "https://api.spacexdata.com/v4/"; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
global using CommunityToolkit.Maui.Markup; | ||
global using VijayAnand.Toolkit.Markup; | ||
|
||
global using MauiFrame = Microsoft.Maui.Controls.Frame; | ||
|
||
global using static Microsoft.Maui.Graphics.Colors; | ||
global using static CommunityToolkit.Maui.Markup.GridRowsColumns; | ||
global using static VijayAnand.Toolkit.Markup.ResourceHelper; | ||
global using static VijayAnand.Toolkit.Markup.SwipeViewHelper; | ||
global using static VijayAnand.Toolkit.Markup.VisualStateHelper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using CommunityToolkit.Maui; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace SpaceXhistory; | ||
|
||
public static class MauiProgram | ||
{ | ||
public static MauiApp CreateMauiApp() | ||
{ | ||
var builder = MauiApp.CreateBuilder(); | ||
builder | ||
.UseMauiApp<App>() | ||
.UseMauiCommunityToolkit() | ||
.ConfigureFonts(fonts => | ||
{ | ||
fonts.AddFont("GemunuLibre-Bold.ttf", "Bold"); | ||
fonts.AddFont("GemunuLibre-ExtraBold.ttf", "ExtraBold"); | ||
fonts.AddFont("GemunuLibre-ExtraLight.ttf", "ExtraLight"); | ||
fonts.AddFont("GemunuLibre-Light.ttf", "Light"); | ||
fonts.AddFont("GemunuLibre-Medium.ttf", "Medium"); | ||
fonts.AddFont("GemunuLibre-Regular.ttf", "Regular"); | ||
fonts.AddFont("GemunuLibre-SemiBold.ttf", "SemiBold"); | ||
}); | ||
|
||
#if DEBUG | ||
builder.Logging.AddDebug(); | ||
#endif | ||
|
||
return builder.Build(); | ||
} | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
src/C#-Samples/SpaceXhistory/SpaceXhistory/Models/Links.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
namespace SpaceXhistory.Models | ||
{ | ||
public class Links | ||
{ | ||
public Patch patch { get; set; } | ||
public string webcast { get; set; } | ||
public object wikipedia { get; set; } | ||
} | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
src/C#-Samples/SpaceXhistory/SpaceXhistory/Models/Patch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
namespace SpaceXhistory.Models | ||
{ | ||
public class Patch | ||
{ | ||
public object small { get; set; } | ||
public object large { get; set; } | ||
} | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
src/C#-Samples/SpaceXhistory/SpaceXhistory/Models/Roadster.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
namespace SpaceXhistory.Models | ||
{ | ||
public class Roadster | ||
{ | ||
public double speed_kph { get; set; } | ||
public double earth_distance_km { get; set; } | ||
public double mars_distance_km { get; set; } | ||
public string wikipedia { get; set; } | ||
public string video { get; set; } | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
|
||
namespace SpaceXhistory.Models | ||
{ | ||
public class Root | ||
{ | ||
public Links links { get; set; } | ||
public object success { get; set; } | ||
public string name { get; set; } | ||
public DateTime date_utc { get; set; } | ||
public DateTime date_local { get; set; } | ||
public bool upcoming { get; set; } | ||
|
||
[JsonIgnore] | ||
public string Status | ||
{ | ||
get | ||
{ | ||
if (upcoming) | ||
{ | ||
return "upcoming"; | ||
} | ||
|
||
if (success is bool value) | ||
{ | ||
if (value) | ||
{ | ||
return "successful"; | ||
} | ||
else | ||
{ | ||
return "failed"; | ||
} | ||
} | ||
|
||
return "failed"; | ||
} | ||
} | ||
|
||
[JsonIgnore] | ||
public Color StatusColor | ||
{ | ||
get | ||
{ | ||
if (upcoming) | ||
{ | ||
return Color.FromHex("#3a86ff"); | ||
} | ||
|
||
if (success is bool value) | ||
{ | ||
if (value) | ||
{ | ||
return Color.FromHex("#76c893"); | ||
} | ||
else | ||
{ | ||
return Color.FromHex("#e63946"); | ||
} | ||
} | ||
|
||
return Color.FromHex("#e63946"); | ||
} | ||
} | ||
} | ||
} | ||
|
6 changes: 6 additions & 0 deletions
6
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/Android/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
</manifest> |
11 changes: 11 additions & 0 deletions
11
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/Android/MainActivity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Android.App; | ||
using Android.Content.PM; | ||
using Android.OS; | ||
|
||
namespace SpaceXhistory; | ||
|
||
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] | ||
public class MainActivity : MauiAppCompatActivity | ||
{ | ||
} | ||
|
16 changes: 16 additions & 0 deletions
16
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/Android/MainApplication.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Android.App; | ||
using Android.Runtime; | ||
|
||
namespace SpaceXhistory; | ||
|
||
[Application] | ||
public class MainApplication : MauiApplication | ||
{ | ||
public MainApplication(IntPtr handle, JniHandleOwnership ownership) | ||
: base(handle, ownership) | ||
{ | ||
} | ||
|
||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} | ||
|
7 changes: 7 additions & 0 deletions
7
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/Android/Resources/values/colors.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="colorPrimary">#512BD4</color> | ||
<color name="colorPrimaryDark">#2B0B98</color> | ||
<color name="colorAccent">#2B0B98</color> | ||
</resources> | ||
|
10 changes: 10 additions & 0 deletions
10
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/MacCatalyst/AppDelegate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Foundation; | ||
|
||
namespace SpaceXhistory; | ||
|
||
[Register("AppDelegate")] | ||
public class AppDelegate : MauiUIApplicationDelegate | ||
{ | ||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} | ||
|
30 changes: 30 additions & 0 deletions
30
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/MacCatalyst/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>UIDeviceFamily</key> | ||
<array> | ||
<integer>1</integer> | ||
<integer>2</integer> | ||
</array> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>arm64</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>XSAppIconAssets</key> | ||
<string>Assets.xcassets/appicon.appiconset</string> | ||
</dict> | ||
</plist> |
16 changes: 16 additions & 0 deletions
16
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/MacCatalyst/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using ObjCRuntime; | ||
using UIKit; | ||
|
||
namespace SpaceXhistory; | ||
|
||
public class Program | ||
{ | ||
// This is the main entry point of the application. | ||
static void Main(string[] args) | ||
{ | ||
// if you want to use a different Application Delegate class from "AppDelegate" | ||
// you can specify it here. | ||
UIApplication.Main(args, null, typeof(AppDelegate)); | ||
} | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/Tizen/Main.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Hosting; | ||
|
||
namespace SpaceXhistory; | ||
|
||
class Program : MauiApplication | ||
{ | ||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
|
||
static void Main(string[] args) | ||
{ | ||
var app = new Program(); | ||
app.Run(args); | ||
} | ||
} | ||
|
15 changes: 15 additions & 0 deletions
15
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/Tizen/tizen-manifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="maui-application-id-placeholder" version="0.0.0" api-version="7" xmlns="http://tizen.org/ns/packages"> | ||
<profile name="common" /> | ||
<ui-application appid="maui-application-id-placeholder" exec="SpaceXhistory.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single"> | ||
<label>maui-application-title-placeholder</label> | ||
<icon>maui-appicon-placeholder</icon> | ||
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" /> | ||
</ui-application> | ||
<shortcut-list /> | ||
<privileges> | ||
<privilege>http://tizen.org/privilege/internet</privilege> | ||
</privileges> | ||
<dependencies /> | ||
<provides-appdefined-privileges /> | ||
</manifest> |
9 changes: 9 additions & 0 deletions
9
src/C#-Samples/SpaceXhistory/SpaceXhistory/Platforms/Windows/App.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<maui:MauiWinUIApplication | ||
x:Class="SpaceXhistory.WinUI.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:maui="using:Microsoft.Maui" | ||
xmlns:local="using:SpaceXhistory.WinUI"> | ||
|
||
</maui:MauiWinUIApplication> | ||
|
Oops, something went wrong.