- tweak: Search think

This commit is contained in:
2024-12-27 08:22:17 +03:00
parent 516801840c
commit ba687e51d6
19 changed files with 372 additions and 245 deletions

View File

@@ -97,7 +97,44 @@
CornerRadius="10"
Height="320"
Width="520">
<popup:MessagePopupView />
<Grid RowDefinitions="35,*,20">
<Border
BorderThickness="0,0,0,2"
CornerRadius="10,10,0,0"
Grid.Row="0">
<Panel Margin="12,0,0,0" VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center">
<Label VerticalAlignment="Center" Content="{Binding CurrentTitle}"/>
</StackPanel>
<Button
Content="X"
Margin="0"
CornerRadius="0,10,0,0"
HorizontalAlignment="Right"
Padding="10,8,10,8"
VerticalAlignment="Stretch"
Command="{Binding ClosePopupCommand}"/>
</Panel>
</Border>
<TransitioningContentControl Content="{Binding CurrentPopup}" Grid.Row="1" />
<Border
BorderThickness="0,2,0,2"
CornerRadius="0,0,10,10"
Grid.Row="2">
<Panel Margin="12,0,12,0" VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center">
<Label
FontSize="8"
Foreground="#666666"
VerticalAlignment="Center">
Дальше бога нет...
</Label>
</StackPanel>
</Panel>
</Border>
</Grid>
</Border>
</Panel>
</Panel>

View File

@@ -1,8 +1,8 @@
<Window
Height="400"
Height="500"
Icon="/Assets/avalonia-logo.ico"
MinHeight="400"
MinWidth="600"
MinHeight="500"
MinWidth="800"
Title="Nebula.Launcher"
Width="800"
d:DesignHeight="450"

View File

@@ -12,34 +12,43 @@
<Design.DataContext>
<viewModels:AccountInfoViewModel />
</Design.DataContext>
<Grid ColumnDefinitions="*,1.5*" RowDefinitions="*">
<Grid ColumnDefinitions="*,1.5*" RowDefinitions="*" Margin="15">
<StackPanel Grid.Column="0" Grid.Row="0">
<Border
CornerRadius="10"
Margin="5"
Padding="15">
<StackPanel HorizontalAlignment="Center">
<StackPanel HorizontalAlignment="Center" Spacing="15">
<Image
Height="100"
Margin="0,0,0,20"
Source="/Assets/account.png" />
<Grid ColumnDefinitions="120, 100" RowDefinitions="Auto, Auto, Auto">
<Label Grid.Column="0" Grid.Row="0">Login:</Label>
<Grid ColumnDefinitions="100, 100" RowDefinitions="Auto, Auto, Auto, Auto" VerticalAlignment="Center">
<Label Grid.Column="0" Grid.Row="0" VerticalAlignment="Center">Login:</Label>
<TextBox
Grid.Column="1"
Grid.Row="0"
Text="{Binding CurrentLogin}"/>
<Label Grid.Column="0" Grid.Row="1">Password:</Label>
<Label Grid.Column="0" Grid.Row="1" VerticalAlignment="Center">Password:</Label>
<TextBox
Grid.Column="1"
Grid.Row="1"
PasswordChar="#"
Text="{Binding CurrentPassword}" />
<Label Grid.Column="0" Grid.Row="2">Auth server:</Label>
<Label Grid.Column="0" Grid.Row="2" VerticalAlignment="Center">Auth server:</Label>
<TextBox
Grid.Column="1"
Grid.Row="2"
Text="{Binding CurrentAuthServer}"/>
<ScrollViewer Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Height="80">
<ListBox Margin="15" Background="#00000000" ItemsSource="{Binding AuthUrls}" SelectedItem="{Binding AuthItemSelect}">
<ListBox.ItemTemplate>
<DataTemplate>
<Label><TextBlock Text="{Binding}"/></Label>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
</Grid>
<StackPanel
HorizontalAlignment="Center"

View File

@@ -147,7 +147,7 @@
<TextBox
Margin="0"
VerticalAlignment="Center"
Watermark="Server name..." />
Watermark="Server name..." Text="{Binding SearchText}" TextChanged="TextBox_OnTextChanged"/>
<Button Grid.Column="1" Padding="10">
<Image Source="/Assets/filter.png" />
</Button>

View File

@@ -17,4 +17,10 @@ public partial class ServerListView : UserControl
{
DataContext = viewModel;
}
private void TextBox_OnTextChanged(object? sender, TextChangedEventArgs e)
{
var context = (ServerListViewModel?)DataContext;
context?.OnSearchChange?.Invoke();
}
}

View File

@@ -1,53 +0,0 @@
<UserControl
d:DesignHeight="320"
d:DesignWidth="520"
mc:Ignorable="d"
x:Class="Nebula.Launcher.Views.Popup.MessagePopupView"
x:DataType="viewModels:MessagePopupViewModel"
xmlns="https://github.com/avaloniaui"
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:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.DataContext>
<viewModels:MessagePopupViewModel />
</Design.DataContext>
<Grid RowDefinitions="35,*,20">
<Border
BorderThickness="0,0,0,2"
CornerRadius="10,10,0,0"
Grid.Row="0">
<Panel Margin="12,0,12,0" VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center">
<Label VerticalAlignment="Center">Title</Label>
</StackPanel>
<Button
Content="Close"
HorizontalAlignment="Right"
Padding="15,0,15,0"
VerticalAlignment="Center"
x:Name="CloseButton" />
</Panel>
</Border>
<TransitioningContentControl Content="{Binding CurrentPopup}" Grid.Row="0" />
<Border
BorderThickness="0,2,0,2"
CornerRadius="0,0,10,10"
Grid.Row="2">
<Panel Margin="12,0,12,0" VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center">
<Label
FontSize="8"
Foreground="#666666"
VerticalAlignment="Center">
Дальше бога нет...
</Label>
</StackPanel>
</Panel>
</Border>
</Grid>
</UserControl>

View File

@@ -1,26 +0,0 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Nebula.Launcher.ViewModels;
namespace Nebula.Launcher.Views.Popup;
public partial class MessagePopupView : UserControl
{
// This constructor is used when the view is created by the XAML Previewer
public MessagePopupView()
{
InitializeComponent();
}
// This constructor is used when the view is created via dependency injection
public MessagePopupView(MessagePopupViewModel viewModel)
: this()
{
DataContext = viewModel;
Console.WriteLine("NO SOSAL");
CloseButton.KeyDown += (_,_) => Console.WriteLine("GGG11");
CloseButton.Click += (_,_) => Console.WriteLine("GGG");
}
}