Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Ángel Barrera committed Sep 9, 2021
0 parents commit 4551bc8
Show file tree
Hide file tree
Showing 50 changed files with 1,692 additions and 0 deletions.
405 changes: 405 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions RickAndMortySample.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31612.314
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RickAndMortySample", "RickAndMortySample\RickAndMortySample\RickAndMortySample.csproj", "{68A4D2AB-6088-48AC-A8BA-4C36CA4D839D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RickAndMortySample.WinUI", "RickAndMortySample\RickAndMortySample.WinUI\RickAndMortySample.WinUI.csproj", "{9792F7D8-2674-4AFF-9536-49B493BB165F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{68A4D2AB-6088-48AC-A8BA-4C36CA4D839D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68A4D2AB-6088-48AC-A8BA-4C36CA4D839D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68A4D2AB-6088-48AC-A8BA-4C36CA4D839D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{68A4D2AB-6088-48AC-A8BA-4C36CA4D839D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68A4D2AB-6088-48AC-A8BA-4C36CA4D839D}.Release|Any CPU.Build.0 = Release|Any CPU
{68A4D2AB-6088-48AC-A8BA-4C36CA4D839D}.Release|Any CPU.Deploy.0 = Release|Any CPU
{9792F7D8-2674-4AFF-9536-49B493BB165F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9792F7D8-2674-4AFF-9536-49B493BB165F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9792F7D8-2674-4AFF-9536-49B493BB165F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{9792F7D8-2674-4AFF-9536-49B493BB165F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9792F7D8-2674-4AFF-9536-49B493BB165F}.Release|Any CPU.Build.0 = Release|Any CPU
{9792F7D8-2674-4AFF-9536-49B493BB165F}.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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<maui:MauiWinUIApplication
x:Class="RickAndMortySample.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:RickAndMortySample.WinUI">

</maui:MauiWinUIApplication>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.Maui;
using Microsoft.UI.Xaml;
using Windows.ApplicationModel;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace RickAndMortySample.WinUI
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : MauiWinUIApplication
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}

protected override IStartup OnCreateStartup() => new Startup();

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
base.OnLaunched(args);

Microsoft.Maui.Essentials.Platform.OnLaunched(args);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">

<Identity
Name="03B28BBA-89A6-4B8B-9860-AD1F058D65F4"
Publisher="CN=User Name"
Version="1.0.0.0" />

<Properties>
<DisplayName>RickAndMortySample</DisplayName>
<PublisherDisplayName>Microsoft</PublisherDisplayName>
<Logo>Assets\appiconStoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate"/>
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="RickAndMortySample"
Description="RickAndMortySample"
BackgroundColor="transparent"
Square150x150Logo="Assets\appiconMediumTile.png"
Square44x44Logo="Assets\appiconLogo.png">
<uap:DefaultTile
Wide310x150Logo="Assets\appiconWideTile.png"
Square71x71Logo="Assets\appiconSmallTile.png"
Square310x310Logo="Assets\appiconLargeTile.png"
ShortName="RickAndMortySample">
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo"/>
<uap:ShowOn Tile="wide310x150Logo"/>
</uap:ShowNameOnTiles>
</uap:DefaultTile >
<uap:SplashScreen Image="Assets\appiconfgSplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>

</Package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="RickAndMortySample.WinUI.app"/>

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- The combination of below two tags have the following effect:
1) Per-Monitor for >= Windows 10 Anniversary Update
2) System < Windows 10 Anniversary Update
-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</application>
</assembly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"profiles": {
"RickAndMortySample.WinUI": {
"commandName": "MsixPackage",
"nativeDebugging": false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0-windows10.0.19041</TargetFrameworks>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<OutputType>WinExe</OutputType>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<RootNamespace>RickAndMortySample</RootNamespace>

<!-- Required - Enable Single Project for WinUI -->
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
<WindowsPackageType>MSIX</WindowsPackageType>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiImage
Include="..\RickAndMortySample\Resources\appicon.svg"
Link="Resources\appicon.svg"
ForegroundFile="..\RickAndMortySample\Resources\appiconfg.svg"
IsAppIcon="true"
Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen
Include="..\RickAndMortySample\Resources\appiconfg.svg"
Link="Resources\appiconfg.svg"
Color="#512BD4" />

<!-- Images -->
<MauiImage
Include="..\RickAndMortySample\Resources\Images\*"
Link="Resources\Images\%(Filename)%(Extension)" />

<!-- Custom Fonts -->
<MauiFont
Include="..\RickAndMortySample\Resources\Fonts\*"
Link="Resources\Fonts\%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<Compile
Include="..\RickAndMortySample\**\*.cs"
Exclude="..\RickAndMortySample\bin\**;..\RickAndMortySample\obj\**;..\RickAndMortySample\Platforms\**"
Link="%(RecursiveDir)%(Filename)%(Extension)"/>
<MauiXaml
Include="..\RickAndMortySample\**\*.xaml"
Exclude="..\RickAndMortySample\bin\**;..\RickAndMortySample\obj\**"
Link="%(RecursiveDir)%(FileName)%(Extension)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Refit" Version="6.0.94" />
</ItemGroup>


<ItemGroup>
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.1" />
<PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.8.1" />
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.1" />
<PackageReference Include="Microsoft.ProjectReunion.InteractiveExperiences" Version="0.8.1" NoWarn="NU1701" />
</ItemGroup>

</Project>
30 changes: 30 additions & 0 deletions RickAndMortySample/RickAndMortySample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:windows="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;assembly=Microsoft.Maui.Controls"
xmlns:local="clr-namespace:RickAndMortySample"
x:Class="RickAndMortySample.App"
xmlns:converters="clr-namespace:RickAndMortySample.Converters"
windows:Application.ImageDirectory="Assets">
<Application.Resources>
<ResourceDictionary>

<converters:StatusToColorConverter x:Key="StatusToColorConverter"/>

<Color x:Key="PageBackgroundColor">#512bdf</Color>
<Color x:Key="PrimaryTextColor">White</Color>

<Style TargetType="Label">
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
</Style>

<Style TargetType="TabbedPage" x:Key="TabbedPageStyle">
<Setter Property="BarBackgroundColor" Value="Blue" />
<Setter Property="BarTextColor" Value="White" />
<Setter Property="SelectedTabColor" Value="Orange" />
<Setter Property="UnselectedTabColor" Value="White" />
</Style>

</ResourceDictionary>
</Application.Resources>
</Application>
18 changes: 18 additions & 0 deletions RickAndMortySample/RickAndMortySample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.Maui;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;
using RickAndMortySample.Pages;
using Application = Microsoft.Maui.Controls.Application;

namespace RickAndMortySample
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new RAMTabbedPage();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RickAndMortySample.Converters
{
public class StatusToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var status = value as string;
switch (status)
{
case "Alive":
return Colors.Green;
case "Dead":
return Colors.Red;
case "unknown":
return Colors.Grey;
default:
return Colors.Black;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
44 changes: 44 additions & 0 deletions RickAndMortySample/RickAndMortySample/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="RickAndMortySample.MainPage"
BackgroundColor="{DynamicResource PageBackgroundColor}">

<ScrollView Padding="{OnPlatform iOS='30,60,30,30', Default='30'}">
<Grid RowSpacing="25" RowDefinitions="Auto,Auto,Auto,Auto,*">

<Label Text="Hello, World!"
Grid.Row="0"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="CenterAndExpand" />

<Label Text="Welcome to .NET Multi-platform App UI"
Grid.Row="1"
SemanticProperties.Hint="Counts the number of times you click"
FontSize="16"
HorizontalOptions="CenterAndExpand" />

<Label Text="Current count: 0"
Grid.Row="2"
SemanticProperties.Hint="Counts the number of times you click"
FontSize="18"
FontAttributes="Bold"
x:Name="CounterLabel"
HorizontalOptions="Center" />

<Button Text="Click me"
Grid.Row="3"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />

<Image Grid.Row="4"
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dotnet bot waving hi to you!"
WidthRequest="300"
HeightRequest="372"
HorizontalOptions="Center" />

</Grid>
</ScrollView>
</ContentPage>
20 changes: 20 additions & 0 deletions RickAndMortySample/RickAndMortySample/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using Microsoft.Maui.Controls;

namespace RickAndMortySample
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}

int count = 0;
private void OnCounterClicked(object sender, EventArgs e)
{
count++;
CounterLabel.Text = $"Current count: {count}";
}
}
}
Loading

0 comments on commit 4551bc8

Please sign in to comment.