Refactor
This commit is contained in:
parent
7a8e910697
commit
c8d91032c0
@ -2,15 +2,59 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using LibationWinForms.AvaloniaUI.ViewModels.Dialogs;
|
||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
||||
namespace LibationWinForms.AvaloniaUI
|
||||
{
|
||||
public enum DialogResult
|
||||
{
|
||||
None = 0,
|
||||
OK = 1,
|
||||
Cancel = 2,
|
||||
Abort = 3,
|
||||
Retry = 4,
|
||||
Ignore = 5,
|
||||
Yes = 6,
|
||||
No = 7,
|
||||
TryAgain = 10,
|
||||
Continue = 11
|
||||
}
|
||||
|
||||
|
||||
public enum MessageBoxIcon
|
||||
{
|
||||
None = 0,
|
||||
Error = 16,
|
||||
Hand = 16,
|
||||
Stop = 16,
|
||||
Question = 32,
|
||||
Exclamation = 48,
|
||||
Warning = 48,
|
||||
Asterisk = 64,
|
||||
Information = 64
|
||||
}
|
||||
public enum MessageBoxButtons
|
||||
{
|
||||
OK,
|
||||
OKCancel,
|
||||
AbortRetryIgnore,
|
||||
YesNoCancel,
|
||||
YesNo,
|
||||
RetryCancel,
|
||||
CancelTryContinue
|
||||
}
|
||||
|
||||
public enum MessageBoxDefaultButton
|
||||
{
|
||||
Button1,
|
||||
Button2 = 256,
|
||||
Button3 = 512,
|
||||
}
|
||||
|
||||
public class MessageBox
|
||||
{
|
||||
|
||||
@ -9,7 +9,6 @@ using DataLayer;
|
||||
using Dinah.Core;
|
||||
using FileLiberator;
|
||||
using LibationFileManager;
|
||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.ViewModels
|
||||
|
||||
@ -7,50 +7,6 @@ using LibationWinForms.AvaloniaUI.ViewModels.Dialogs;
|
||||
namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
||||
{
|
||||
|
||||
public enum DialogResult
|
||||
{
|
||||
None = 0,
|
||||
OK = 1,
|
||||
Cancel = 2,
|
||||
Abort = 3,
|
||||
Retry = 4,
|
||||
Ignore = 5,
|
||||
Yes = 6,
|
||||
No = 7,
|
||||
TryAgain = 10,
|
||||
Continue = 11
|
||||
}
|
||||
|
||||
|
||||
public enum MessageBoxIcon
|
||||
{
|
||||
None = 0,
|
||||
Error = 16,
|
||||
Hand = 16,
|
||||
Stop = 16,
|
||||
Question = 32,
|
||||
Exclamation = 48,
|
||||
Warning = 48,
|
||||
Asterisk = 64,
|
||||
Information = 64
|
||||
}
|
||||
public enum MessageBoxButtons
|
||||
{
|
||||
OK,
|
||||
OKCancel,
|
||||
AbortRetryIgnore,
|
||||
YesNoCancel,
|
||||
YesNo,
|
||||
RetryCancel,
|
||||
CancelTryContinue
|
||||
}
|
||||
|
||||
public enum MessageBoxDefaultButton
|
||||
{
|
||||
Button1,
|
||||
Button2 = 256,
|
||||
Button3 = 512,
|
||||
}
|
||||
public partial class MessageBoxWindow : ReactiveWindow<MessageBoxViewModel>
|
||||
{
|
||||
public MessageBoxWindow()
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using ApplicationServices;
|
||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using Avalonia.Input;
|
||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||
using LibationWinForms.Dialogs;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using DataLayer;
|
||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
using DataLayer;
|
||||
using Dinah.Core;
|
||||
using LibationFileManager;
|
||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
using AudibleUtilities;
|
||||
using Avalonia.Controls;
|
||||
using LibationFileManager;
|
||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||
using LibationWinForms.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||
using LibationWinForms.Dialogs;
|
||||
using LibationWinForms.Dialogs;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@ -106,9 +106,7 @@
|
||||
<MenuItem Click="aboutToolStripMenuItem_Click" Header="A_bout..." />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Button Grid.Column="1" Content="Show Message Box" Click="ShowMessageBoxButton_Click" />
|
||||
<StackPanel Name="scanningToolStripMenuItem" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="Show Message Box" Click="ShowMessageBoxButton_Click" />
|
||||
<Image Width="16" Height="16" Source="/AvaloniaUI/Assets/import_16x16.png" />
|
||||
<TextBlock Name="scanningToolStripMenuItem_Text" Margin="5,0,5,0" VerticalAlignment="Center" Text="Scanning..."/>
|
||||
</StackPanel>
|
||||
|
||||
@ -4,17 +4,10 @@ using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using LibationWinForms.AvaloniaUI.Controls;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Avalonia.Threading;
|
||||
using LibationWinForms.AvaloniaUI.Views.ProductsGrid;
|
||||
using Avalonia.ReactiveUI;
|
||||
using LibationWinForms.AvaloniaUI.ViewModels;
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
using LibationWinForms.AvaloniaUI.ViewModels.Dialogs;
|
||||
using LibationWinForms.AvaloniaUI.Views.Dialogs;
|
||||
using Avalonia.Media;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views
|
||||
{
|
||||
@ -54,30 +47,6 @@ namespace LibationWinForms.AvaloniaUI.Views
|
||||
|
||||
public void OnLoad() => Load?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
public async void ShowMessageBoxButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
await Task.Run(() => DoShowDialogAsync());
|
||||
}
|
||||
|
||||
private async Task DoShowDialogAsync()
|
||||
{
|
||||
|
||||
string caption = "this is a dialog message";
|
||||
string message =
|
||||
@"The Collatz conjecture is: This process will eventually reach the number 1, regardless of which positive integer is chosen initially.
|
||||
|
||||
If the conjecture is false, it can only be because there is some starting number which gives rise to a sequence that does not contain 1. Such a sequence would either enter a repeating cycle that excludes 1, or increase without bound. No such sequence has been found.
|
||||
|
||||
The smallest i such that ai < a0 is called the stopping time of n. Similarly, the smallest k such that ak = 1 is called the total stopping time of n.[3] If one of the indexes i or k doesn't exist, we say that the stopping time or the total stopping time, respectively, is infinite.
|
||||
|
||||
The Collatz conjecture asserts that the total stopping time of every n is finite. It is also equivalent to saying that every n >= 2 has a finite stopping time.
|
||||
|
||||
Since 3n + 1 is even whenever n is odd, one may instead use the shortcut form of the Collatz function:";
|
||||
|
||||
|
||||
var result = await MessageBox.Show(message, caption);
|
||||
}
|
||||
|
||||
private void FindAllControls()
|
||||
{
|
||||
{
|
||||
@ -141,13 +110,11 @@ Since 3n + 1 is even whenever n is odd, one may instead use the shortcut form of
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected override void OnDataContextChanged(EventArgs e)
|
||||
{
|
||||
base.OnDataContextChanged(e);
|
||||
}
|
||||
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
|
||||
@ -69,7 +69,7 @@
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn MinWidth="80" Width="1*" Header="Length" CanUserSort="True" SortMemberPath="Length">
|
||||
<DataGridTemplateColumn Width="90" Header="Length" CanUserSort="True" SortMemberPath="Length">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderThickness="3" Height="80">
|
||||
|
||||
@ -7,7 +7,6 @@ using Avalonia;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Dinah.Core;
|
||||
using LibationFileManager;
|
||||
using LibationWinForms.AvaloniaUI;
|
||||
using LibationWinForms.Dialogs;
|
||||
using Serilog;
|
||||
|
||||
@ -84,7 +83,7 @@ namespace LibationWinForms
|
||||
System.Windows.Forms.Application.Run(new Form1());
|
||||
}
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
=> AppBuilder.Configure<AvaloniaUI.App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace()
|
||||
.UseReactiveUI();
|
||||
|
||||
@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<Platform>x64</Platform>
|
||||
<PublishDir>..\bin\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user