- tweak: Big refactoring of hub and file content overview
This commit is contained in:
52
Nebula.Launcher/Views/FileContentEntryView.axaml
Normal file
52
Nebula.Launcher/Views/FileContentEntryView.axaml
Normal file
@@ -0,0 +1,52 @@
|
||||
<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:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:DataType="pages:FolderContentEntry"
|
||||
x:Class="Nebula.Launcher.Views.FileContentEntryView">
|
||||
<Design.DataContext>
|
||||
<pages:FolderContentEntry/>
|
||||
</Design.DataContext>
|
||||
|
||||
<ScrollViewer
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
Grid.Row="1"
|
||||
Margin="0,0,0,5">
|
||||
<ItemsControl ItemsSource="{Binding Entries}" Padding="0,0,0,0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type pages:IContentEntry}">
|
||||
<Button
|
||||
Command="{Binding GoCurrent}"
|
||||
CornerRadius="0"
|
||||
Height="30"
|
||||
HorizontalAlignment="Stretch">
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="15">
|
||||
<Border
|
||||
Background="#00000000"
|
||||
BorderThickness="0,0,2,0"
|
||||
CornerRadius="0">
|
||||
<Svg
|
||||
Height="15"
|
||||
Margin="10,0,10,0"
|
||||
Path="{Binding IconPath}" />
|
||||
<Border.BorderBrush>
|
||||
<LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
|
||||
<GradientStop Color="#442222" Offset="0.0" />
|
||||
<GradientStop Color="#222222" Offset="1.0" />
|
||||
</LinearGradientBrush>
|
||||
</Border.BorderBrush>
|
||||
</Border>
|
||||
<Label>
|
||||
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
|
||||
</Label>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
22
Nebula.Launcher/Views/FileContentEntryView.axaml.cs
Normal file
22
Nebula.Launcher/Views/FileContentEntryView.axaml.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Nebula.Launcher.ViewModels.Pages;
|
||||
|
||||
namespace Nebula.Launcher.Views;
|
||||
|
||||
public partial class FileContentEntryView : UserControl
|
||||
{
|
||||
// This constructor is used when the view is created by the XAML Previewer
|
||||
public FileContentEntryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
// This constructor is used when the view is created via dependency injection
|
||||
public FileContentEntryView(FolderContentEntry viewModel)
|
||||
: this()
|
||||
{
|
||||
DataContext = viewModel;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,8 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:models="clr-namespace:Nebula.Shared.Models;assembly=Nebula.Shared"
|
||||
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:models1="clr-namespace:Nebula.Launcher.Models">
|
||||
<Design.DataContext>
|
||||
<viewModels:MainViewModel />
|
||||
</Design.DataContext>
|
||||
@@ -63,7 +64,7 @@
|
||||
Padding="0"
|
||||
SelectedItem="{Binding SelectedListItem}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type models:ListItemTemplate}">
|
||||
<DataTemplate DataType="{x:Type models1:ListItemTemplate}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="19">
|
||||
<Svg
|
||||
Height="40"
|
||||
|
||||
@@ -61,44 +61,11 @@
|
||||
<Svg Path="/Assets/svg/next.svg" />
|
||||
</Button>
|
||||
|
||||
<ScrollViewer
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
Grid.Row="1"
|
||||
Margin="0,0,0,5">
|
||||
<ItemsControl ItemsSource="{Binding Entries}" Padding="0,0,0,0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type pages:ContentEntry}">
|
||||
<Button
|
||||
Command="{Binding OnPathGo}"
|
||||
CornerRadius="0"
|
||||
Height="30"
|
||||
HorizontalAlignment="Stretch">
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="15">
|
||||
<Border
|
||||
Background="#00000000"
|
||||
BorderThickness="0,0,2,0"
|
||||
CornerRadius="0">
|
||||
<Svg
|
||||
Height="15"
|
||||
Margin="10,0,10,0"
|
||||
Path="{Binding IconPath}" />
|
||||
<Border.BorderBrush>
|
||||
<LinearGradientBrush EndPoint="100%,50%" StartPoint="0%,50%">
|
||||
<GradientStop Color="#442222" Offset="0.0" />
|
||||
<GradientStop Color="#222222" Offset="1.0" />
|
||||
</LinearGradientBrush>
|
||||
</Border.BorderBrush>
|
||||
</Border>
|
||||
<Label>
|
||||
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
|
||||
</Label>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<ScrollViewer Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
Grid.Row="1" Content="{Binding CurrentEntry}">
|
||||
|
||||
</ScrollViewer>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -2,41 +2,50 @@
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d"
|
||||
x:Class="Nebula.Launcher.Views.Pages.ServerListView"
|
||||
x:DataType="pages:ServerListViewModel"
|
||||
x:Class="Nebula.Launcher.Views.Pages.ServerOverviewView"
|
||||
x:DataType="pages:ServerOverviewModel"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Nebula.Launcher.Controls">
|
||||
xmlns:controls="clr-namespace:Nebula.Launcher.Controls"
|
||||
xmlns:models="clr-namespace:Nebula.Launcher.Models">
|
||||
|
||||
<Design.DataContext>
|
||||
<pages:ServerListViewModel />
|
||||
<pages:ServerOverviewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<Grid
|
||||
ColumnDefinitions="*"
|
||||
Margin="0"
|
||||
RowDefinitions="*,40">
|
||||
<ScrollViewer
|
||||
Grid.RowSpan="2"
|
||||
Margin="5,0,0,10"
|
||||
Padding="0,0,10,0">
|
||||
<StackPanel Margin="0,0,0,30">
|
||||
<ItemsControl ItemsSource="{Binding HubErrors}" Margin="10,0,10,0" />
|
||||
<ItemsControl
|
||||
IsVisible="{Binding IsFavoriteMode}"
|
||||
ItemsSource="{Binding FavoriteServers}"
|
||||
Padding="0" />
|
||||
<ItemsControl
|
||||
IsVisible="{Binding !IsFavoriteMode}"
|
||||
ItemsSource="{Binding Servers}"
|
||||
Padding="0" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
RowDefinitions="40,*,40">
|
||||
|
||||
<Border Grid.Row="0"
|
||||
<ListBox
|
||||
Background="Transparent"
|
||||
ItemsSource="{Binding Items}"
|
||||
Padding="0"
|
||||
SelectedItem="{Binding SelectedItem}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type models:ServerListTabTemplate}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="19">
|
||||
<TextBlock Text="{Binding TabName}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<Border
|
||||
Child="{Binding CurrentServerList}"
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="2" />
|
||||
|
||||
<Border Grid.Row="1"
|
||||
Background="{StaticResource DefaultGrad}"
|
||||
Margin="0,0,0,0" CornerRadius="20,20,0,0"
|
||||
VerticalAlignment="Bottom"
|
||||
@@ -51,11 +60,11 @@
|
||||
Background="{StaticResource DefaultGrad}"
|
||||
BoxShadow="0 2 25 0 #121212"
|
||||
CornerRadius="0"
|
||||
Grid.Row="1" />
|
||||
Grid.Row="2" />
|
||||
|
||||
<Grid
|
||||
ColumnDefinitions="*,40,40,40"
|
||||
Grid.Row="1"
|
||||
Grid.Row="2"
|
||||
Margin="-25,0,0,0"
|
||||
RowDefinitions="*">
|
||||
<TextBox
|
||||
@@ -64,12 +73,6 @@
|
||||
TextChanged="TextBox_OnTextChanged"
|
||||
VerticalAlignment="Center"
|
||||
Watermark="Server name..." />
|
||||
<Button
|
||||
Command="{Binding AddFavoriteRequired}"
|
||||
Grid.Column="1"
|
||||
Padding="10">
|
||||
<Svg IsVisible="{Binding IsFavoriteMode}" Path="/Assets/svg/star.svg" />
|
||||
</Button>
|
||||
<Button
|
||||
Command="{Binding FilterRequired}"
|
||||
Grid.Column="2"
|
||||
@@ -1,12 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
using ServerListViewModel = Nebula.Launcher.ViewModels.Pages.ServerListViewModel;
|
||||
using Nebula.Launcher.ViewModels.Pages;
|
||||
|
||||
namespace Nebula.Launcher.Views.Pages;
|
||||
|
||||
public partial class ServerListView : UserControl
|
||||
public partial class ServerOverviewView : UserControl
|
||||
{
|
||||
// This constructor is used when the view is created by the XAML Previewer
|
||||
public ServerListView()
|
||||
public ServerOverviewView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -21,7 +21,7 @@ public partial class ServerListView : UserControl
|
||||
}
|
||||
|
||||
// This constructor is used when the view is created via dependency injection
|
||||
public ServerListView(ServerListViewModel viewModel)
|
||||
public ServerOverviewView(ServerOverviewModel viewModel)
|
||||
: this()
|
||||
{
|
||||
DataContext = viewModel;
|
||||
@@ -29,7 +29,7 @@ public partial class ServerListView : UserControl
|
||||
|
||||
private void TextBox_OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
{
|
||||
var context = (ServerListViewModel?)DataContext;
|
||||
var context = (ServerOverviewModel?)DataContext;
|
||||
context?.OnSearchChange?.Invoke();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user