- fix: DesignMode think
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<SolidColorBrush x:Key="NoneBackground">#00000000</SolidColorBrush>
|
|
||||||
<SolidColorBrush x:Key="DefaultBackground">#121212</SolidColorBrush>
|
<SolidColorBrush x:Key="DefaultBackground">#121212</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="DefaultForeground">#222222</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="DefaultSelected">#D95F59</SolidColorBrush>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<Style Selector="Window">
|
<Style Selector="Window">
|
||||||
<Setter Property="Background" Value="#121212" />
|
<Setter Property="Background" Value="{StaticResource DefaultBackground}"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="Border">
|
<Style Selector="Border">
|
||||||
<Setter Property="BorderBrush" Value="#343334" />
|
<Setter Property="CornerRadius" Value="10" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
|
||||||
<Setter Property="BorderThickness" Value="0" />
|
|
||||||
<Setter Property="BoxShadow" Value="0 0 2 2 #222222" />
|
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="Label">
|
<Style Selector="Label">
|
||||||
<Setter Property="Foreground" Value="#f7f7ff" />
|
<Setter Property="Foreground" Value="#f7f7ff" />
|
||||||
@@ -30,7 +27,7 @@
|
|||||||
|
|
||||||
<Style Selector="Button:pointerover">
|
<Style Selector="Button:pointerover">
|
||||||
<Setter Property="RenderTransform" Value="{x:Null}" />
|
<Setter Property="RenderTransform" Value="{x:Null}" />
|
||||||
<Setter Property="BorderThickness" Value="0,0,0,2" />
|
<Setter Property="BorderThickness" Value="0,0,0,0" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="Button.ViewSelectButton">
|
<Style Selector="Button.ViewSelectButton">
|
||||||
@@ -47,9 +44,11 @@
|
|||||||
<Style Selector="TextBox">
|
<Style Selector="TextBox">
|
||||||
<Setter Property="Foreground" Value="#f7f7ff" />
|
<Setter Property="Foreground" Value="#f7f7ff" />
|
||||||
<Setter Property="SelectionForegroundBrush" Value="#f7f7ff" />
|
<Setter Property="SelectionForegroundBrush" Value="#f7f7ff" />
|
||||||
<Setter Property="BorderThickness" Value="0,0,0,1" />
|
<Setter Property="BorderThickness" Value="0,0,0,0" />
|
||||||
<Setter Property="BorderBrush" Value="#f7f7ff" />
|
<Setter Property="BorderBrush" Value="#f7f7ff" />
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style Selector="TextBox"></Style>
|
||||||
|
|
||||||
<Style Selector="ListBoxItem">
|
<Style Selector="ListBoxItem">
|
||||||
<Setter Property="CornerRadius" Value="0,8,8,0" />
|
<Setter Property="CornerRadius" Value="0,8,8,0" />
|
||||||
@@ -58,12 +57,11 @@
|
|||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="ListBox.AccountSelector > ListBoxItem">
|
<Style Selector="ListBoxItem:selected">
|
||||||
<Setter Property="CornerRadius" Value="0" />
|
<Setter Property="Background" Value="{StaticResource DefaultSelected}"/>
|
||||||
<Setter Property="Margin" Value="0,0,0,0" />
|
</Style>
|
||||||
<Setter Property="Padding" Value="0" />
|
<Style Selector="ListBoxItem:pressed">
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="{StaticResource DefaultSelected}"/>
|
||||||
<Setter Property="Focusable" Value="False" />
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="TextBox">
|
<Style Selector="TextBox">
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public partial class MainViewModel : ViewModelBase
|
|||||||
|
|
||||||
[GenerateProperty] private DebugService DebugService { get; } = default!;
|
[GenerateProperty] private DebugService DebugService { get; } = default!;
|
||||||
[GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!;
|
[GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!;
|
||||||
[GenerateProperty] private ViewHelperService ViewHelperService { get; } = default!;
|
[GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; } = default!;
|
||||||
|
|
||||||
public ObservableCollection<ListItemTemplate> Items { get; private set; }
|
public ObservableCollection<ListItemTemplate> Items { get; private set; }
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public partial class AccountInfoViewModel : ViewModelBase
|
|||||||
[GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!;
|
[GenerateProperty] private PopupMessageService PopupMessageService { get; } = default!;
|
||||||
[GenerateProperty] private ConfigurationService ConfigurationService { get; } = default!;
|
[GenerateProperty] private ConfigurationService ConfigurationService { get; } = default!;
|
||||||
[GenerateProperty] private AuthService AuthService { get; } = default!;
|
[GenerateProperty] private AuthService AuthService { get; } = default!;
|
||||||
[GenerateProperty] private ViewHelperService ViewHelperService { get; } = default!;
|
[GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; } = default!;
|
||||||
|
|
||||||
public ObservableCollection<AuthLoginPasswordModel> Accounts { get; } = new();
|
public ObservableCollection<AuthLoginPasswordModel> Accounts { get; } = new();
|
||||||
public ObservableCollection<string> AuthUrls { get; } = new();
|
public ObservableCollection<string> AuthUrls { get; } = new();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public sealed partial class ContentBrowserViewModel : ViewModelBase
|
|||||||
[GenerateProperty] private DebugService DebugService { get; } = default!;
|
[GenerateProperty] private DebugService DebugService { get; } = default!;
|
||||||
[GenerateProperty] private PopupMessageService PopupService { get; } = default!;
|
[GenerateProperty] private PopupMessageService PopupService { get; } = default!;
|
||||||
[GenerateProperty] private HubService HubService { get; } = default!;
|
[GenerateProperty] private HubService HubService { get; } = default!;
|
||||||
[GenerateProperty] private ViewHelperService ViewHelperService { get; } = default!;
|
[GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; } = default!;
|
||||||
|
|
||||||
public ObservableCollection<ContentEntry> Entries { get; } = new();
|
public ObservableCollection<ContentEntry> Entries { get; } = new();
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public partial class ServerListViewModel : ViewModelBase
|
|||||||
|
|
||||||
public Action? OnSearchChange;
|
public Action? OnSearchChange;
|
||||||
[GenerateProperty] private HubService HubService { get; } = default!;
|
[GenerateProperty] private HubService HubService { get; } = default!;
|
||||||
[GenerateProperty] private ViewHelperService ViewHelperService { get; } = default!;
|
[GenerateProperty, DesignConstruct] private ViewHelperService ViewHelperService { get; } = default!;
|
||||||
public ObservableCollection<ServerEntryModelView> ServerInfos { get; } = new();
|
public ObservableCollection<ServerEntryModelView> ServerInfos { get; } = new();
|
||||||
private List<ServerHubInfo> UnsortedServers { get; } = new();
|
private List<ServerHubInfo> UnsortedServers { get; } = new();
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,9 @@
|
|||||||
PaneBackground="#00000000">
|
PaneBackground="#00000000">
|
||||||
<SplitView.Pane>
|
<SplitView.Pane>
|
||||||
<Border
|
<Border
|
||||||
Background="{StaticResource DefaultBackground}"
|
Background="{StaticResource DefaultForeground}"
|
||||||
BorderThickness="0,0,2,0"
|
BorderThickness="0,0,2,0"
|
||||||
CornerRadius="0,0,0,0"
|
CornerRadius="0,8,8,0"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Margin="0,0,5,0"
|
Margin="0,0,5,0"
|
||||||
@@ -80,6 +80,7 @@
|
|||||||
<Border
|
<Border
|
||||||
BorderThickness="0,2,0,0"
|
BorderThickness="0,2,0,0"
|
||||||
CornerRadius="0,0,0,0"
|
CornerRadius="0,0,0,0"
|
||||||
|
Background="{StaticResource DefaultForeground}"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
@@ -95,7 +96,7 @@
|
|||||||
Margin="0"
|
Margin="0"
|
||||||
Padding="0"
|
Padding="0"
|
||||||
VerticalAlignment="Center">
|
VerticalAlignment="Center">
|
||||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center">https://cinka.ru/nebula-launcher/</TextBlock>
|
<TextBlock Foreground="#777777" HorizontalAlignment="Left" VerticalAlignment="Center">https://cinka.ru/nebula-launcher/</TextBlock>
|
||||||
</Button>
|
</Button>
|
||||||
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center">prototype-product-v0.01</TextBlock>
|
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center">prototype-product-v0.01</TextBlock>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|||||||
@@ -20,13 +20,12 @@
|
|||||||
RowDefinitions="*,40">
|
RowDefinitions="*,40">
|
||||||
<ScrollViewer Margin="0,0,0,10" Padding="0,0,10,0" Grid.RowSpan="2">
|
<ScrollViewer Margin="0,0,0,10" Padding="0,0,10,0" Grid.RowSpan="2">
|
||||||
<ItemsControl
|
<ItemsControl
|
||||||
Background="#00000000"
|
|
||||||
ItemsSource="{Binding ServerInfos}"
|
ItemsSource="{Binding ServerInfos}"
|
||||||
Padding="0">
|
Padding="0">
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
<Border Grid.Row="1" Background="{StaticResource DefaultBackground}" BoxShadow="none">
|
<Border Grid.Row="1" Background="{StaticResource DefaultBackground}" BorderThickness="0">
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,14 @@
|
|||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
|
|
||||||
<Border
|
<Border
|
||||||
Background="#00000000"
|
Background="Transparent"
|
||||||
BorderThickness="2,1,0,1"
|
BorderThickness="3,1,0,1"
|
||||||
|
BorderBrush="{StaticResource DefaultForeground}"
|
||||||
CornerRadius="10"
|
CornerRadius="10"
|
||||||
Margin="5">
|
Margin="5">
|
||||||
<Grid ColumnDefinitions="*,80,50" RowDefinitions="35,*,*">
|
<Grid ColumnDefinitions="*,80,50" RowDefinitions="35,*,*">
|
||||||
<Border
|
<Border
|
||||||
|
BorderBrush="{StaticResource DefaultForeground}"
|
||||||
Background="#00000000"
|
Background="#00000000"
|
||||||
BorderThickness="0,0,0,2"
|
BorderThickness="0,0,0,2"
|
||||||
CornerRadius="10"
|
CornerRadius="10"
|
||||||
@@ -96,7 +98,8 @@
|
|||||||
</Label>
|
</Label>
|
||||||
|
|
||||||
<Border
|
<Border
|
||||||
Background="#00000000"
|
BorderBrush="{StaticResource DefaultForeground}"
|
||||||
|
Background="Transparent"
|
||||||
BorderThickness="0,2,0,0"
|
BorderThickness="0,2,0,0"
|
||||||
CornerRadius="10"
|
CornerRadius="10"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
@@ -111,8 +114,9 @@
|
|||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type system:String}">
|
<DataTemplate DataType="{x:Type system:String}">
|
||||||
<Border
|
<Border
|
||||||
Background="#121212"
|
Background="{StaticResource DefaultForeground}"
|
||||||
CornerRadius="8"
|
CornerRadius="8"
|
||||||
|
BorderThickness="0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Margin="1,1,1,1"
|
Margin="1,1,1,1"
|
||||||
VerticalAlignment="Center">
|
VerticalAlignment="Center">
|
||||||
@@ -136,8 +140,9 @@
|
|||||||
<StackPanel Orientation="Horizontal" >
|
<StackPanel Orientation="Horizontal" >
|
||||||
<Label FontSize="10" VerticalAlignment="Center">Map:</Label>
|
<Label FontSize="10" VerticalAlignment="Center">Map:</Label>
|
||||||
<Border
|
<Border
|
||||||
Background="#121212"
|
Background="{StaticResource DefaultForeground}"
|
||||||
CornerRadius="8"
|
CornerRadius="8"
|
||||||
|
BorderThickness="0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Margin="5"
|
Margin="5"
|
||||||
VerticalAlignment="Center">
|
VerticalAlignment="Center">
|
||||||
@@ -150,8 +155,9 @@
|
|||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label FontSize="10" VerticalAlignment="Center">Preset:</Label>
|
<Label FontSize="10" VerticalAlignment="Center">Preset:</Label>
|
||||||
<Border
|
<Border
|
||||||
Background="#121212"
|
Background="{StaticResource DefaultForeground}"
|
||||||
CornerRadius="8"
|
CornerRadius="8"
|
||||||
|
BorderThickness="0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Margin="5"
|
Margin="5"
|
||||||
VerticalAlignment="Center">
|
VerticalAlignment="Center">
|
||||||
|
|||||||
@@ -4,4 +4,9 @@ namespace Nebula.Shared.Attributes
|
|||||||
public class GeneratePropertyAttribute : Attribute
|
public class GeneratePropertyAttribute : Attribute
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class DesignConstructAttribute : Attribute
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -39,23 +39,28 @@ public class DependencyAutoGenerator : IIncrementalGenerator
|
|||||||
var namespaceName = classSymbol.ContainingNamespace.ToDisplayString();
|
var namespaceName = classSymbol.ContainingNamespace.ToDisplayString();
|
||||||
var className = classDeclarationSyntax.Identifier.Text;
|
var className = classDeclarationSyntax.Identifier.Text;
|
||||||
|
|
||||||
var defaultConstruct = $@"public {className}(){{
|
|
||||||
InitialiseInDesignMode();
|
|
||||||
}}";
|
|
||||||
|
|
||||||
var propertiesGenerated = GetProperties(classSymbol).ToList();
|
var propertiesGenerated = GetProperties(classSymbol).ToList();
|
||||||
|
|
||||||
var constr = propertiesGenerated.Select(a => $"{a.Type.ToDisplayString()} g{a.Name}");
|
var constr = propertiesGenerated.Select(a => $"{a.Type.ToDisplayString()} g{a.Name}");
|
||||||
var body = propertiesGenerated.Select(a => $"this.{a.Name} = g{a.Name};");
|
var body = propertiesGenerated.Select(a => $"this.{a.Name} = g{a.Name};");
|
||||||
|
|
||||||
//if (!constr.Any()) defaultConstruct = "";
|
var propertiesGeneratedC = GetProperties(classSymbol)
|
||||||
|
.Where(a=>
|
||||||
|
SourceHelper.HasAttribute(a,"Nebula.Shared.Attributes.DesignConstructAttribute"))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var bodyC = propertiesGeneratedC.Select(a => $"this.{a.Name} = new {a.Type.ToDisplayString()}();");
|
||||||
|
|
||||||
var code = $@"// <auto-generated/>
|
var code = $@"// <auto-generated/>
|
||||||
namespace {namespaceName};
|
namespace {namespaceName};
|
||||||
|
|
||||||
partial class {className}
|
partial class {className}
|
||||||
{{
|
{{
|
||||||
{defaultConstruct}
|
|
||||||
|
public {className}(){{
|
||||||
|
{string.Join("\n\t\t", bodyC)}
|
||||||
|
InitialiseInDesignMode();
|
||||||
|
}}
|
||||||
public {className}(
|
public {className}(
|
||||||
{string.Join(",\n\t\t", constr)}
|
{string.Join(",\n\t\t", constr)}
|
||||||
) : base(){{
|
) : base(){{
|
||||||
|
|||||||
Reference in New Issue
Block a user