2 Commits 1222f1a5e8 ... e31a9c71a8

Author SHA1 Message Date
  Otter e31a9c71a8 style: style improvement 4 months ago
  Otter e27f77605f feat: add delete item list 4 months ago

+ 3 - 0
HelloItQuantum/Assets/ImgCreateFriend/delete.svg

@@ -0,0 +1,3 @@
+<svg width="16" height="15" viewBox="0 0 16 15" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M9.43246 7.50891L15.1771 1.97818C15.5749 1.59513 15.5869 0.962084 15.2039 0.564223C14.8208 0.166362 14.1878 0.154354 13.7899 0.537401L8.02681 6.08595L2.47826 0.322826C2.09521 -0.0750349 1.46216 -0.0870434 1.0643 0.296004C0.666438 0.679052 0.65443 1.3121 1.03748 1.70996L6.60378 7.49153L0.938362 13.1569C0.547838 13.5475 0.547838 14.1806 0.938362 14.5712C1.32889 14.9617 1.96205 14.9617 2.35258 14.5712L8.00943 8.9143L13.6663 14.5712C14.0568 14.9617 14.69 14.9617 15.0805 14.5712C15.471 14.1806 15.471 13.5475 15.0805 13.1569L9.43246 7.50891Z" fill="white"/>
+</svg>

+ 1 - 0
HelloItQuantum/HelloItQuantum.csproj

@@ -54,6 +54,7 @@
     <None Remove="Assets\icon_labyrinth.png" />
     <None Remove="Assets\icon_labyrinth.svg" />
     <None Remove="Assets\ImgCreateFriend\body.svg" />
+    <None Remove="Assets\ImgCreateFriend\delete.svg" />
     <None Remove="Assets\ImgCreateFriend\eye.svg" />
     <None Remove="Assets\ImgCreateFriend\foot1.svg" />
     <None Remove="Assets\ImgCreateFriend\foot2.svg" />

+ 5 - 0
HelloItQuantum/Models/FriendElement.cs

@@ -65,5 +65,10 @@ namespace HelloItQuantum.Models
 			get => isVisibleNavigateTwo;
 			set => SetProperty(ref isVisibleNavigateTwo, value);
 		}
+
+		public void Delete()
+		{
+			GameCreateFriendVM.Delete(Id);
+		}
 	}
 }

+ 11 - 0
HelloItQuantum/ViewModels/GameCreateFriendViewModel.cs

@@ -1,6 +1,7 @@
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Drawing.Printing;
+using System.Xml.Linq;
 using Avalonia;
 using Avalonia.Controls;
 using Avalonia.Controls.Shapes;
@@ -83,6 +84,16 @@ namespace HelloItQuantum.ViewModels
 			}
 		}
 
