file-scoped namespaces and other cleanup stuff
This commit is contained in:
parent
c2e7cc1a3c
commit
fc7cdceb05
@ -1,5 +1,3 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
@ -11,8 +9,8 @@ using Avalonia.Themes.Simple;
|
|||||||
using AvaloniaCoreRTDemo.Interfaces;
|
using AvaloniaCoreRTDemo.Interfaces;
|
||||||
using AvaloniaCoreRTDemo.Windows;
|
using AvaloniaCoreRTDemo.Windows;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo
|
namespace AvaloniaCoreRTDemo;
|
||||||
{
|
|
||||||
public sealed class App : Application, IThemeSwitch
|
public sealed class App : Application, IThemeSwitch
|
||||||
{
|
{
|
||||||
private FluentTheme _fluentTheme = default!;
|
private FluentTheme _fluentTheme = default!;
|
||||||
@ -107,4 +105,3 @@ namespace AvaloniaCoreRTDemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
using System;
|
namespace AvaloniaCoreRTDemo;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo
|
|
||||||
{
|
|
||||||
public enum ApplicationTheme : byte
|
public enum ApplicationTheme : byte
|
||||||
{
|
{
|
||||||
SimpleLight = 0,
|
SimpleLight = 0,
|
||||||
@ -9,4 +7,3 @@ namespace AvaloniaCoreRTDemo
|
|||||||
FluentLight = 2,
|
FluentLight = 2,
|
||||||
FluentDark = 3,
|
FluentDark = 3,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<PublishAot>true</PublishAot>
|
<PublishAot>true</PublishAot>
|
||||||
<PublishTrimmed>true</PublishTrimmed>
|
<PublishTrimmed>true</PublishTrimmed>
|
||||||
<SelfContained>true</SelfContained>
|
<SelfContained>true</SelfContained>
|
||||||
<ImplicitUsing>enable</ImplicitUsing>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@ -61,6 +61,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="PublishAotCompressed" Version="1.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Information for Dotnet.Bundle to Generate macOS app-->
|
<!-- Information for Dotnet.Bundle to Generate macOS app-->
|
||||||
|
@ -3,8 +3,8 @@ using Avalonia.Markup.Xaml;
|
|||||||
|
|
||||||
using AvaloniaCoreRTDemo.Controls.ViewModels;
|
using AvaloniaCoreRTDemo.Controls.ViewModels;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo.Controls
|
namespace AvaloniaCoreRTDemo.Controls;
|
||||||
{
|
|
||||||
public sealed partial class MainControl : UserControl
|
public sealed partial class MainControl : UserControl
|
||||||
{
|
{
|
||||||
public MainControl()
|
public MainControl()
|
||||||
@ -23,4 +23,3 @@ namespace AvaloniaCoreRTDemo.Controls
|
|||||||
DataContext = new MainControlViewModel(model);
|
DataContext = new MainControlViewModel(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
using MvvmGen;
|
using MvvmGen;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo.Controls.ViewModels
|
namespace AvaloniaCoreRTDemo.Controls.ViewModels;
|
||||||
{
|
|
||||||
[ViewModel]
|
[ViewModel]
|
||||||
internal sealed partial class MainControlViewModel : IMainWindowState
|
internal sealed partial class MainControlViewModel : IMainWindowState
|
||||||
{
|
{
|
||||||
@ -43,4 +43,3 @@ namespace AvaloniaCoreRTDemo.Controls.ViewModels
|
|||||||
_unloadable = true;
|
_unloadable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo.Interfaces
|
namespace AvaloniaCoreRTDemo.Interfaces;
|
||||||
{
|
|
||||||
public interface IMainWindow
|
public interface IMainWindow
|
||||||
{
|
{
|
||||||
IThemeSwitch ThemeSwitch { get; }
|
IThemeSwitch ThemeSwitch { get; }
|
||||||
@ -12,4 +12,3 @@ namespace AvaloniaCoreRTDemo.Interfaces
|
|||||||
Size? FrameSize { get; }
|
Size? FrameSize { get; }
|
||||||
WindowState State { get; }
|
WindowState State { get; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using Avalonia.Media.Imaging;
|
||||||
|
|
||||||
using Avalonia.Media.Imaging;
|
namespace AvaloniaCoreRTDemo;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo
|
|
||||||
{
|
|
||||||
public interface IMainWindowState
|
public interface IMainWindowState
|
||||||
{
|
{
|
||||||
IBitmap DotNetImage { get; }
|
IBitmap DotNetImage { get; }
|
||||||
@ -12,4 +10,3 @@ namespace AvaloniaCoreRTDemo
|
|||||||
|
|
||||||
void SetUnloadable();
|
void SetUnloadable();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
namespace AvaloniaCoreRTDemo.Interfaces
|
namespace AvaloniaCoreRTDemo.Interfaces;
|
||||||
{
|
|
||||||
public interface IThemeSwitch
|
public interface IThemeSwitch
|
||||||
{
|
{
|
||||||
ApplicationTheme Current { get; }
|
ApplicationTheme Current { get; }
|
||||||
void ChangeTheme(ApplicationTheme theme);
|
void ChangeTheme(ApplicationTheme theme);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo
|
namespace AvaloniaCoreRTDemo;
|
||||||
{
|
|
||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||||
@ -14,4 +14,3 @@ namespace AvaloniaCoreRTDemo
|
|||||||
=> AppBuilder.Configure<App>().UsePlatformDetect()
|
=> AppBuilder.Configure<App>().UsePlatformDetect()
|
||||||
.LogToTrace();
|
.LogToTrace();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
using System;
|
using System.Runtime.InteropServices;
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
using Avalonia.Platform;
|
using Avalonia.Platform;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo
|
namespace AvaloniaCoreRTDemo;
|
||||||
{
|
|
||||||
internal static class Utilities
|
internal static class Utilities
|
||||||
{
|
{
|
||||||
public static readonly bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
public static readonly bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||||
@ -46,4 +44,3 @@ namespace AvaloniaCoreRTDemo
|
|||||||
|
|
||||||
private static string GetImageFullPath(string fileName) => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
|
private static string GetImageFullPath(string fileName) => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
using AvaloniaCoreRTDemo.Windows.ViewModels;
|
using AvaloniaCoreRTDemo.Windows.ViewModels;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo.Windows
|
namespace AvaloniaCoreRTDemo.Windows;
|
||||||
{
|
|
||||||
public sealed partial class AboutWindow : Window
|
public sealed partial class AboutWindow : Window
|
||||||
{
|
{
|
||||||
private readonly bool _darkTheme;
|
private readonly bool _darkTheme;
|
||||||
@ -29,4 +27,3 @@ namespace AvaloniaCoreRTDemo.Windows
|
|||||||
DataContext = new AboutViewModel(_darkTheme);
|
DataContext = new AboutViewModel(_darkTheme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -6,8 +6,8 @@ using AvaloniaCoreRTDemo.Controls;
|
|||||||
using AvaloniaCoreRTDemo.Interfaces;
|
using AvaloniaCoreRTDemo.Interfaces;
|
||||||
using AvaloniaCoreRTDemo.Windows.ViewModels;
|
using AvaloniaCoreRTDemo.Windows.ViewModels;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo.Windows
|
namespace AvaloniaCoreRTDemo.Windows;
|
||||||
{
|
|
||||||
public sealed partial class MainWindow : Window, IMainWindow
|
public sealed partial class MainWindow : Window, IMainWindow
|
||||||
{
|
{
|
||||||
private readonly Application? _app = Application.Current;
|
private readonly Application? _app = Application.Current;
|
||||||
@ -46,4 +46,3 @@ namespace AvaloniaCoreRTDemo.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
using System;
|
using System.Runtime.InteropServices;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
using MvvmGen;
|
using MvvmGen;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo.Windows.ViewModels
|
namespace AvaloniaCoreRTDemo.Windows.ViewModels;
|
||||||
{
|
|
||||||
internal record SystemDetail(string Key, string Value);
|
internal record SystemDetail(string Key, string Value);
|
||||||
|
|
||||||
[ViewModel]
|
[ViewModel]
|
||||||
@ -59,4 +57,3 @@ namespace AvaloniaCoreRTDemo.Windows.ViewModels
|
|||||||
_computerImage.Dispose();
|
_computerImage.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
using System;
|
using Avalonia.Controls;
|
||||||
|
|
||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
using AvaloniaCoreRTDemo.Interfaces;
|
using AvaloniaCoreRTDemo.Interfaces;
|
||||||
using MvvmGen;
|
using MvvmGen;
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo.Windows.ViewModels
|
namespace AvaloniaCoreRTDemo.Windows.ViewModels;
|
||||||
{
|
|
||||||
[ViewModel]
|
[ViewModel]
|
||||||
internal abstract partial class ApplicationModelBase
|
internal abstract partial class ApplicationModelBase
|
||||||
{
|
{
|
||||||
@ -87,4 +85,3 @@ namespace AvaloniaCoreRTDemo.Windows.ViewModels
|
|||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
|
||||||
using AvaloniaCoreRTDemo.Interfaces;
|
using AvaloniaCoreRTDemo.Interfaces;
|
||||||
using MvvmGen;
|
|
||||||
|
|
||||||
namespace AvaloniaCoreRTDemo.Windows.ViewModels
|
namespace AvaloniaCoreRTDemo.Windows.ViewModels;
|
||||||
{
|
|
||||||
internal sealed class MainViewModel<TWindow> : ApplicationModelBase where TWindow : Window, IMainWindow
|
internal sealed class MainViewModel<TWindow> : ApplicationModelBase where TWindow : Window, IMainWindow
|
||||||
{
|
{
|
||||||
private TWindow _window;
|
private TWindow _window;
|
||||||
@ -24,4 +23,3 @@ namespace AvaloniaCoreRTDemo.Windows.ViewModels
|
|||||||
|
|
||||||
protected override void FluentDark() => SetTheme(ApplicationTheme.FluentDark);
|
protected override void FluentDark() => SetTheme(ApplicationTheme.FluentDark);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user