소스 검색

refactor: add right

klmnvan 5 달 전
부모
커밋
f98c57ec20
2개의 변경된 파일28개의 추가작업 그리고 37개의 파일을 삭제
  1. 14 14
      HelloItQuantum/ViewModels/LabyrinthViewModel.cs
  2. 14 23
      HelloItQuantum/Views/LabyrinthView.axaml

+ 14 - 14
HelloItQuantum/ViewModels/LabyrinthViewModel.cs

@@ -6,25 +6,25 @@ using ReactiveUI;
 
 namespace HelloItQuantum.ViewModels
 {
-	public class LabyrinthViewModel : ReactiveObject
-	{
-        public ObservableCollection<MyItem> MyItems { get; } = new ObservableCollection<MyItem>();
+    public class LabyrinthViewModel : ReactiveObject
+    {
+        private List<NameComand> listCommandForRobots = new List<NameComand>();
 
-        public ICommand AddRowCommand { get; }
+        public List<NameComand> ListCommandForRobots { get => listCommandForRobots; set => listCommandForRobots = value; }
 
-        public LabyrinthViewModel()
-        {
-            AddRowCommand = ReactiveCommand.Create(AddRow);
-        }
+        public void addRight() {
+            ListCommandForRobots.Add(new NameComand { name = "go right" });
 
-        private void AddRow()
-        {
-            MyItems.Add(new MyItem { MyProperty = $"Ñòðîêà {MyItems.Count + 1}" });
         }
 
+        
+
+
     }
-    public class MyItem
-    {
-        public string MyProperty { get; set; }
+
+    public class NameComand {
+        public string name { get; set; }
+
     }
+
 }

+ 14 - 23
HelloItQuantum/Views/LabyrinthView.axaml

@@ -38,29 +38,20 @@
 
 			<!--Область "кода"-->
 			<Panel Grid.Column="0" Grid.Row="0" >
-				<Border  Background="#F26527" CornerRadius="15"
-					Margin="20,25,20,30">
 					<ScrollViewer>
-
-						<StackPanel Margin="10">
-							<Button Content="Добавить" FontSize="20" Command="{Binding LabyrinthVM.AddRowCommand}"/>
-
-							<ItemsControl >
-								<ItemsControl.ItemTemplate>
-									<DataTemplate>
-										<StackPanel Orientation="Horizontal" Margin="5">
-											<TextBlock FontSize="10" Margin="5"/>
-											<!-- Другие элементы шаблона строки -->
-										</StackPanel>
-									</DataTemplate>
-								</ItemsControl.ItemTemplate>
-							</ItemsControl>
-						</StackPanel>
-						
-						
-						
+						<ListBox ItemsSource="{Binding LabyrinthVM.ListCommandForRobots}" Background="#F26527" CornerRadius="15"
+					Margin="20,25,20,30">
+							<ListBox.ItemTemplate>
+								<DataTemplate >
+									<StackPanel>
+										<Border CornerRadius="15">
+											<TextBlock Foreground="Black" Text="{Binding }"></TextBlock>
+										</Border>
+									</StackPanel>
+								</DataTemplate>
+							</ListBox.ItemTemplate>
+						</ListBox>
 					</ScrollViewer>
-				</Border>
 			</Panel>
 			<!--Область кнопок-->
 			<Panel Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top" Height="450">
@@ -69,7 +60,7 @@
 					Margin="0,25,0,30">
 					<StackPanel Orientation="Vertical" >
 						<StackPanel Orientation="Horizontal" VerticalAlignment="Top" >
-							<Button Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
+							<Button  Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_left.png"/>
 							</Button>
 							<Button  Width="150" FontSize="24" Background="#F26527">go left</Button>
@@ -78,7 +69,7 @@
 							<Button Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">
 								<Image Source="/Assets/ImgLabyrinth/img_right.png"/>
 							</Button>
-							<Button Width="150" FontSize="24" Background="#F26527">go right</Button>
+							<Button Command="{Binding LabyrinthVM.addRight}" Width="150" FontSize="24" Background="#F26527">go right</Button>
 						</StackPanel>
 						<StackPanel Margin="0,10,0,0" Orientation="Horizontal" VerticalAlignment="Top" >
 							<Button Width="40" CornerRadius="10000" Padding="1" Margin="0,0,5,0">