- tweak: Change views logic
This commit is contained in:
1
.idea/.idea.Nebula/.idea/avalonia.xml
generated
1
.idea/.idea.Nebula/.idea/avalonia.xml
generated
@@ -23,6 +23,7 @@
|
|||||||
<entry key="Nebula.Launcher/Views/Popup/LogPopupView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
<entry key="Nebula.Launcher/Views/Popup/LogPopupView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
||||||
<entry key="Nebula.Launcher/Views/Popup/MessagePopupView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
<entry key="Nebula.Launcher/Views/Popup/MessagePopupView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
||||||
<entry key="Nebula.Launcher/Views/ServerContainer.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
<entry key="Nebula.Launcher/Views/ServerContainer.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
||||||
|
<entry key="Nebula.Launcher/Views/ServerEntryView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
||||||
<entry key="Nebula.Launcher/Views/ServerList.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
<entry key="Nebula.Launcher/Views/ServerList.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
||||||
<entry key="Nebula.Launcher/Views/Tabs/AccountInfoTab.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
<entry key="Nebula.Launcher/Views/Tabs/AccountInfoTab.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
||||||
<entry key="Nebula.Launcher/Views/Tabs/ServerListTab.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
<entry key="Nebula.Launcher/Views/Tabs/ServerListTab.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Data.Core.Plugins;
|
using Avalonia.Data.Core.Plugins;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
@@ -12,32 +13,47 @@ namespace Nebula.Launcher;
|
|||||||
|
|
||||||
public class App : Application
|
public class App : Application
|
||||||
{
|
{
|
||||||
private IServiceProvider _serviceProvider = null!;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnFrameworkInitializationCompleted()
|
public override void OnFrameworkInitializationCompleted()
|
||||||
|
{
|
||||||
|
if (Design.IsDesignMode)
|
||||||
|
{
|
||||||
|
switch (ApplicationLifetime)
|
||||||
|
{
|
||||||
|
case IClassicDesktopStyleApplicationLifetime desktop:
|
||||||
|
DisableAvaloniaDataAnnotationValidation();
|
||||||
|
desktop.MainWindow = new MainWindow();
|
||||||
|
break;
|
||||||
|
case ISingleViewApplicationLifetime singleViewPlatform:
|
||||||
|
singleViewPlatform.MainView = new MainView();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
services.AddAvaloniaServices();
|
services.AddAvaloniaServices();
|
||||||
services.AddServices();
|
services.AddServices();
|
||||||
services.AddViews();
|
services.AddViews();
|
||||||
|
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
var serviceProvider = services.BuildServiceProvider();
|
||||||
|
|
||||||
switch (ApplicationLifetime)
|
switch (ApplicationLifetime)
|
||||||
{
|
{
|
||||||
case IClassicDesktopStyleApplicationLifetime desktop:
|
case IClassicDesktopStyleApplicationLifetime desktop:
|
||||||
DisableAvaloniaDataAnnotationValidation();
|
DisableAvaloniaDataAnnotationValidation();
|
||||||
desktop.MainWindow = _serviceProvider.GetService<MainWindow>();
|
desktop.MainWindow = serviceProvider.GetService<MainWindow>();
|
||||||
break;
|
break;
|
||||||
case ISingleViewApplicationLifetime singleViewPlatform:
|
case ISingleViewApplicationLifetime singleViewPlatform:
|
||||||
singleViewPlatform.MainView = _serviceProvider.GetRequiredService<MainView>();
|
singleViewPlatform.MainView = serviceProvider.GetRequiredService<MainView>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
base.OnFrameworkInitializationCompleted();
|
base.OnFrameworkInitializationCompleted();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ public partial class ServerListViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
ServerInfos.Add(CreateServerView(new ServerHubInfo("ss14://localhost",
|
ServerInfos.Add(CreateServerView(new ServerHubInfo("ss14://localhost",
|
||||||
new ServerStatus("Nebula", "TestCraft", ["16+", "RU"], "super", 12, 55, 1, false, DateTime.Now, 20), [])));
|
new ServerStatus("Nebula", "TestCraft", ["16+", "RU"], "super", 12, 55, 1, false, DateTime.Now, 20), [])));
|
||||||
|
ServerInfos.Add(CreateServerView(new ServerHubInfo("ss14://localhost",
|
||||||
|
new ServerStatus("Nebula", "TestCraft", ["16+", "RU"], "super", 12, 55, 1, false, DateTime.Now, 20), [])));
|
||||||
|
ServerInfos.Add(CreateServerView(new ServerHubInfo("ss14://localhost",
|
||||||
|
new ServerStatus("Nebula", "TestCraft", ["16+", "RU"], "super", 12, 55, 1, false, DateTime.Now, 20), [])));
|
||||||
}
|
}
|
||||||
|
|
||||||
//real think
|
//real think
|
||||||
|
|||||||
@@ -7,12 +7,13 @@ using System.Threading.Tasks;
|
|||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using Nebula.Launcher.Services;
|
using Nebula.Launcher.Services;
|
||||||
using Nebula.Launcher.ViewModels.Popup;
|
using Nebula.Launcher.ViewModels.Popup;
|
||||||
|
using Nebula.Launcher.Views;
|
||||||
using Nebula.Shared.Models;
|
using Nebula.Shared.Models;
|
||||||
using Nebula.Shared.Services;
|
using Nebula.Shared.Services;
|
||||||
|
|
||||||
namespace Nebula.Launcher.ViewModels;
|
namespace Nebula.Launcher.ViewModels;
|
||||||
|
|
||||||
[ViewModelRegister(isSingleton: false)]
|
[ViewModelRegister(typeof(ServerEntryView), isSingleton: false)]
|
||||||
[ConstructGenerator]
|
[ConstructGenerator]
|
||||||
public partial class ServerEntryModelView : ViewModelBase
|
public partial class ServerEntryModelView : ViewModelBase
|
||||||
{
|
{
|
||||||
@@ -44,7 +45,7 @@ public partial class ServerEntryModelView : ViewModelBase
|
|||||||
|
|
||||||
protected override void InitialiseInDesignMode()
|
protected override void InitialiseInDesignMode()
|
||||||
{
|
{
|
||||||
CurrLog = ViewHelperService.GetViewModel<LogPopupModelView>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialise()
|
protected override void Initialise()
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ using AccountInfoViewModel = Nebula.Launcher.ViewModels.Pages.AccountInfoViewMod
|
|||||||
|
|
||||||
namespace Nebula.Launcher.Views.Pages;
|
namespace Nebula.Launcher.Views.Pages;
|
||||||
|
|
||||||
public interface ITab;
|
|
||||||
|
|
||||||
public partial class AccountInfoView : UserControl
|
public partial class AccountInfoView : UserControl
|
||||||
{
|
{
|
||||||
public AccountInfoView()
|
public AccountInfoView()
|
||||||
|
|||||||
@@ -5,10 +5,8 @@
|
|||||||
x:Class="Nebula.Launcher.Views.Pages.ServerListView"
|
x:Class="Nebula.Launcher.Views.Pages.ServerListView"
|
||||||
x:DataType="pages:ServerListViewModel"
|
x:DataType="pages:ServerListViewModel"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:viewModels="clr-namespace:Nebula.Launcher.ViewModels"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages">
|
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages">
|
||||||
|
|
||||||
@@ -25,144 +23,6 @@
|
|||||||
Background="#00000000"
|
Background="#00000000"
|
||||||
ItemsSource="{Binding ServerInfos}"
|
ItemsSource="{Binding ServerInfos}"
|
||||||
Padding="0">
|
Padding="0">
|
||||||
<ItemsControl.ItemTemplate>
|
|
||||||
<DataTemplate DataType="{x:Type viewModels:ServerEntryModelView}">
|
|
||||||
<Grid
|
|
||||||
ColumnDefinitions="*,120"
|
|
||||||
Margin="0,5,0,5"
|
|
||||||
RowDefinitions="30,*">
|
|
||||||
<Border
|
|
||||||
BorderThickness="2,0,0,0"
|
|
||||||
CornerRadius="10,0,0,0"
|
|
||||||
Grid.Column="0"
|
|
||||||
Grid.Row="0"
|
|
||||||
Padding="10,0,0,0">
|
|
||||||
<Label VerticalAlignment="Center">
|
|
||||||
<TextBlock Text="{Binding ServerHubInfo.StatusData.Name}" />
|
|
||||||
</Label>
|
|
||||||
</Border>
|
|
||||||
<Border
|
|
||||||
BorderThickness="2,0,2,0"
|
|
||||||
CornerRadius="0,10,0,0"
|
|
||||||
Grid.Column="1"
|
|
||||||
Grid.Row="0"
|
|
||||||
Padding="5">
|
|
||||||
<StackPanel
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Orientation="Horizontal"
|
|
||||||
VerticalAlignment="Center">
|
|
||||||
<Label>
|
|
||||||
<TextBlock Text="{Binding ServerHubInfo.StatusData.Players}" />
|
|
||||||
</Label>
|
|
||||||
<Label>/</Label>
|
|
||||||
<Label>
|
|
||||||
<TextBlock Text="{Binding ServerHubInfo.StatusData.SoftMaxPlayers}" />
|
|
||||||
</Label>
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<Border
|
|
||||||
BorderThickness="2,0,0,0"
|
|
||||||
CornerRadius="0,0,10,10"
|
|
||||||
Grid.Column="0"
|
|
||||||
Grid.ColumnSpan="2"
|
|
||||||
Grid.Row="1"
|
|
||||||
MinHeight="50">
|
|
||||||
<Border.Background>
|
|
||||||
<ImageBrush Stretch="UniformToFill"
|
|
||||||
asyncImageLoader:ImageBrushLoader.Source="https://t4.ftcdn.net/jpg/00/81/55/69/360_F_81556974_8sF8cKszJaRfBGd5sDt1RXE2QbzDtQqs.jpg" />
|
|
||||||
</Border.Background>
|
|
||||||
<Border
|
|
||||||
BorderThickness="0,2,2,0"
|
|
||||||
CornerRadius="0,0,10,10"
|
|
||||||
IsVisible="True"
|
|
||||||
Margin="0,0,0,0"
|
|
||||||
Opacity="40"
|
|
||||||
Padding="0">
|
|
||||||
<UniformGrid Margin="15,5,15,0">
|
|
||||||
<UniformGrid.Styles>
|
|
||||||
<Style Selector="Label">
|
|
||||||
<Setter Property="FontSize" Value="8" />
|
|
||||||
</Style>
|
|
||||||
</UniformGrid.Styles>
|
|
||||||
<Label>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Margin="0,0,5,0">RoundStart:</TextBlock>
|
|
||||||
<TextBlock Text="{Binding ServerHubInfo.StatusData.RoundStartTime}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Label>
|
|
||||||
<Label>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Margin="0,0,5,0">Map:</TextBlock>
|
|
||||||
<TextBlock Text="{Binding ServerHubInfo.StatusData.Map}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Label>
|
|
||||||
<Label>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Margin="0,0,5,0">Preset:</TextBlock>
|
|
||||||
<TextBlock Text="{Binding ServerHubInfo.StatusData.Preset}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Label>
|
|
||||||
<Label>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Margin="0,0,5,0">PanicBunker:</TextBlock>
|
|
||||||
<TextBlock Text="{Binding ServerHubInfo.StatusData.PanicBunker}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Label>
|
|
||||||
<Label>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Margin="0,0,5,0">Round Id:</TextBlock>
|
|
||||||
<TextBlock Text="{Binding ServerHubInfo.StatusData.RoundId}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Label>
|
|
||||||
<Label>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Margin="0,0,5,0">Run Level:</TextBlock>
|
|
||||||
<TextBlock Text="{Binding ServerHubInfo.StatusData.RunLevel}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Label>
|
|
||||||
</UniformGrid>
|
|
||||||
</Border>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<Panel Grid.Column="1" Grid.Row="1">
|
|
||||||
<Button
|
|
||||||
Command="{Binding RunInstance}"
|
|
||||||
CornerRadius="10,0,10,10"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
IsVisible="{Binding RunVisible}"
|
|
||||||
VerticalAlignment="Stretch">
|
|
||||||
<Label HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
||||||
Play
|
|
||||||
</Label>
|
|
||||||
</Button>
|
|
||||||
<Grid Grid.ColumnDefinitions="*,*" IsVisible="{Binding !RunVisible}">
|
|
||||||
<Button
|
|
||||||
Command="{Binding ReadLog}"
|
|
||||||
CornerRadius="10,0,0,10"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Margin="0,0,1,0"
|
|
||||||
VerticalAlignment="Stretch">
|
|
||||||
<Label HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
||||||
Log
|
|
||||||
</Label>
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
Command="{Binding StopInstance}"
|
|
||||||
CornerRadius="0,0,10,0"
|
|
||||||
Grid.Column="1"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Margin="1,0,0,0"
|
|
||||||
VerticalAlignment="Stretch">
|
|
||||||
<Label HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
||||||
Stop
|
|
||||||
</Label>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
|
||||||
</Panel>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
|
|||||||
148
Nebula.Launcher/Views/ServerEntryView.axaml
Normal file
148
Nebula.Launcher/Views/ServerEntryView.axaml
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:viewModels="clr-namespace:Nebula.Launcher.ViewModels"
|
||||||
|
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="100"
|
||||||
|
x:Class="Nebula.Launcher.Views.ServerEntryView"
|
||||||
|
x:DataType="viewModels:ServerEntryModelView">
|
||||||
|
<Design.DataContext>
|
||||||
|
<viewModels:ServerEntryModelView />
|
||||||
|
</Design.DataContext>
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
ColumnDefinitions="*,120"
|
||||||
|
Margin="0,5,0,5"
|
||||||
|
RowDefinitions="30,*">
|
||||||
|
<Border
|
||||||
|
BorderThickness="2,0,0,0"
|
||||||
|
CornerRadius="10,0,0,0"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="0"
|
||||||
|
Padding="10,0,0,0">
|
||||||
|
<Label VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="{Binding ServerHubInfo.StatusData.Name}" />
|
||||||
|
</Label>
|
||||||
|
</Border>
|
||||||
|
<Border
|
||||||
|
BorderThickness="2,0,2,0"
|
||||||
|
CornerRadius="0,10,0,0"
|
||||||
|
Grid.Column="1"
|
||||||
|
Grid.Row="0"
|
||||||
|
Padding="5">
|
||||||
|
<StackPanel
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
VerticalAlignment="Center">
|
||||||
|
<Label>
|
||||||
|
<TextBlock Text="{Binding ServerHubInfo.StatusData.Players}" />
|
||||||
|
</Label>
|
||||||
|
<Label>/</Label>
|
||||||
|
<Label>
|
||||||
|
<TextBlock Text="{Binding ServerHubInfo.StatusData.SoftMaxPlayers}" />
|
||||||
|
</Label>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border
|
||||||
|
BorderThickness="2,0,0,0"
|
||||||
|
CornerRadius="0,0,10,10"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Grid.Row="1"
|
||||||
|
MinHeight="50">
|
||||||
|
<Border.Background>
|
||||||
|
<ImageBrush Stretch="UniformToFill"
|
||||||
|
asyncImageLoader:ImageBrushLoader.Source="https://t4.ftcdn.net/jpg/00/81/55/69/360_F_81556974_8sF8cKszJaRfBGd5sDt1RXE2QbzDtQqs.jpg" />
|
||||||
|
</Border.Background>
|
||||||
|
<Border
|
||||||
|
BorderThickness="0,2,2,0"
|
||||||
|
CornerRadius="0,0,10,10"
|
||||||
|
IsVisible="True"
|
||||||
|
Margin="0,0,0,0"
|
||||||
|
Opacity="40"
|
||||||
|
Padding="0">
|
||||||
|
<UniformGrid Margin="15,5,15,0">
|
||||||
|
<UniformGrid.Styles>
|
||||||
|
<Style Selector="Label">
|
||||||
|
<Setter Property="FontSize" Value="8" />
|
||||||
|
</Style>
|
||||||
|
</UniformGrid.Styles>
|
||||||
|
<Label>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="0,0,5,0">RoundStart:</TextBlock>
|
||||||
|
<TextBlock Text="{Binding ServerHubInfo.StatusData.RoundStartTime}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Label>
|
||||||
|
<Label>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="0,0,5,0">Map:</TextBlock>
|
||||||
|
<TextBlock Text="{Binding ServerHubInfo.StatusData.Map}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Label>
|
||||||
|
<Label>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="0,0,5,0">Preset:</TextBlock>
|
||||||
|
<TextBlock Text="{Binding ServerHubInfo.StatusData.Preset}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Label>
|
||||||
|
<Label>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="0,0,5,0">PanicBunker:</TextBlock>
|
||||||
|
<TextBlock Text="{Binding ServerHubInfo.StatusData.PanicBunker}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Label>
|
||||||
|
<Label>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="0,0,5,0">Round Id:</TextBlock>
|
||||||
|
<TextBlock Text="{Binding ServerHubInfo.StatusData.RoundId}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Label>
|
||||||
|
<Label>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="0,0,5,0">Run Level:</TextBlock>
|
||||||
|
<TextBlock Text="{Binding ServerHubInfo.StatusData.RunLevel}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Label>
|
||||||
|
</UniformGrid>
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Panel Grid.Column="1" Grid.Row="1">
|
||||||
|
<Button
|
||||||
|
Command="{Binding RunInstance}"
|
||||||
|
CornerRadius="10,0,10,10"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
IsVisible="{Binding RunVisible}"
|
||||||
|
VerticalAlignment="Stretch">
|
||||||
|
<Label HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
Play
|
||||||
|
</Label>
|
||||||
|
</Button>
|
||||||
|
<Grid Grid.ColumnDefinitions="*,*" IsVisible="{Binding !RunVisible}">
|
||||||
|
<Button
|
||||||
|
Command="{Binding ReadLog}"
|
||||||
|
CornerRadius="10,0,0,10"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Margin="0,0,1,0"
|
||||||
|
VerticalAlignment="Stretch">
|
||||||
|
<Label HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
Log
|
||||||
|
</Label>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Command="{Binding StopInstance}"
|
||||||
|
CornerRadius="0,0,10,0"
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Margin="1,0,0,0"
|
||||||
|
VerticalAlignment="Stretch">
|
||||||
|
<Label HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
Stop
|
||||||
|
</Label>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Panel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
19
Nebula.Launcher/Views/ServerEntryView.axaml.cs
Normal file
19
Nebula.Launcher/Views/ServerEntryView.axaml.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
using Nebula.Launcher.ViewModels;
|
||||||
|
|
||||||
|
namespace Nebula.Launcher.Views;
|
||||||
|
|
||||||
|
public partial class ServerEntryView : UserControl
|
||||||
|
{
|
||||||
|
public ServerEntryView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerEntryView(ServerEntryModelView modelView) : this()
|
||||||
|
{
|
||||||
|
DataContext = modelView;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,32 +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}(){{}}";
|
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 = "";
|
//if (!constr.Any()) defaultConstruct = "";
|
||||||
|
|
||||||
var code = $@"// <auto-generated/>
|
var code = $@"// <auto-generated/>
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace {namespaceName};
|
namespace {namespaceName};
|
||||||
|
|
||||||
partial class {className}
|
partial class {className}
|
||||||
{{
|
{{
|
||||||
|
|
||||||
{defaultConstruct}
|
{defaultConstruct}
|
||||||
public {className}(
|
public {className}(
|
||||||
{string.Join(",\n\t\t", constr)}
|
{string.Join(",\n\t\t", constr)}
|
||||||
) : base(){{
|
) : base(){{
|
||||||
{string.Join("\n\t\t", body)}
|
{string.Join("\n\t\t", body)}
|
||||||
if (Avalonia.Controls.Design.IsDesignMode) InitialiseInDesignMode();
|
Initialise();
|
||||||
else Initialise();
|
|
||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
";
|
";
|
||||||
|
|||||||
Reference in New Issue
Block a user