-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32082c9
commit 83d10db
Showing
74 changed files
with
1,833 additions
and
3,563 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
17 changes: 12 additions & 5 deletions
17
SukiUI.Demo/Features/ControlsLibrary/ContextMenusViewModel.cs
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 |
---|---|---|
@@ -1,20 +1,27 @@ | ||
using CommunityToolkit.Mvvm.Input; | ||
using Material.Icons; | ||
using SukiUI.Controls; | ||
using SukiUI.Toasts; | ||
|
||
namespace SukiUI.Demo.Features.ControlsLibrary; | ||
|
||
public partial class ContextMenusViewModel() : DemoPageBase("Context Menus", MaterialIconKind.Menu) | ||
public partial class ContextMenusViewModel(ISukiToastManager toastManager) : DemoPageBase("Context Menus", MaterialIconKind.Menu) | ||
{ | ||
[RelayCommand] | ||
private static void OptionClicked(bool withIcon) | ||
private void OptionClicked(bool withIcon) | ||
{ | ||
SukiHost.ShowToast("Clicked Context Menu", withIcon ? "You clicked the option with the icon." : "You clicked the option without the icon."); | ||
toastManager.CreateSimpleInfoToast() | ||
.WithTitle("Clicked Context Menu") | ||
.WithContent(withIcon ? "You clicked the option with the icon." : "You clicked the option without the icon.") | ||
.Queue(); | ||
} | ||
|
||
[RelayCommand] | ||
private static void NestedOptionClicked() | ||
private void NestedOptionClicked() | ||
{ | ||
SukiHost.ShowToast("Clicked Context Menu", "You clicked the nested option"); | ||
toastManager.CreateSimpleInfoToast() | ||
.WithTitle("Clicked Context Menu") | ||
.WithContent("You clicked the nested option.") | ||
.Queue(); | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
SukiUI.Demo/Features/ControlsLibrary/Dialogs/BackgroundCloseDialog.axaml
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
SukiUI.Demo/Features/ControlsLibrary/Dialogs/BackgroundCloseDialog.axaml.cs
This file was deleted.
Oops, something went wrong.
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
45 changes: 40 additions & 5 deletions
45
SukiUI.Demo/Features/ControlsLibrary/Dialogs/DialogWindowDemo.axaml.cs
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 |
---|---|---|
@@ -1,18 +1,53 @@ | ||
using Avalonia.Interactivity; | ||
using SukiUI.Controls; | ||
using SukiUI.Dialogs; | ||
|
||
namespace SukiUI.Demo.Features.ControlsLibrary.Dialogs; | ||
|
||
public partial class DialogWindowDemo : SukiWindow | ||
{ | ||
public DialogWindowDemo() | ||
private readonly ISukiDialogManager _mainWindowManager; | ||
private readonly ISukiDialogManager _thisWindowManager = new SukiDialogManager(); | ||
|
||
public DialogWindowDemo(ISukiDialogManager mainWindowManager) | ||
{ | ||
_mainWindowManager = mainWindowManager; | ||
InitializeComponent(); | ||
DialogHost.Manager = _thisWindowManager; | ||
} | ||
|
||
private void ShowDialogInThisWindowClicked(object? sender, RoutedEventArgs e) => | ||
SukiHost.ShowDialog(this, "A simple dialog that is shown in the demo window.\r\nClick outside dialog to close.", allowBackgroundClose: true); | ||
private void ShowDialogInThisWindowClicked(object? sender, RoutedEventArgs e) | ||
{ | ||
_thisWindowManager.CreateDialog() | ||
.WithTitle("Dialog Demo") | ||
.WithContent("This dialog is shown in this window.\r\nClick outside the dialog or click dismiss to dismiss this dialog.") | ||
.Dismiss().ByClickingBackground() | ||
.WithActionButton("Dismiss", _ => {}, true) | ||
.TryShow(); | ||
} | ||
|
||
private void ShowDialogInMainWindowClicked(object? sender, RoutedEventArgs e) => | ||
SukiHost.ShowDialog("A simple dialog that was shown from the demo window.\r\nClick outside dialog to close.", allowBackgroundClose: true); | ||
private void ShowDialogInMainWindowClicked(object? sender, RoutedEventArgs e) | ||
{ | ||
_mainWindowManager.CreateDialog() | ||
.WithTitle("Dialog Demo") | ||
.WithContent("This dialog is shown in the main window from the opened window.\r\nClick outside the dialog or click dismiss to dismiss this dialog.") | ||
.Dismiss().ByClickingBackground() | ||
.WithActionButton("Dismiss", _ => {}, true) | ||
.TryShow(); | ||
} | ||
private void ShowDialogInBothWindowsClicked(object? sender, RoutedEventArgs e) | ||
{ | ||
_mainWindowManager.CreateDialog() | ||
.WithTitle("Dialog Demo") | ||
.WithContent("This dialog is shown in both windows.\r\nClick outside the dialog or click dismiss to dismiss this dialog.") | ||
.Dismiss().ByClickingBackground() | ||
.WithActionButton("Dismiss", _ => {}, true) | ||
.TryShow(); | ||
_thisWindowManager.CreateDialog() | ||
.WithTitle("Dialog Demo") | ||
.WithContent("This dialog is shown in both windows.\r\nClick outside the dialog or click dismiss to dismiss this dialog.") | ||
.Dismiss().ByClickingBackground() | ||
.WithActionButton("Dismiss", _ => {}, true) | ||
.TryShow(); | ||
} | ||
} |
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
79 changes: 68 additions & 11 deletions
79
SukiUI.Demo/Features/ControlsLibrary/Dialogs/DialogsViewModel.cs
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 |
---|---|---|
@@ -1,25 +1,82 @@ | ||
using System; | ||
using Avalonia.Controls.Notifications; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using CommunityToolkit.Mvvm.Input; | ||
using Material.Icons; | ||
using SukiUI.Controls; | ||
using SukiUI.Demo.Utilities; | ||
using SukiUI.Dialogs; | ||
using SukiUI.Toasts; | ||
|
||
namespace SukiUI.Demo.Features.ControlsLibrary.Dialogs; | ||
|
||
public partial class DialogsViewModel() : DemoPageBase("Dialogs", MaterialIconKind.Forum) | ||
public partial class DialogsViewModel(ISukiDialogManager dialogManager, ISukiToastManager toastManager) : DemoPageBase("Dialogs", MaterialIconKind.Forum) | ||
{ | ||
public NotificationType[] NotificationTypes { get; } = Enum.GetValues<NotificationType>(); | ||
|
||
[ObservableProperty] private NotificationType _selectedType; | ||
|
||
[RelayCommand] | ||
private static void OpenStandardDialog() => | ||
SukiHost.ShowDialog(new StandardDialog()); | ||
private void OpenStandardDialog() | ||
{ | ||
dialogManager.CreateDialog() | ||
.WithTitle("A Standard Dialog") | ||
.WithContent("This is a standard dialog. Click the button below to dismiss.") | ||
.WithActionButton("Dismiss", _ => { }, true) | ||
.TryShow(); | ||
} | ||
|
||
[RelayCommand] | ||
private static void OpenBackgroundCloseDialog() => | ||
SukiHost.ShowDialog(new BackgroundCloseDialog(), allowBackgroundClose: true); | ||
|
||
private void OpenBackgroundCloseDialog() | ||
{ | ||
dialogManager.CreateDialog() | ||
.WithTitle("Background Closing Dialog") | ||
.WithContent("Dismiss this dialog by clicking anywhere outside of it.") | ||
.Dismiss().ByClickingBackground() | ||
.TryShow(); | ||
} | ||
|
||
[RelayCommand] | ||
private void OpenMultiOptionDialog() | ||
{ | ||
dialogManager.CreateDialog() | ||
.WithTitle("Multi Option Dialog") | ||
.WithContent("Select any one of the below options:") | ||
.WithActionButton("Option 1", _ => ShowOptionToast(1), true) | ||
.WithActionButton("Option 2", _ => ShowOptionToast(2), true) | ||
.WithActionButton("Option 3", _ => ShowOptionToast(3), true) | ||
.TryShow(); | ||
} | ||
|
||
private void ShowOptionToast(int option) | ||
{ | ||
toastManager.CreateToast() | ||
.WithTitle("Dialog Option Clicked") | ||
.WithContent($"You clicked option #{option}") | ||
.Dismiss().ByClicking() | ||
.Dismiss().After(TimeSpan.FromSeconds(3)) | ||
.Queue(); | ||
} | ||
|
||
[RelayCommand] | ||
private void OpenMessageBoxStyleDialog() | ||
{ | ||
dialogManager.CreateDialog() | ||
.OfType(SelectedType) | ||
.WithTitle("MessageBox style dialog.") | ||
.WithContent($"This MessageBox is - {SelectedType}.") | ||
.WithActionButton("Dismiss", _ => { }, true) | ||
.Dismiss().ByClickingBackground() | ||
.TryShow(); | ||
} | ||
|
||
[RelayCommand] | ||
private static void OpenViewModelDialog() => | ||
SukiHost.ShowDialog(new VmDialogViewModel(), allowBackgroundClose: true); | ||
private void OpenViewModelDialog() | ||
{ | ||
dialogManager.CreateDialog() | ||
.WithViewModel(dialog => new VmDialogViewModel(dialog)) | ||
.TryShow(); | ||
} | ||
|
||
[RelayCommand] | ||
private static void OpenDialogWindowDemo() => new DialogWindowDemo().Show(); | ||
private void OpenDialogWindowDemo() => new DialogWindowDemo(dialogManager).Show(); | ||
|
||
} |
Oops, something went wrong.