Skip to content
Closed
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
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ local.settings.json
# Integration test secrets
appsettings.Secrets.json

.nuspec/
.buildtasks/
templatesTest/

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
/src/Controls/tests/TestCases.HostApp/MauiProgram.user.cs
SandboxAppium/

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down Expand Up @@ -294,3 +300,42 @@ __pycache__/
*.btm.cs
*.odx.cs
*.xsd.cs

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# Android Studio
.gradle/
.idea/
local.properties

# Directory Build overrides for local setups
Directory.Build.Override.props

# Only the "snapshots" directory should be added to Git, not the "snapshots-diff" directory
snapshots-diff/

#install of dotnet version
/.dotnet
.dotnet
temp
.packages
/src/Templates/.tempTemplateOutput
10 changes: 8 additions & 2 deletions Microsoft.Extensions.Configuration.AzureAppConfiguration.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32503.460
# Visual Studio Version 18
VisualStudioVersion = 18.0.11205.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Configuration.AzureAppConfiguration", "src\Microsoft.Extensions.Configuration.AzureAppConfiguration\Microsoft.Extensions.Configuration.AzureAppConfiguration.csproj", "{7B793D44-EC46-4C12-B71F-3A5005290C75}"
EndProject
Expand All @@ -26,6 +26,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Properties", "Properties",
AzureAppConfigurationRules.ruleset = AzureAppConfigurationRules.ruleset
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MauiAppConfigDemo", "examples\MauiAppConfigDemo\MauiAppConfigDemo.csproj", "{A9301C34-C40D-ECFA-7F7A-DF6D5CD72FDB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -68,6 +70,10 @@ Global
{A6C611F1-D687-4262-8904-828C239CF2E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6C611F1-D687-4262-8904-828C239CF2E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6C611F1-D687-4262-8904-828C239CF2E5}.Release|Any CPU.Build.0 = Release|Any CPU
{A9301C34-C40D-ECFA-7F7A-DF6D5CD72FDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9301C34-C40D-ECFA-7F7A-DF6D5CD72FDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9301C34-C40D-ECFA-7F7A-DF6D5CD72FDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9301C34-C40D-ECFA-7F7A-DF6D5CD72FDB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 14 additions & 0 deletions examples/MauiAppConfigDemo/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:MauiAppConfigDemo"
x:Class="MauiAppConfigDemo.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
16 changes: 16 additions & 0 deletions examples/MauiAppConfigDemo/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using MauiAppConfigDemo.Services;

namespace MauiAppConfigDemo;

public partial class App : Application
{
public App()
{
InitializeComponent();
}

protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new AppShell());
}
}
15 changes: 15 additions & 0 deletions examples/MauiAppConfigDemo/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="MauiAppConfigDemo.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiAppConfigDemo"
Shell.FlyoutBehavior="Disabled"
Title="MauiAppConfigDemo">

<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
9 changes: 9 additions & 0 deletions examples/MauiAppConfigDemo/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace MauiAppConfigDemo;

public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
2 changes: 2 additions & 0 deletions examples/MauiAppConfigDemo/GlobalXmlns.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "MauiAppConfigDemo")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "MauiAppConfigDemo.Pages")]
81 changes: 81 additions & 0 deletions examples/MauiAppConfigDemo/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?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="MauiAppConfigDemo.MainPage">

<RefreshView x:Name="RefreshView"
Refreshing="OnRefreshing">
<ScrollView>
<VerticalStackLayout Padding="20" Spacing="20">

<!-- App Header -->
<Label x:Name="WelcomeLabel"
Text="Welcome to Travel Booking!"
FontSize="24"
FontAttributes="Bold"
HorizontalTextAlignment="Center"
Margin="0,20,0,10"/>

<!-- Promotional Banner -->
<Border x:Name="PromotionalBanner"
IsVisible="False"
BackgroundColor="#E3F2FD"
Stroke="#1E88E5"
StrokeThickness="2"
Padding="15">
<Border.StrokeShape>
<RoundRectangle CornerRadius="12"/>
</Border.StrokeShape>
<Label x:Name="PromotionText"
Text="Special Offer!"
FontSize="16"
FontAttributes="Bold"
TextColor="#1565C0"
HorizontalTextAlignment="Center"/>
</Border>

