Last active
September 8, 2016 16:45
-
-
Save vvolkgang/bc237c64517916431d514b811bfe0670 to your computer and use it in GitHub Desktop.
Custom UserDialogs loader in UWP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomUserDialogs : UserDialogsImpl | |
{ | |
private LoadingDialog _loadingDialog; | |
private LoadingDialog LoadingDialog => _loadingDialog ?? (_loadingDialog = new LoadingDialog()); | |
private IAsyncOperation<ContentDialogResult> _loadingDialogTask; | |
public override void ShowLoading(string title, MaskType? maskType) | |
{ | |
if(LoadingDialog.IsEnabled) | |
LoadingDialog.Hide(); | |
_loadingDialogTask = LoadingDialog.ShowAsync(); | |
} | |
public override void HideLoading() | |
{ | |
LoadingDialog.Hide(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ContentDialog x:Name="contentDialog" | |
x:Class="FIX_NAMESPACE.LoadingDialog" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="using:FIX_NAMESPACE" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
mc:Ignorable="d" | |
Background="#00000000" | |
> | |
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" | |
BorderThickness="0" | |
> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="Auto" /> | |
<RowDefinition Height="Auto" /> | |
</Grid.RowDefinitions> | |
<ProgressRing Grid.Row="0" IsActive="true" Width="100" Height="100" Foreground="Red"/> | |
<TextBlock Grid.Row="1" Text="Loading..." FontSize="22" FontWeight="Bold" Foreground="White" HorizontalAlignment="Center"/> | |
</Grid> | |
</ContentDialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed partial class LoadingDialog : ContentDialog | |
{ | |
public LoadingDialog() | |
{ | |
this.InitializeComponent(); | |
Application.Current.Resources["ContentDialogBorderWidth"] = new Thickness(0); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Setup : MvxWindowsSetup | |
{ | |
public Setup(Frame rootFrame, string suspensionManagerSessionStateKey = null) : base(rootFrame, suspensionManagerSessionStateKey) | |
{ | |
} | |
public Setup(IMvxWindowsFrame rootFrame) : base(rootFrame) | |
{ | |
} | |
protected override void InitializePlatformServices() | |
{ | |
base.InitializePlatformServices(); | |
Mvx.RegisterSingleton<IEmailService>(() => new EmailService()); | |
} | |
protected override IMvxWindowsViewPresenter CreateViewPresenter(IMvxWindowsFrame rootFrame) | |
{ | |
return new MvxWindowsMultiRegionViewPresenter(rootFrame); | |
} | |
protected override IMvxApplication CreateApp() | |
{ | |
return new Core.App(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment