- init: initial think
This commit is contained in:
39
Nebula.Launcher/App.axaml
Normal file
39
Nebula.Launcher/App.axaml
Normal file
@@ -0,0 +1,39 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="Nebula.Launcher.App"
|
||||
xmlns:local="using:Nebula.Launcher"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator/>
|
||||
</Application.DataTemplates>
|
||||
|
||||
<Application.Styles>
|
||||
<Style Selector="Window">
|
||||
<Setter Property="Background" Value="#121212"/>
|
||||
</Style>
|
||||
<Style Selector="Border">
|
||||
<Setter Property="BorderBrush" Value="#343334"/>
|
||||
<Setter Property="Background" Value="#222222"/>
|
||||
</Style>
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="Foreground" Value="#f7f7ff"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.ViewSelectButton">
|
||||
<Setter Property="CornerRadius" Value="0,8,8,0"/>
|
||||
<Setter Property="Margin" Value="0,0,0,5"/>
|
||||
<Setter Property="Padding" Value="8"/>
|
||||
<Setter Property="Background" Value="#00000000"/>
|
||||
</Style>
|
||||
<Style Selector="Button.ViewSelectButton:pressed">
|
||||
<Setter Property="Background" Value="#e63462"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button">
|
||||
<Setter Property="Background" Value="#e63462"/>
|
||||
<Setter Property="BorderBrush" Value="#343334"/>
|
||||
</Style>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
42
Nebula.Launcher/App.axaml.cs
Normal file
42
Nebula.Launcher/App.axaml.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Data.Core;
|
||||
using Avalonia.Data.Core.Plugins;
|
||||
using System.Linq;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Nebula.Launcher.ViewModels;
|
||||
using Nebula.Launcher.Views;
|
||||
|
||||
namespace Nebula.Launcher;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
DisableAvaloniaDataAnnotationValidation();
|
||||
desktop.MainWindow = new MainWindow();
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
|
||||
private void DisableAvaloniaDataAnnotationValidation()
|
||||
{
|
||||
// Get an array of plugins to remove
|
||||
var dataValidationPluginsToRemove =
|
||||
BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray();
|
||||
|
||||
// remove each entry found
|
||||
foreach (var plugin in dataValidationPluginsToRemove)
|
||||
{
|
||||
BindingPlugins.DataValidators.Remove(plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Nebula.Launcher/Assets/account.png
Normal file
BIN
Nebula.Launcher/Assets/account.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
2
Nebula.Launcher/Assets/attribution.txt
Normal file
2
Nebula.Launcher/Assets/attribution.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
account.png Icon by Icon Desai
|
||||
list.png Icon by Vector Stall
|
||||
BIN
Nebula.Launcher/Assets/avalonia-logo.ico
Normal file
BIN
Nebula.Launcher/Assets/avalonia-logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
BIN
Nebula.Launcher/Assets/list.png
Normal file
BIN
Nebula.Launcher/Assets/list.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
30
Nebula.Launcher/Nebula.Launcher.csproj
Normal file
30
Nebula.Launcher/Nebula.Launcher.csproj
Normal file
@@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AsyncImageLoader.Avalonia" Version="3.3.0" />
|
||||
<PackageReference Include="Avalonia" Version="11.2.1" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.2.1" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.1" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.1" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.1" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Include="Avalonia.Diagnostics" Version="11.2.1">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
23
Nebula.Launcher/Program.cs
Normal file
23
Nebula.Launcher/Program.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Nebula.Launcher;
|
||||
|
||||
sealed class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.UseReactiveUI()
|
||||
.LogToTrace();
|
||||
}
|
||||
30
Nebula.Launcher/ViewLocator.cs
Normal file
30
Nebula.Launcher/ViewLocator.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Nebula.Launcher.ViewModels;
|
||||
|
||||
namespace Nebula.Launcher;
|
||||
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
public Control? Build(object? param)
|
||||
{
|
||||
if (param is null)
|
||||
return null;
|
||||
|
||||
var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal);
|
||||
var type = Type.GetType(name);
|
||||
|
||||
if (type != null)
|
||||
{
|
||||
return (Control)Activator.CreateInstance(type)!;
|
||||
}
|
||||
|
||||
return new TextBlock { Text = "Not Found: " + name };
|
||||
}
|
||||
|
||||
public bool Match(object? data)
|
||||
{
|
||||
return data is ViewModelBase;
|
||||
}
|
||||
}
|
||||
21
Nebula.Launcher/ViewModels/TestViewModel.cs
Normal file
21
Nebula.Launcher/ViewModels/TestViewModel.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Nebula.Launcher.ViewModels;
|
||||
|
||||
public sealed class TestViewModel : ViewModelBase
|
||||
{
|
||||
private string _greeting = "Welcome to Avalonia!";
|
||||
|
||||
public string Greeting
|
||||
{
|
||||
get => _greeting;
|
||||
set => this.RaiseAndSetIfChanged(ref _greeting, value);
|
||||
}
|
||||
|
||||
public void ButtonAction()
|
||||
{
|
||||
Console.WriteLine("HAS");
|
||||
Greeting = "Another greeting from Avalonia";
|
||||
}
|
||||
}
|
||||
7
Nebula.Launcher/ViewModels/ViewModelBase.cs
Normal file
7
Nebula.Launcher/ViewModels/ViewModelBase.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Nebula.Launcher.ViewModels;
|
||||
|
||||
public abstract class ViewModelBase : ReactiveObject
|
||||
{
|
||||
}
|
||||
52
Nebula.Launcher/Views/MainWindow.axaml
Normal file
52
Nebula.Launcher/Views/MainWindow.axaml
Normal file
@@ -0,0 +1,52 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Nebula.Launcher.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
|
||||
xmlns:views="clr-namespace:Nebula.Launcher.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Nebula.Launcher.Views.MainWindow"
|
||||
x:DataType="vm:TestViewModel"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="Nebula.Launcher">
|
||||
|
||||
|
||||
|
||||
<Grid ColumnDefinitions="60,*" RowDefinitions="*,40" Margin="0">
|
||||
<Border Grid.Row="0" Grid.Column="0"
|
||||
BorderThickness="0,0,2,0"
|
||||
CornerRadius="0,8,8,0"
|
||||
Padding="0" Margin="0,0,5,0">
|
||||
<StackPanel>
|
||||
<Button Classes="ViewSelectButton">
|
||||
<Image Source="../Assets/account.png"/>
|
||||
</Button>
|
||||
<Button Classes="ViewSelectButton">
|
||||
<Image Source="../Assets/list.png"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<StackPanel Grid.Column="1" Grid.Row="0">
|
||||
<ScrollViewer
|
||||
HorizontalScrollBarVisibility="Visible"
|
||||
VerticalScrollBarVisibility="Disabled"
|
||||
Padding="5">
|
||||
<views:ServerList/>
|
||||
</ScrollViewer>
|
||||
</StackPanel>
|
||||
|
||||
<Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
|
||||
BorderThickness="0,2,0,0"
|
||||
CornerRadius="0,0,0,0"
|
||||
Padding="5"
|
||||
Margin="0,0,0,0">
|
||||
<Panel>
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center">Site: ssilka | Discord: lala</TextBlock>
|
||||
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center">v1.5</TextBlock>
|
||||
</Panel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
11
Nebula.Launcher/Views/MainWindow.axaml.cs
Normal file
11
Nebula.Launcher/Views/MainWindow.axaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Nebula.Launcher.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
36
Nebula.Launcher/Views/ServerContainer.axaml
Normal file
36
Nebula.Launcher/Views/ServerContainer.axaml
Normal file
@@ -0,0 +1,36 @@
|
||||
<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:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Nebula.Launcher.Views.ServerContainer">
|
||||
<Grid ColumnDefinitions="*,70" RowDefinitions="*,*" Margin="0,5,0,5">
|
||||
<Border Grid.Row="0" Grid.Column="0"
|
||||
Padding="5">
|
||||
<TextBlock>Server name</TextBlock>
|
||||
</Border>
|
||||
<Border Grid.Row="0" Grid.Column="1"
|
||||
BorderThickness="2,0,0,0"
|
||||
CornerRadius="0"
|
||||
Padding="5">
|
||||
<TextBlock HorizontalAlignment="Center">15/15</TextBlock>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
|
||||
Height="50"
|
||||
CornerRadius="0,0,10,10">
|
||||
<Border.Background>
|
||||
<ImageBrush Stretch="UniformToFill"
|
||||
asyncImageLoader:ImageBrushLoader.Source="https://t4.ftcdn.net/jpg/00/81/55/69/360_F_81556974_8sF8cKszJaRfBGd5sDt1RXE2QbzDtQqs.jpg">
|
||||
</ImageBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
|
||||
<Panel Grid.Row="1" Grid.Column="1">
|
||||
<Button VerticalAlignment="Stretch" CornerRadius="0 0 10 0" BorderThickness="0,0,0,0">
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5">Play</TextBlock>
|
||||
</Button>
|
||||
</Panel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
Nebula.Launcher/Views/ServerContainer.axaml.cs
Normal file
13
Nebula.Launcher/Views/ServerContainer.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Nebula.Launcher.Views;
|
||||
|
||||
public partial class ServerContainer : UserControl
|
||||
{
|
||||
public ServerContainer()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
17
Nebula.Launcher/Views/ServerList.axaml
Normal file
17
Nebula.Launcher/Views/ServerList.axaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<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:views="clr-namespace:Nebula.Launcher.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Nebula.Launcher.Views.ServerList">
|
||||
<StackPanel>
|
||||
<views:ServerContainer/>
|
||||
<views:ServerContainer/>
|
||||
<views:ServerContainer/>
|
||||
<views:ServerContainer/>
|
||||
<views:ServerContainer/>
|
||||
<views:ServerContainer/>
|
||||
<views:ServerContainer/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
13
Nebula.Launcher/Views/ServerList.axaml.cs
Normal file
13
Nebula.Launcher/Views/ServerList.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Nebula.Launcher.Views;
|
||||
|
||||
public partial class ServerList : UserControl
|
||||
{
|
||||
public ServerList()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
18
Nebula.Launcher/app.manifest
Normal file
18
Nebula.Launcher/app.manifest
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embedded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="Nebula.Launcher.Desktop"/>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user