<!-- Hotel Booking -->
<Border x:Name="HotelBookingCard"
IsVisible="False"
BackgroundColor="White"
Stroke="#DDDDDD"
StrokeThickness="1"
Padding="20">
<Border.StrokeShape>
<RoundRectangle CornerRadius="10"/>
</Border.StrokeShape>
<Border.GestureRecognizers>
<TapGestureRecognizer Tapped="OnHotelBookingTapped"/>
</Border.GestureRecognizers>
<HorizontalStackLayout Spacing="15">
<Label Text="🏨"
FontSize="40"
VerticalOptions="Center"/>
<VerticalStackLayout VerticalOptions="Center" HorizontalOptions="Fill">
<Label Text="Hotel Booking"
FontSize="18"
FontAttributes="Bold"/>
<Label Text="Find the perfect stay for your trip"
FontSize="14"
TextColor="#666666"/>
</VerticalStackLayout>
<Label Text="›"
FontSize="30"
TextColor="#1E88E5"
VerticalOptions="Center"/>
</HorizontalStackLayout>
</Border>

<!-- App Info -->
<Label x:Name="AppInfoLabel"
Text=""
FontSize="12"
TextColor="#999999"
HorizontalTextAlignment="Center"
Margin="0,10,0,20"/>

</VerticalStackLayout>
</ScrollView>
</RefreshView>

</ContentPage>
65 changes: 65 additions & 0 deletions examples/MauiAppConfigDemo/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using MauiAppConfigDemo.Services;

namespace MauiAppConfigDemo;

public partial class MainPage : ContentPage
{
private readonly ConfigurationService _configService;

public MainPage(ConfigurationService configService)
{
InitializeComponent();
_configService = configService;
LoadConfiguration();
}

protected override void OnAppearing()
{
base.OnAppearing();

// Trigger configuration refresh when page appears
Task.Run(async () =>
{
await _configService.RefreshConfigurationAsync();
MainThread.BeginInvokeOnMainThread(() => LoadConfiguration());
});
}

private async void LoadConfiguration()
{
// Get all configuration settings
var settings = _configService.GetSettings();

// Check feature flags
var isPromotionEnabled = await _configService.IsPromotionEnabledAsync();
var isHotelEnabled = await _configService.IsHotelBookingEnabledAsync();

// Display welcome message
WelcomeLabel.Text = settings.WelcomeMessage;

// Configure promotional banner (using feature flag)
PromotionalBanner.IsVisible = isPromotionEnabled && !string.IsNullOrEmpty(settings.PromotionText);
if (PromotionalBanner.IsVisible)
{
PromotionText.Text = settings.PromotionText;
}

// Show/hide hotel booking based on feature flag
HotelBookingCard.IsVisible = isHotelEnabled;

// Show app info
AppInfoLabel.Text = $"v{settings.AppVersion} | {settings.ApiUrl}";
}

private async void OnHotelBookingTapped(object? sender, EventArgs e)
{
await DisplayAlert("Hotel Booking", "Hotel booking feature - powered by Azure App Configuration!", "OK");
}

private async void OnRefreshing(object? sender, EventArgs e)
{
await _configService.RefreshConfigurationAsync();
LoadConfiguration();
RefreshView.IsRefreshing = false;
}
}
76 changes: 76 additions & 0 deletions examples/MauiAppConfigDemo/MauiAppConfigDemo.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<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>MauiAppConfigDemo</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

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

<!-- App Identifier -->
<ApplicationId>com.companyname.mauiappconfigdemo</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>
</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.FeatureManagement" Version="4.3.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.8" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Extensions.Configuration.AzureAppConfiguration\Microsoft.Extensions.Configuration.AzureAppConfiguration.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Screenshots\" />
</ItemGroup>

</Project>
Loading
Loading