- add: Favorite, start.

This commit is contained in:
2025-01-13 19:24:12 +03:00
parent fa3b0b7a0b
commit a0b2cfd677
8 changed files with 87 additions and 34 deletions

View File

@@ -14,6 +14,7 @@
<entry key="Nebula.Launcher/Views/Pages/AccountInfoPage.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" /> <entry key="Nebula.Launcher/Views/Pages/AccountInfoPage.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/AccountInfoView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" /> <entry key="Nebula.Launcher/Views/Pages/AccountInfoView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/ContentBrowserView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" /> <entry key="Nebula.Launcher/Views/Pages/ContentBrowserView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/FavoriteServerListView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/ServerListPage.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" /> <entry key="Nebula.Launcher/Views/Pages/ServerListPage.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Pages/ServerListView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" /> <entry key="Nebula.Launcher/Views/Pages/ServerListView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />
<entry key="Nebula.Launcher/Views/Popup/ExceptionView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" /> <entry key="Nebula.Launcher/Views/Popup/ExceptionView.axaml" value="Nebula.Launcher/Nebula.Launcher.csproj" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -143,6 +143,7 @@ public sealed partial class ContentBrowserViewModel : ViewModelBase
if (path.Pathes.Count > 0 && (path.Pathes[0].StartsWith("ss14://") || path.Pathes[0].StartsWith("ss14s://"))) if (path.Pathes.Count > 0 && (path.Pathes[0].StartsWith("ss14://") || path.Pathes[0].StartsWith("ss14s://")))
{ {
ServerText = path.Pathes[0]; ServerText = path.Pathes[0];
path = new ContentPath("");
} }
if (string.IsNullOrEmpty(ServerText)) if (string.IsNullOrEmpty(ServerText))
@@ -157,14 +158,14 @@ public sealed partial class ContentBrowserViewModel : ViewModelBase
SelectedEntry = await CreateEntry(ServerText); SelectedEntry = await CreateEntry(ServerText);
} }
_debugService.Debug(path.Path); _debugService.Debug("Going to:" + path.Path);
var oriPath = path.Clone(); var oriPath = path.Clone();
try try
{ {
if (SelectedEntry == null || !SelectedEntry.GetRoot().TryGetEntry(path, out var centry)) if (SelectedEntry == null || !SelectedEntry.GetRoot().TryGetEntry(path, out var centry))
{ {
throw new Exception("Not found!"); throw new Exception("Not found! " + oriPath.Path);
} }
if (appendHistory) if (appendHistory)

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.ObjectModel;
using Nebula.Shared.Models;
namespace Nebula.Launcher.ViewModels;
public class FavoriteServerListViewModel : ViewModelBase
{
public FavoriteServerListViewModel() : base(){}
public FavoriteServerListViewModel(IServiceProvider provider) : base(provider){}
public ObservableCollection<ServerHubInfo> Servers = new();
}

View File

@@ -13,44 +13,58 @@
<viewModels:ContentBrowserViewModel /> <viewModels:ContentBrowserViewModel />
</Design.DataContext> </Design.DataContext>
<StackPanel Margin="5"> <Grid
<Border BorderThickness="2,0,0,0" CornerRadius="10"> ColumnDefinitions="*,2*,40,40"
<Grid ColumnDefinitions="*,2*,40,40" RowDefinitions="*"> Margin="10"
<TextBox RowDefinitions="40,*">
Margin="0" <Border
Text="{Binding ServerText}" BorderThickness="2,0,0,0"
VerticalAlignment="Center" CornerRadius="10,10,0,0"
Watermark="Server Url..." /> Grid.ColumnSpan="4" />
<TextBox <TextBox
Grid.Column="1" Grid.Column="0"
Margin="0" Grid.Row="0"
Text="{Binding SearchText}" Margin="5"
VerticalAlignment="Center" Text="{Binding ServerText}"
Watermark="Path..." /> VerticalAlignment="Center"
<Button Watermark="Server Url..." />
Command="{Binding OnBackEnter}" <TextBox
Grid.Column="2" Grid.Column="1"
Padding="10"> Grid.Row="0"
<Image Source="/Assets/back.png" /> Margin="5"
</Button> Text="{Binding SearchText}"
<Button VerticalAlignment="Center"
Command="{Binding OnGoEnter}" Watermark="Path..." />
Grid.Column="3" <Button
Padding="10"> Command="{Binding OnBackEnter}"
<Image Source="/Assets/go.png" /> Grid.Column="2"
</Button> Grid.Row="0"
</Grid> Padding="10">
</Border> <Image Source="/Assets/back.png" />
<ScrollViewer Margin="0,5,10,5"> </Button>
<Button
Command="{Binding OnGoEnter}"
Grid.Column="3"
Grid.Row="0"
Padding="10">
<Image Source="/Assets/go.png" />
</Button>
<ScrollViewer
Grid.Column="0"
Grid.ColumnSpan="4"
Grid.Row="1"
Margin="0,0,0,5">
<ItemsControl <ItemsControl
Background="#00000000" Background="#00000000"
ItemsSource="{Binding Entries}" ItemsSource="{Binding Entries}"
Padding="0"> Padding="0,0,0,0">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type viewModels:ContentEntry}"> <DataTemplate DataType="{x:Type viewModels:ContentEntry}">
<Button <Button
Command="{Binding OnPathGo}" Command="{Binding OnPathGo}"
CornerRadius="0" CornerRadius="0"
Height="30"
HorizontalAlignment="Stretch"> HorizontalAlignment="Stretch">
<StackPanel Orientation="Horizontal" Spacing="15"> <StackPanel Orientation="Horizontal" Spacing="15">
<Border <Border
@@ -63,7 +77,7 @@
Source="{Binding IconPath}" /> Source="{Binding IconPath}" />
</Border> </Border>
<Label> <Label>
<TextBlock Text="{Binding Name}" /> <TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
</Label> </Label>
</StackPanel> </StackPanel>
</Button> </Button>
@@ -71,5 +85,5 @@
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
</ScrollViewer> </ScrollViewer>
</StackPanel> </Grid>
</UserControl> </UserControl>

View File

@@ -0,0 +1,11 @@
<UserControl
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="Nebula.Launcher.Views.Pages.FavoriteServerListView"
xmlns="https://github.com/avaloniaui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Welcome to Avalonia!
</UserControl>

View File

@@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Nebula.Launcher.Views.Pages;
public partial class FavoriteServerListView : UserControl
{
public FavoriteServerListView()
{
InitializeComponent();
}
}