mirror of
https://github.com/Stone-Red-Code/ClipCMD.git
synced 2026-09-04 08:56:11 +02:00
Small code improvments
This commit is contained in:
@@ -36,22 +36,19 @@ public partial class App : Application
|
||||
|
||||
desktop.MainWindow.Closing += (sender, e) =>
|
||||
{
|
||||
e.Cancel = true;
|
||||
|
||||
desktop.MainWindow.Hide();
|
||||
|
||||
Settings.SaveSettings();
|
||||
clipCmdCommandHandler.SaveCommands();
|
||||
};
|
||||
|
||||
clipCmdCommandHandler.Start();
|
||||
}
|
||||
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
|
||||
else
|
||||
{
|
||||
/*
|
||||
singleViewPlatform.MainView = new MainView()
|
||||
{
|
||||
DataContext = new MainViewModel()
|
||||
}
|
||||
*/
|
||||
|
||||
throw new NotImplementedException();
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Styling;
|
||||
|
||||
using AvaloniaEdit;
|
||||
using AvaloniaEdit.TextMate;
|
||||
@@ -35,7 +36,14 @@ public partial class EditorWindow : Window
|
||||
CheckScript(editorViewModel);
|
||||
};
|
||||
|
||||
RegistryOptions registryOptions = new RegistryOptions(ThemeName.DarkPlus);
|
||||
ThemeName editorTheme = ThemeName.DarkPlus;
|
||||
|
||||
if (Avalonia.Application.Current?.ActualThemeVariant == ThemeVariant.Light)
|
||||
{
|
||||
editorTheme = ThemeName.LightPlus;
|
||||
}
|
||||
|
||||
RegistryOptions registryOptions = new RegistryOptions(editorTheme);
|
||||
TextMate.Installation _textMateInstallation = textEditor.InstallTextMate(registryOptions);
|
||||
|
||||
_textMateInstallation.SetGrammar(registryOptions.GetScopeByLanguageId(registryOptions.GetLanguageByExtension(".ps1").Id));
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
x:Class="ClipCmd.Views.MainWindow"
|
||||
x:DataType="vm:ViewModelBase"
|
||||
Icon="/Assets/logo.ico"
|
||||
Title="{Binding Title}" Width="800" Height="450"
|
||||
Closing="Window_Closing">
|
||||
Title="{Binding Title}" Width="800" Height="450">
|
||||
|
||||
<views:MainView />
|
||||
</Window>
|
||||
@@ -1,5 +1,4 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
|
||||
namespace ClipCmd.Views;
|
||||
|
||||
@@ -9,13 +8,4 @@ public partial class MainWindow : Window
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Window_Closing(object? sender, WindowClosingEventArgs e)
|
||||
{
|
||||
if (Avalonia.Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop && desktop.MainWindow is not null)
|
||||
{
|
||||
desktop.MainWindow.Hide();
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user