-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2974 from PrismLibrary/dev/ds/uno5.0
Uno 5 update
- Loading branch information
Showing
20 changed files
with
214 additions
and
83 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<UserControl | ||
x:Class="ModuleA.Dialogs.AlertDialog" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:ModuleA" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400"> | ||
|
||
<StackPanel> | ||
<TextBlock Text="{Binding Message}" /> | ||
<Button Content="OK" | ||
Command="{Binding CloseCommand}" | ||
Margin="0,15"/> | ||
</StackPanel> | ||
</UserControl> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Controls.Primitives; | ||
using Microsoft.UI.Xaml.Data; | ||
using Microsoft.UI.Xaml.Input; | ||
using Microsoft.UI.Xaml.Media; | ||
using Microsoft.UI.Xaml.Navigation; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
|
||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 | ||
|
||
namespace ModuleA.Dialogs | ||
{ | ||
public sealed partial class AlertDialog : UserControl | ||
{ | ||
public AlertDialog() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace ModuleA.Dialogs; | ||
|
||
internal class AlertDialogViewModel : BindableBase, IDialogAware | ||
{ | ||
public AlertDialogViewModel() | ||
{ | ||
CloseCommand = new DelegateCommand(() => RequestClose.Invoke(new DialogResult(ButtonResult.OK))); | ||
} | ||
|
||
private string _title = string.Empty; | ||
public string Title | ||
{ | ||
get => _title; | ||
set => SetProperty(ref _title, value); | ||
} | ||
|
||
private string _message = string.Empty; | ||
public string Message | ||
{ | ||
get => _message; | ||
set => SetProperty(ref _message, value); | ||
} | ||
|
||
public DelegateCommand CloseCommand { get; } | ||
|
||
public DialogCloseListener RequestClose { get; } | ||
|
||
public bool CanCloseDialog() => true; | ||
|
||
public void OnDialogClosed() | ||
{ | ||
|
||
} | ||
|
||
public void OnDialogOpened(IDialogParameters parameters) | ||
{ | ||
Title = parameters.GetValue<string>("title"); | ||
Message = parameters.GetValue<string>("message"); | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Windows.Input; | ||
|
||
namespace ModuleA.ViewModels; | ||
|
||
internal class ViewAViewModel : ViewModelBase | ||
{ | ||
private readonly IDialogService _dialogService; | ||
|
||
public ViewAViewModel(IRegionManager regionManager, IDialogService dialogService) | ||
: base(regionManager) | ||
{ | ||
_dialogService = dialogService; | ||
ShowAlertCommand = new DelegateCommand(ShowDialog); | ||
} | ||
|
||
public ICommand ShowAlertCommand { get; } | ||
|
||
private void ShowDialog() | ||
{ | ||
_dialogService.ShowDialog("AlertDialog", new DialogParameters | ||
{ | ||
{ "title", "Oh Snap" }, | ||
{ "message", "You can actually create much more amazing dialogs with Prism. Hello from ViewA!" } | ||
}); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace ModuleA.ViewModels; | ||
|
||
internal class ViewBViewModel : ViewModelBase | ||
{ | ||
public ViewBViewModel(IRegionManager regionManager) | ||
: base(regionManager) | ||
{ | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.Collections.ObjectModel; | ||
|
||
namespace ModuleA.ViewModels; | ||
|
||
internal class ViewModelBase : BindableBase, IRegionAware | ||
{ | ||
private readonly string _name; | ||
protected IRegionManager RegionManager { get; } | ||
|
||
protected ViewModelBase(IRegionManager regionManager) | ||
{ | ||
RegionManager = regionManager; | ||
Title = _name = GetType().Name.Replace("ViewModel", string.Empty); | ||
} | ||
|
||
private string _title = string.Empty; | ||
public string Title | ||
{ | ||
get => _title; | ||
set => SetProperty(ref _title, value); | ||
} | ||
|
||
private ObservableCollection<string> _messages = new(); | ||
public IEnumerable<string> Messages => _messages; | ||
|
||
|
||
public bool IsNavigationTarget(NavigationContext navigationContext) => | ||
navigationContext.NavigatedName() == _name; | ||
|
||
public void OnNavigatedFrom(NavigationContext navigationContext) | ||
{ | ||
_messages.Add("OnNavigatedFrom"); | ||
} | ||
|
||
public void OnNavigatedTo(NavigationContext navigationContext) | ||
{ | ||
if (navigationContext.Parameters.TryGetValue("title", out string title)) | ||
{ | ||
Title = title; | ||
} | ||
|
||
_messages.Add("OnNavigatedTo"); | ||
} | ||
} |
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
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
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
Oops, something went wrong.