Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions DelSolClockAppMaui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
## Build results
bin/
obj/
[Bb]uild/
[Ll]og/

# User-specific files
*.user
*.userosscache
*.suo
*.sdf
*.cache
*.csproj.user

# Visual Studio Code
.vscode/
.history/

# Xamarin/MAUI specific
*.apk
*.ap_
*.aab
*.ipa
*.app
*.xcuserstate
*.xcodeproj/*
*.xcworkspace/*
*.DS_Store

# macOS artifacts
*.DS_Store

# Rider
.idea/

# Dotnet artifacts
project.lock.json
project.fragment.lock.json
artifacts/

# NuGet
*.nupkg
*.snupkg
.nuget/
packages/
*.nuspec
*.psmdcp

# Logs
*.log

# Other
*.tlog
*.vs/
.vsconfig
14 changes: 14 additions & 0 deletions DelSolClockAppMaui/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:DelSolClockAppMaui"
x:Class="DelSolClockAppMaui.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
15 changes: 15 additions & 0 deletions DelSolClockAppMaui/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace DelSolClockAppMaui
{
public partial class App : Application
{
public App()
{
InitializeComponent();
}

protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new AppShell());
}
}
}
11 changes: 11 additions & 0 deletions DelSolClockAppMaui/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:DelSolClockAppMaui.Pages"
x:Class="DelSolClockAppMaui.AppShell">
<TabBar>
<ShellContent Title="Status" ContentTemplate="{DataTemplate pages:StatusPage}" />
<ShellContent Title="Firmware" ContentTemplate="{DataTemplate pages:UpdatePage}" />
<ShellContent Title="Logs" ContentTemplate="{DataTemplate pages:LogPage}" />
</TabBar>
</Shell>
10 changes: 10 additions & 0 deletions DelSolClockAppMaui/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace DelSolClockAppMaui
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
}
11 changes: 11 additions & 0 deletions DelSolClockAppMaui/Components/StatusItem.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="DelSolClockAppMaui.Components.StatusItem">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentView>
9 changes: 9 additions & 0 deletions DelSolClockAppMaui/Components/StatusItem.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace DelSolClockAppMaui.Components;

public partial class StatusItem : ContentView
{
public StatusItem()
{
InitializeComponent();
}
}
11 changes: 11 additions & 0 deletions DelSolClockAppMaui/Components/UpdateItem.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="DelSolClockAppMaui.Components.UpdateItem">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentView>
9 changes: 9 additions & 0 deletions DelSolClockAppMaui/Components/UpdateItem.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace DelSolClockAppMaui.Components;

public partial class UpdateItem : ContentView
{
public UpdateItem()
{
InitializeComponent();
}
}
82 changes: 82 additions & 0 deletions DelSolClockAppMaui/DelSolClockAppMaui.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->

<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

<OutputType>Exe</OutputType>
<RootNamespace>DelSolClockAppMaui</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<!-- Display name -->
<ApplicationTitle>DelSolClockAppMaui</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.delsolclockappmaui</ApplicationId>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
<WindowsPackageType>None</WindowsPackageType>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
<UseInterpreter Condition="$(TargetFramework.Contains('-android'))">False</UseInterpreter>
<RuntimeIdentifiers Condition="$(TargetFramework.Contains('-android'))">android-arm;android-arm64;android-x86;android-x64</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
<ProvisioningType>manual</ProvisioningType>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="Plugin.BLE" Version="3.2.0-beta.1" />
<PackageReference Include="RestSharp" Version="112.1.0" />
</ItemGroup>

<ItemGroup>
<MauiXaml Update="Pages\LogPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions DelSolClockAppMaui/DelSolClockAppMaui.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35527.113
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DelSolClockAppMaui", "DelSolClockAppMaui.csproj", "{2374AA40-700E-48AB-B564-E975A4E2C0BC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2374AA40-700E-48AB-B564-E975A4E2C0BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2374AA40-700E-48AB-B564-E975A4E2C0BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2374AA40-700E-48AB-B564-E975A4E2C0BC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{2374AA40-700E-48AB-B564-E975A4E2C0BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2374AA40-700E-48AB-B564-E975A4E2C0BC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
36 changes: 36 additions & 0 deletions DelSolClockAppMaui/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="DelSolClockAppMaui.MainPage">

<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Image
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a hovercraft number nine" />

<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />

<Label
Text="Welcome to &#10;.NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />

<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Fill" />
</VerticalStackLayout>
</ScrollView>

</ContentPage>
25 changes: 25 additions & 0 deletions DelSolClockAppMaui/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace DelSolClockAppMaui
{
public partial class MainPage : ContentPage
{
int count = 0;

public MainPage()
{
InitializeComponent();
}

private void OnCounterClicked(object sender, EventArgs e)
{
count++;

if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";

SemanticScreenReader.Announce(CounterBtn.Text);
}
}

}
39 changes: 39 additions & 0 deletions DelSolClockAppMaui/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Microsoft.Extensions.Logging;
using DelSolClockAppMaui.Services;
using DelSolClockAppMaui.Pages;

namespace DelSolClockAppMaui
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

// Register BLE services
builder.Services.AddSingleton<DelSolDevice>();

// Register pages
builder.Services.AddTransient<StatusPage>();
builder.Services.AddTransient<UpdatePage>();
builder.Services.AddTransient<LogPage>();

// Configure logging
#if DEBUG
builder.Logging.AddDebug();
builder.Logging.SetMinimumLevel(LogLevel.Debug);
#else
builder.Logging.SetMinimumLevel(LogLevel.Information);
#endif

return builder.Build();
}
}
}
Loading