Skip to content

Commit c878a03

Browse files
app deployment commit
1 parent 89c51ab commit c878a03

File tree

5,063 files changed

+373291
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,063 files changed

+373291
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Create a UI in a .NET MAUI app by using XAML
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Create a cross-platform app with .NET MAUI
2+
3+
![alt text](image.png)
4+
![alt text](image-1.png)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"Version": 1,
3+
"WorkspaceRootPath": "C:\\Github\\AzureModule\\Create a cross-platform app with .NET MAUI\\demomuiproject\\",
4+
"Documents": [
5+
{
6+
"AbsoluteMoniker": "D:0:0:{76328569-F40B-4DF9-BC5A-BEB5BFF9D723}|demomuiproject.csproj|c:\\github\\azuremodule\\create a cross-platform app with .net maui\\demomuiproject\\mainpage.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
7+
"RelativeMoniker": "D:0:0:{76328569-F40B-4DF9-BC5A-BEB5BFF9D723}|demomuiproject.csproj|solutionrelative:mainpage.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
8+
},
9+
{
10+
"AbsoluteMoniker": "D:0:0:{76328569-F40B-4DF9-BC5A-BEB5BFF9D723}|demomuiproject.csproj|c:\\github\\azuremodule\\create a cross-platform app with .net maui\\demomuiproject\\mainpage.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
11+
"RelativeMoniker": "D:0:0:{76328569-F40B-4DF9-BC5A-BEB5BFF9D723}|demomuiproject.csproj|solutionrelative:mainpage.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
12+
}
13+
],
14+
"DocumentGroupContainers": [
15+
{
16+
"Orientation": 0,
17+
"VerticalTabListWidth": 256,
18+
"DocumentGroups": [
19+
{
20+
"DockedWidth": 200,
21+
"SelectedChildIndex": 1,
22+
"Children": [
23+
{
24+
"$type": "Bookmark",
25+
"Name": "ST:1:0:{f2bd8fb8-fc94-3dae-a733-fd993c73cc87}"
26+
},
27+
{
28+
"$type": "Document",
29+
"DocumentIndex": 0,
30+
"Title": "MainPage.xaml.cs",
31+
"DocumentMoniker": "C:\\Github\\AzureModule\\Create a cross-platform app with .NET MAUI\\demomuiproject\\MainPage.xaml.cs",
32+
"RelativeDocumentMoniker": "MainPage.xaml.cs",
33+
"ToolTip": "C:\\Github\\AzureModule\\Create a cross-platform app with .NET MAUI\\demomuiproject\\MainPage.xaml.cs",
34+
"RelativeToolTip": "MainPage.xaml.cs",
35+
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
36+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
37+
"WhenOpened": "2024-02-20T10:09:18.91Z",
38+
"EditorCaption": ""
39+
},
40+
{
41+
"$type": "Document",
42+
"DocumentIndex": 1,
43+
"Title": "MainPage.xaml",
44+
"DocumentMoniker": "C:\\Github\\AzureModule\\Create a cross-platform app with .NET MAUI\\demomuiproject\\MainPage.xaml",
45+
"RelativeDocumentMoniker": "MainPage.xaml",
46+
"ToolTip": "C:\\Github\\AzureModule\\Create a cross-platform app with .NET MAUI\\demomuiproject\\MainPage.xaml",
47+
"RelativeToolTip": "MainPage.xaml",
48+
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
49+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
50+
"WhenOpened": "2024-02-20T10:09:17.248Z",
51+
"EditorCaption": ""
52+
}
53+
]
54+
}
55+
]
56+
}
57+
]
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:demomuiproject"
5+
x:Class="demomuiproject.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
10+
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
</Application>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace demomuiproject
2+
{
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new AppShell();
10+
}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="demomuiproject.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:demomuiproject"
7+
Shell.FlyoutBehavior="Disabled"
8+
Title="demomuiproject">
9+
10+
<ShellContent
11+
Title="Home"
12+
ContentTemplate="{DataTemplate local:MainPage}"
13+
Route="MainPage" />
14+
15+
</Shell>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace demomuiproject
2+
{
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
x:Class="demomuiproject.MainPage">
5+
<VerticalStackLayout Spacing="15" Padding="20">
6+
<Label Text = "Enter a Phoneword"
7+
FontSize ="20"/>
8+
<Entry x:Name = "PhoneNumberText"
9+
Text = "1-555-NETMAUI" />
10+
<Button x:Name = "TranslateButton"
11+
Text = "Translate"
12+
Clicked = "OnTranslate"/>
13+
<Button x:Name = "CallButton"
14+
Text = "Call"
15+
IsEnabled = "False"
16+
Clicked = "OnCall"/>
17+
</VerticalStackLayout>
18+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace demomuiproject
2+
{
3+
public partial class MainPage : ContentPage
4+
{
5+
public MainPage()
6+
{
7+
InitializeComponent();
8+
}
9+
string translatedNumber;
10+
private void OnTranslate(object sender, EventArgs e)
11+
{
12+
string enteredNumber = PhoneNumberText.Text;
13+
translatedNumber = Core.PhonewordTranslator.ToNumber(enteredNumber);
14+
15+
if (!string.IsNullOrEmpty(translatedNumber))
16+
{
17+
CallButton.IsEnabled = true;
18+
CallButton.Text = "Call " + translatedNumber;
19+
}
20+
else
21+
{
22+
CallButton.IsEnabled = false;
23+
CallButton.Text = "Call";
24+
}
25+
}
26+
async void OnCall(object sender, System.EventArgs e)
27+
{
28+
if (await this.DisplayAlert(
29+
"Dial a Number",
30+
"Would you like to call " + translatedNumber + "?",
31+
"Yes",
32+
"No"))
33+
{
34+
// TODO: dial the phone
35+
}
36+
}
37+
}
38+
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Microsoft.Extensions.Logging;
2+
3+
namespace demomuiproject
4+
{
5+
public static class MauiProgram
6+
{
7+
public static MauiApp CreateMauiApp()
8+
{
9+
var builder = MauiApp.CreateBuilder();
10+
builder
11+
.UseMauiApp<App>()
12+
.ConfigureFonts(fonts =>
13+
{
14+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
15+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
16+
});
17+
18+
#if DEBUG
19+
builder.Logging.AddDebug();
20+
#endif
21+
22+
return builder.Build();
23+
}
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System.Text;
2+
3+
namespace Core;
4+
5+
public static class PhonewordTranslator
6+
{
7+
public static string ToNumber(string raw)
8+
{
9+
if (string.IsNullOrWhiteSpace(raw))
10+
return null;
11+
12+
raw = raw.ToUpperInvariant();
13+
14+
var newNumber = new StringBuilder();
15+
foreach (var c in raw)
16+
{
17+
if (" -0123456789".Contains(c))
18+
newNumber.Append(c);
19+
else
20+
{
21+
var result = TranslateToNumber(c);
22+
if (result != null)
23+
newNumber.Append(result);
24+
// Bad character?
25+
else
26+
return null;
27+
}
28+
}
29+
return newNumber.ToString();
30+
}
31+
32+
static bool Contains(this string keyString, char c)
33+
{
34+
return keyString.IndexOf(c) >= 0;
35+
}
36+
37+
static readonly string[] digits = {
38+
"ABC", "DEF", "GHI", "JKL", "MNO", "PQRS", "TUV", "WXYZ"
39+
};
40+
41+
static int? TranslateToNumber(char c)
42+
{
43+
for (int i = 0; i < digits.Length; i++)
44+
{
45+
if (digits[i].Contains(c))
46+
return 2 + i;
47+
}
48+
return null;
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Android.App;
2+
using Android.Content.PM;
3+
using Android.OS;
4+
5+
namespace demomuiproject
6+
{
7+
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
8+
public class MainActivity : MauiAppCompatActivity
9+
{
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Android.App;
2+
using Android.Runtime;
3+
4+
namespace demomuiproject
5+
{
6+
[Application]
7+
public class MainApplication : MauiApplication
8+
{
9+
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
10+
: base(handle, ownership)
11+
{
12+
}
13+
14+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#512BD4</color>
4+
<color name="colorPrimaryDark">#2B0B98</color>
5+
<color name="colorAccent">#2B0B98</color>
6+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Foundation;
2+
3+
namespace demomuiproject
4+
{
5+
[Register("AppDelegate")]
6+
public class AppDelegate : MauiUIApplicationDelegate
7+
{
8+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
5+
<dict>
6+
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. -->
7+
<key>com.apple.security.app-sandbox</key>
8+
<true/>
9+
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. -->
10+
<key>com.apple.security.network.client</key>
11+
<true/>
12+
</dict>
13+
</plist>
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<!-- The Mac App Store requires you specify if the app uses encryption. -->
6+
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/itsappusesnonexemptencryption -->
7+
<!-- <key>ITSAppUsesNonExemptEncryption</key> -->
8+
<!-- Please indicate <true/> or <false/> here. -->
9+
10+
<!-- Specify the category for your app here. -->
11+
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype -->
12+
<!-- <key>LSApplicationCategoryType</key> -->
13+
<!-- <string>public.app-category.YOUR-CATEGORY-HERE</string> -->
14+
<key>UIDeviceFamily</key>
15+
<array>
16+
<integer>2</integer>
17+
</array>
18+
<key>UIRequiredDeviceCapabilities</key>
19+
<array>
20+
<string>arm64</string>
21+
</array>
22+
<key>UISupportedInterfaceOrientations</key>
23+
<array>
24+
<string>UIInterfaceOrientationPortrait</string>
25+
<string>UIInterfaceOrientationLandscapeLeft</string>
26+
<string>UIInterfaceOrientationLandscapeRight</string>
27+
</array>
28+
<key>UISupportedInterfaceOrientations~ipad</key>
29+
<array>
30+
<string>UIInterfaceOrientationPortrait</string>
31+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
32+
<string>UIInterfaceOrientationLandscapeLeft</string>
33+
<string>UIInterfaceOrientationLandscapeRight</string>
34+
</array>
35+
<key>XSAppIconAssets</key>
36+
<string>Assets.xcassets/appicon.appiconset</string>
37+
</dict>
38+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using ObjCRuntime;
2+
using UIKit;
3+
4+
namespace demomuiproject
5+
{
6+
public class Program
7+
{
8+
// This is the main entry point of the application.
9+
static void Main(string[] args)
10+
{
11+
// if you want to use a different Application Delegate class from "AppDelegate"
12+
// you can specify it here.
13+
UIApplication.Main(args, null, typeof(AppDelegate));
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)