Skip to content

Commit

Permalink
tests: add perfs dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
sandre58 committed Jun 13, 2024
1 parent 0a7d2f7 commit 60d7118
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Stéphane ANDRE. All Right Reserved.
// See the LICENSE file in the project root for more information.

using System.Collections.ObjectModel;
using MyNet.UI.ViewModels.Dialogs;
using MyNet.Utilities.Helpers;

namespace MyNet.Wpf.TestApp.ViewModels.Contents
{
internal class PerfDialogViewModel : DialogViewModel
{
public ObservableCollection<int>? List { get; } = new(EnumerableHelper.Range(1, 1000, 1));
}
}
16 changes: 16 additions & 0 deletions src/tests/MyNet.Wpf.TestApp/ViewModels/DialogsWindowsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ internal class DialogsWindowsViewModel : NavigableWorkspaceViewModel

public ICommand OpenCustomNonDialogCommand { get; set; }

public ICommand OpenPerfNonDialogCommand { get; set; }

public ICommand OpenPerfDialogCommand { get; set; }

public DialogsWindowsViewModel()
{
OpenMessageDialogCommand = CommandsManager.Create<string>(async x =>
Expand Down Expand Up @@ -109,6 +113,18 @@ public DialogsWindowsViewModel()
var vm = new LoginDialogViewModel();
await WindowDialogManager.ShowAsync(vm, x => ShowToasterResult(x)).ConfigureAwait(false);
});

OpenPerfNonDialogCommand = CommandsManager.Create(async () =>
{
using var vm = new PerfDialogViewModel();
await WindowDialogManager.ShowAsync(vm).ConfigureAwait(false);
});

OpenPerfDialogCommand = CommandsManager.Create(async () =>
{
using var vm = new PerfDialogViewModel();
await WindowDialogManager.ShowDialogAsync(vm).ConfigureAwait(false);
});
}

private static void ShowToasterResult(LoginDialogViewModel viewModel)
Expand Down
33 changes: 33 additions & 0 deletions src/tests/MyNet.Wpf.TestApp/Views/Contents/PerfDialogView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<my:ContentDialog x:Class="MyNet.Wpf.TestApp.Views.Contents.PerfDialogView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:contents="clr-namespace:MyNet.Wpf.TestApp.ViewModels.Contents"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:my="http://mynet.com/xaml/themes"
d:DataContext="{d:DesignInstance Type=contents:PerfDialogViewModel}"
d:DesignHeight="450"
Width="800"
Height="800"
d:DesignWidth="800"
Header="{Binding Title}"
ShowCloseButton="True"
mc:Ignorable="d">

<ItemsControl ItemsSource="{Binding List}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<my:SimpleStackPanel Orientation="Horizontal" Margin="{StaticResource MyNet.Margins.Default}">
<my:NumericUpDown Value="{Binding Mode=OneWay}" />
<Button Style="{StaticResource MyNet.Styles.Button.Icon.Tool.ClipBoard}" CommandParameter="{Binding}" />
</my:SimpleStackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</my:ContentDialog>
13 changes: 13 additions & 0 deletions src/tests/MyNet.Wpf.TestApp/Views/Contents/PerfDialogView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) Stéphane ANDRE. All Right Reserved.
// See the LICENSE file in the project root for more information.

using MyNet.UI.Attributes;

namespace MyNet.Wpf.TestApp.Views.Contents
{
[IsTransient]
public partial class PerfDialogView
{
public PerfDialogView() => InitializeComponent();
}
}
8 changes: 8 additions & 0 deletions src/tests/MyNet.Wpf.TestApp/Views/DialogsView.Windows.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
Width="150"
Command="{Binding OpenCustomNonDialogCommand}"
Content="NON DIALOG" />
<Button Style="{StaticResource MyNet.Styles.Button.Elevation}"
Width="150"
Command="{Binding OpenPerfDialogCommand}"
Content="PERF DIALOG" />
<Button Style="{StaticResource MyNet.Styles.Button.Elevation}"
Width="150"
Command="{Binding OpenPerfNonDialogCommand}"
Content="PERF NON DIALOG" />
</my:SimpleStackPanel>
</my:SimpleStackPanel>
</Expander>
Expand Down

0 comments on commit 60d7118

Please sign in to comment.