+		public void Delete(int id)
+		{
+			pChildrens.Children.RemoveAt(id);
+			ListElements.RemoveAt(id);
+			for (int i = 0; i < ListElements.Count; i++)
+			{
+				ListElements[i].Id = i;
+			}
+		}
+
 		public void UpdateDrawing(int id)
 		{
 			Color color = keyValueColor[ListElements[id].SelectedColorIndex];

+ 55 - 34
HelloItQuantum/Views/GameCreateFriendView.axaml

@@ -2,7 +2,7 @@
              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"
-             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+             mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
              x:Class="HelloItQuantum.Views.GameCreateFriendView"
 			 x:DataType="vm:MainWindowViewModel"
 			 xmlns:vm="using:HelloItQuantum.ViewModels">
@@ -18,51 +18,71 @@
 			<Setter Property="CornerRadius" Value="10"/>
 			<Setter Property="HorizontalContentAlignment" Value="Center"/>
 		</Style>
+		
+		<Style Selector="ComboBox">
+			<Setter Property="Background" Value="#E6EFD8"/>
+			<Setter Property="CornerRadius" Value="10"/>
+			<Setter Property="VerticalAlignment" Value="Center"/>
+			<Setter Property="BorderBrush" Value="Transparent"/>
+		</Style>
 	</UserControl.Styles>
 
-	<ScrollViewer>	
-		<StackPanel Background="#006838">		
-			<Grid ColumnDefinitions="auto, auto" RowDefinitions="*, auto" Margin="20" HorizontalAlignment="Center">
+		<Panel Background="#006838">
+			<Grid ColumnDefinitions="auto, auto" RowDefinitions="*, auto" Margin="5 20" HorizontalAlignment="Center">
 
-				<Grid Grid.Column="0" Grid.Row="0" ColumnDefinitions="200, 20, 140, 20, 300, 30" RowDefinitions="auto, 20, *">
+				<Grid Grid.Column="0" Grid.Row="0" ColumnDefinitions="60, 200, 20, 140, 20, 300, 40" RowDefinitions="auto, 10, *">
 
-					<Border Grid.Column="0"  Grid.Row="0" CornerRadius="10" Background="#E6EFD8">
+					<Border Grid.Column="1"  Grid.Row="0" CornerRadius="10" Background="#E6EFD8">
 						<TextBlock Text="Фигура" VerticalAlignment="Stretch" Margin="10" TextAlignment="Center"/>
 					</Border>
 
-					<Border Grid.Column="2" Grid.Row="0" CornerRadius="10" Background="#E6EFD8">
+					<Border Grid.Column="3" Grid.Row="0" CornerRadius="10" Background="#E6EFD8">
 						<TextBlock Text="Цвет" VerticalAlignment="Stretch" Margin="10" TextAlignment="Center"/>
 					</Border>
 
-					<Border Grid.Column="4" Grid.Row="0" CornerRadius="10" Background="#E6EFD8">
+					<Border Grid.Column="5" Grid.Row="0" CornerRadius="10" Background="#E6EFD8">
 						<TextBlock Text="Положение" VerticalAlignment="Stretch" Margin="10" TextAlignment="Center"/>
 					</Border>
-
-					<StackPanel Grid.ColumnSpan="5" Grid.Row="2">
-						<ListBox ItemsSource="{Binding GameCreateFriendVM.ListElements}">
-							<ListBox.ItemTemplate>
-								<DataTemplate>
-									<StackPanel Orientation="Horizontal">
-										<ComboBox ItemsSource="{Binding CbElement}" SelectedIndex="{Binding SelectedElementIndex}"
-												  Width="180" Height="130" Margin="0 0 40 0"/>
-										<ComboBox ItemsSource="{Binding CbColor}" SelectedIndex="{Binding SelectedColorIndex}"
-												  Width="120" Height="130" Margin="0 0 40 0"/>
-										<ComboBox ItemsSource="{Binding CbNavigateOne}" SelectedIndex="{Binding SelectedNavigateOne}" IsVisible="{Binding IsVisibleNavigateOne}"
-												  Width="100" Height="80" Margin="0 0 10 0"/>
-										<ComboBox ItemsSource="{Binding CbNavigateTwo}" SelectedIndex="{Binding SelectedNavigateTwo}" IsVisible="{Binding IsVisibleNavigateTwo}"
-												  Width="100" Height="80"/>
-									</StackPanel>
-								</DataTemplate>
-							</ListBox.ItemTemplate>
-						</ListBox>
-						<Button Content="+" Command="{Binding GameCreateFriendVM.ClickCreateElement}"
-								Background="#E6EFD8" Width="200"/>
-					</StackPanel>
-
+					
+					<ScrollViewer Grid.ColumnSpan="7" Grid.Row="2" VerticalAlignment="Top" Margin="0 0 20 0">
+						<Grid RowDefinitions="auto, auto">
+							
+							<ItemsControl Grid.Row="0" ItemsSource="{Binding GameCreateFriendVM.ListElements}">
+								<ItemsControl.ItemTemplate>
+									<DataTemplate>
+										<Grid ColumnDefinitions="40, 20, *, 20" Margin="0 10">
+											<Button Grid.Column="0" Background="#F26527" Width="40" Command="{Binding Delete}" VerticalAlignment="Stretch">
+												<Svg Path="/Assets/ImgCreateFriend/delete.svg" Width="20"/>
+											</Button>
+											<Border Grid.Column="2" CornerRadius="10"
+													Background="#7CBE41"
+													HorizontalAlignment="Stretch"
+													Padding="10">
+												<StackPanel Orientation="Horizontal">
+													<ComboBox ItemsSource="{Binding CbElement}" SelectedIndex="{Binding SelectedElementIndex}"
+															  Width="180" Height="125" Margin="0 0 40 0"/>
+													<ComboBox ItemsSource="{Binding CbColor}" SelectedIndex="{Binding SelectedColorIndex}"
+															  Width="120" Height="125" Margin="0 0 40 0"/>
+													<ComboBox ItemsSource="{Binding CbNavigateOne}" SelectedIndex="{Binding SelectedNavigateOne}" IsVisible="{Binding IsVisibleNavigateOne}"
+															  Width="130" Height="125" Margin="0 0 10 0"/>
+													<ComboBox ItemsSource="{Binding CbNavigateTwo}" SelectedIndex="{Binding SelectedNavigateTwo}" IsVisible="{Binding IsVisibleNavigateTwo}"
+															  Width="130" Height="125"/>
+												</StackPanel>
+											</Border>
+										</Grid>
+									</DataTemplate>
+								</ItemsControl.ItemTemplate>
+							</ItemsControl>
+	
+							<Button Grid.Row="1" Content="+" Command="{Binding GameCreateFriendVM.ClickCreateElement}"
+									Background="#E6EFD8" Margin="60 0 20 0" HorizontalAlignment="Stretch"/>
+						</Grid>
+					</ScrollViewer>
+					
 				</Grid>
 
-				<Panel Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Width="400">
-					<Image Source="/Assets/ImgCreateFriend/img_friend.png" Width="400"/>			
+				<Panel Grid.Column="1" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="400">
+					<Image Source="/Assets/ImgCreateFriend/img_friend.png" Width="400"/>
 					<Image Source="/Assets/ImgCreateFriend/hello.png" Width="150" Margin="0 0 140 -100"
 						   IsVisible="{Binding GameCreateFriendVM.IsVisibleHello}"/>
 					<ContentControl Width="140" Height="180" HorizontalAlignment="Right" VerticalAlignment="Bottom"
@@ -76,6 +96,7 @@
 						Margin="0 30"
 						Background="{Binding GameCreateFriendVM.BtnColor}"/>
 			</Grid>
-		</StackPanel>
-	</ScrollViewer>
+		</Panel>
+
+	
 </UserControl>

+ 2 - 2
HelloItQuantum/Views/MainWindow.axaml

@@ -8,8 +8,8 @@
         x:DataType="vm:MainWindowViewModel"
         Icon="/Assets/avalonia-logo.ico"
         Title="HelloItQuantum"
-		MinWidth="900"
-		MinHeight="500">
+		MinWidth="1000"
+		MinHeight="700">
 
     <Design.DataContext>
         <!-- This only sets the DataContext for the previewer in an IDE,