Skip to content

Commit d6aa978

Browse files
Add project files.
1 parent 38dc073 commit d6aa978

Some content is hidden

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

53 files changed

+1814
-0
lines changed

Diff for: MyAppMAUI.sln

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.0.31611.283
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyAppMAUI", "MyAppMAUI\MyAppMAUI.csproj", "{1183888C-D490-4229-8789-7E04845FFD4D}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{1183888C-D490-4229-8789-7E04845FFD4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{1183888C-D490-4229-8789-7E04845FFD4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{1183888C-D490-4229-8789-7E04845FFD4D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
16+
{1183888C-D490-4229-8789-7E04845FFD4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{1183888C-D490-4229-8789-7E04845FFD4D}.Release|Any CPU.Build.0 = Release|Any CPU
18+
{1183888C-D490-4229-8789-7E04845FFD4D}.Release|Any CPU.Deploy.0 = Release|Any CPU
19+
EndGlobalSection
20+
GlobalSection(SolutionProperties) = preSolution
21+
HideSolutionNode = FALSE
22+
EndGlobalSection
23+
GlobalSection(ExtensibilityGlobals) = postSolution
24+
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
25+
EndGlobalSection
26+
EndGlobal

Diff for: MyAppMAUI/App.xaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
3+
xmlns:windows="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;assembly=Microsoft.Maui.Controls"
4+
xmlns:local="clr-namespace:MyAppMAUI"
5+
x:Class="MyAppMAUI.App"
6+
windows:Application.ImageDirectory="Assets">
7+
<Application.Resources>
8+
<ResourceDictionary>
9+
10+
<Color x:Key="PageBackgroundColor">#512bdf</Color>
11+
<Color x:Key="PrimaryTextColor">White</Color>
12+
13+
<Style TargetType="Label">
14+
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
15+
<Setter Property="FontFamily" Value="OpenSansRegular" />
16+
</Style>
17+
18+
<Style TargetType="Button">
19+
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
20+
<Setter Property="FontFamily" Value="OpenSansRegular" />
21+
<Setter Property="BackgroundColor" Value="#2b0b98" />
22+
<Setter Property="Padding" Value="14,10" />
23+
</Style>
24+
25+
</ResourceDictionary>
26+
</Application.Resources>
27+
</Application>

Diff for: MyAppMAUI/App.xaml.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.Maui;
2+
using Microsoft.Maui.Controls;
3+
using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;
4+
using Application = Microsoft.Maui.Controls.Application;
5+
6+
namespace MyAppMAUI
7+
{
8+
public partial class App : Application
9+
{
10+
public App()
11+
{
12+
InitializeComponent();
13+
14+
MainPage = new MainPage();
15+
}
16+
}
17+
}

Diff for: MyAppMAUI/Data/WeatherForecast.cs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
3+
namespace MyAppMAUI.Data
4+
{
5+
public class WeatherForecast
6+
{
7+
public DateTime Date { get; set; }
8+
9+
public int TemperatureC { get; set; }
10+
11+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12+
13+
public string Summary { get; set; }
14+
}
15+
}

Diff for: MyAppMAUI/Data/WeatherForecastService.cs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Linq;
3+
using System.Threading.Tasks;
4+
5+
namespace MyAppMAUI.Data
6+
{
7+
public class WeatherForecastService
8+
{
9+
private static readonly string[] Summaries = new[]
10+
{
11+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
12+
};
13+
14+
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
15+
{
16+
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
17+
{
18+
Date = startDate.AddDays(index),
19+
TemperatureC = Random.Shared.Next(-20, 55),
20+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
21+
}).ToArray());
22+
}
23+
}
24+
}

Diff for: MyAppMAUI/Main.razor

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Router AppAssembly="@GetType().Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
</Found>
5+
<NotFound>
6+
<LayoutView Layout="@typeof(MainLayout)">
7+
<p>Sorry, there's nothing at this address.</p>
8+
</LayoutView>
9+
</NotFound>
10+
</Router>

Diff for: MyAppMAUI/MainPage.xaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
3+
xmlns:b="clr-namespace:Microsoft.AspNetCore.Components.WebView.Maui;assembly=Microsoft.AspNetCore.Components.WebView.Maui"
4+
xmlns:local="clr-namespace:MyAppMAUI"
5+
x:Class="MyAppMAUI.MainPage"
6+
BackgroundColor="{DynamicResource PageBackgroundColor}">
7+
8+
<b:BlazorWebView HostPage="wwwroot/index.html">
9+
<b:BlazorWebView.RootComponents>
10+
<b:RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
11+
</b:BlazorWebView.RootComponents>
12+
</b:BlazorWebView>
13+
14+
</ContentPage>

Diff for: MyAppMAUI/MainPage.xaml.cs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using Microsoft.Maui.Controls;
3+
4+
namespace MyAppMAUI
5+
{
6+
public partial class MainPage : ContentPage
7+
{
8+
public MainPage()
9+
{
10+
InitializeComponent();
11+
}
12+
}
13+
}

Diff for: MyAppMAUI/MauiProgram.cs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Microsoft.AspNetCore.Components.WebView.Maui;
2+
using Microsoft.Extensions.DependencyInjection;
3+
using Microsoft.Maui;
4+
using Microsoft.Maui.Hosting;
5+
using Microsoft.Maui.Controls.Compatibility;
6+
using Microsoft.Maui.Controls.Hosting;
7+
using MyAppMAUI.Data;
8+
9+
namespace MyAppMAUI
10+
{
11+
public static class MauiProgram
12+
{
13+
public static MauiApp CreateMauiApp()
14+
{
15+
var builder = MauiApp.CreateBuilder();
16+
builder
17+
.RegisterBlazorMauiWebView()
18+
.UseMauiApp<App>()
19+
.ConfigureFonts(fonts =>
20+
{
21+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
22+
});
23+
24+
builder.Services.AddBlazorWebView();
25+
builder.Services.AddSingleton<WeatherForecastService>();
26+
27+
return builder.Build();
28+
}
29+
}
30+
}

Diff for: MyAppMAUI/MyAppMAUI.csproj

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
6+
<OutputType>Exe</OutputType>
7+
<RootNamespace>MyAppMAUI</RootNamespace>
8+
<UseMaui>true</UseMaui>
9+
<SingleProject>true</SingleProject>
10+
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
11+
<EnableDefaultCssItems>false</EnableDefaultCssItems>
12+
13+
<!-- Display name -->
14+
<ApplicationTitle>MyAppMAUI</ApplicationTitle>
15+
16+
<!-- App Identifier -->
17+
<ApplicationId>com.companyname.MyAppMAUI</ApplicationId>
18+
19+
<!-- Versions -->
20+
<ApplicationVersion>1</ApplicationVersion>
21+
22+
<!-- Required for C# Hot Reload -->
23+
<UseInterpreter Condition="'$(Configuration)' == 'Debug'">True</UseInterpreter>
24+
25+
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-ios'">14.2</SupportedOSPlatformVersion>
26+
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-maccatalyst'">14.0</SupportedOSPlatformVersion>
27+
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-android'">21.0</SupportedOSPlatformVersion>
28+
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</SupportedOSPlatformVersion>
29+
<TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</TargetPlatformMinVersion>
30+
</PropertyGroup>
31+
32+
<ItemGroup>
33+
<!-- App Icon -->
34+
<MauiIcon
35+
Include="Resources\appicon.svg"
36+
ForegroundFile="Resources\appiconfg.svg"
37+
Color="#512BD4" />
38+
39+
<!-- Splash Screen -->
40+
<MauiSplashScreen Include="Resources\appiconfg.svg" Color="#512BD4" />
41+
42+
<!-- Images -->
43+
<MauiImage Include="Resources\Images\*" />
44+
45+
<!-- Custom Fonts -->
46+
<MauiFont Include="Resources\Fonts\*" />
47+
</ItemGroup>
48+
49+
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
50+
<!-- Required - WinUI does not yet have buildTransitive for everything -->
51+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0-preview3" />
52+
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.29-preview3" />
53+
</ItemGroup>
54+
55+
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
56+
<OutputType>WinExe</OutputType>
57+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
58+
</PropertyGroup>
59+
60+
<ItemGroup>
61+
<Content Remove="Properties\launchSettings.json" />
62+
</ItemGroup>
63+
64+
</Project>

Diff for: MyAppMAUI/Pages/Counter.razor

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@page "/counter"
2+
3+
<h1>Contador</h1>
4+
5+
<p role="status">Current count: @currentCount</p>
6+
7+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
8+
9+
@code {
10+
private int currentCount = 0;
11+
12+
private void IncrementCount()
13+
{
14+
currentCount++;
15+
}
16+
}

Diff for: MyAppMAUI/Pages/FetchData.razor

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@page "/fetchdata"
2+
3+
@using MyAppMAUI.Data
4+
@inject WeatherForecastService ForecastService
5+
6+
<h1>Weather</h1>
7+
8+
<p>This component demonstrates fetching data from a service.</p>
9+
10+
@if (forecasts == null)
11+
{
12+
<p><em>Loading...</em></p>
13+
}
14+
else
15+
{
16+
<table class="table">
17+
<thead>
18+
<tr>
19+
<th>Date</th>
20+
<th>Temp. (C)</th>
21+
<th>Temp. (F)</th>
22+
<th>Summary</th>
23+
</tr>
24+
</thead>
25+
<tbody>
26+
@foreach (var forecast in forecasts)
27+
{
28+
<tr>
29+
<td>@forecast.Date.ToShortDateString()</td>
30+
<td>@forecast.TemperatureC</td>
31+
<td>@forecast.TemperatureF</td>
32+
<td>@forecast.Summary</td>
33+
</tr>
34+
}
35+
</tbody>
36+
</table>
37+
}
38+
39+
@code {
40+
private WeatherForecast[] forecasts;
41+
42+
protected override async Task OnInitializedAsync()
43+
{
44+
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
45+
}
46+
}

Diff for: MyAppMAUI/Pages/Index.razor

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@page "/"
2+
3+
<h1>Hello, world!</h1>
4+
5+
Welcome to your new app.
6+
7+
<SurveyPrompt Title="How is Blazor working for you?" />

Diff for: MyAppMAUI/Platforms/Android/AndroidManifest.xml

+6
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+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
4+
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
</manifest>

Diff for: MyAppMAUI/Platforms/Android/MainActivity.cs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Android.App;
2+
using Android.Content.PM;
3+
using Microsoft.Maui;
4+
5+
namespace MyAppMAUI
6+
{
7+
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
8+
public class MainActivity : MauiAppCompatActivity
9+
{
10+
}
11+
}

Diff for: MyAppMAUI/Platforms/Android/MainApplication.cs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using Android.App;
3+
using Android.Runtime;
4+
using Microsoft.Maui;
5+
using Microsoft.Maui.Hosting;
6+
7+
namespace MyAppMAUI
8+
{
9+
[Application]
10+
public class MainApplication : MauiApplication
11+
{
12+
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
13+
: base(handle, ownership)
14+
{
15+
}
16+
17+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
18+
}
19+
}
+6
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>

Diff for: MyAppMAUI/Platforms/MacCatalyst/AppDelegate.cs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Foundation;
2+
using Microsoft.Maui;
3+
using Microsoft.Maui.Hosting;
4+
5+
namespace MyAppMAUI
6+
{
7+
[Register("AppDelegate")]
8+
public class AppDelegate : MauiUIApplicationDelegate
9+
{
10+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
11+
}
12+
}

0 commit comments

Comments
 (0)