Informacje o pozycji śmieciarki wyświetlane w oknie
This commit is contained in:
parent
3613cad37f
commit
9f8d9fb785
@ -1,2 +1,3 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Czoko_015Amieciarka_002EWPFv2_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Czoko_015Amieciarka_002EWPF_002EAnnotations/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -74,6 +74,7 @@
|
||||
<Compile Include="Models\GarbageCollector.cs" />
|
||||
<Compile Include="Models\House.cs" />
|
||||
<Compile Include="Models\Road.cs" />
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -5,10 +5,11 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:CzokoŚmieciarka.WPFv2"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="800" Width="1000">
|
||||
Title="MainWindow" Height="800" Width="1000"
|
||||
KeyDown="MainWindow_OnKeyDown">
|
||||
<Grid>
|
||||
<Grid Name="Board" Margin="0,0,200,0"/>
|
||||
<Grid Name="CollectorInfo" Margin="800,0,0,0"/>
|
||||
<Grid Name="Board" Margin="0,0,200,0"/>
|
||||
<DataGrid Name="CollectorInfo" Margin="800,0,0,0"/>
|
||||
<Grid Name="CollectorBoard" Margin="0,0,200,0"/>
|
||||
|
||||
</Grid>
|
||||
|
@ -65,25 +65,15 @@ namespace CzokoŚmieciarka.WPFv2
|
||||
|
||||
}
|
||||
|
||||
for(int rows = 0; rows < 3; rows++)
|
||||
{
|
||||
row = new RowDefinition();
|
||||
CollectorInfo.RowDefinitions.Add(row);
|
||||
}
|
||||
|
||||
for (int columns = 0; columns < 2; columns++)
|
||||
{
|
||||
column = new ColumnDefinition();
|
||||
CollectorInfo.ColumnDefinitions.Add(column);
|
||||
}
|
||||
CollectorInfo.ShowGridLines = true;
|
||||
GarbageCollectorContainers = new List<AGarbageCollectorContainer>();
|
||||
garbageCollector = new WPFGarbageCollector(new Coords(2, 1), GarbageCollectorContainers);
|
||||
Grid.SetRow(garbageCollector.Image, garbageCollector.Position.Y);
|
||||
Grid.SetColumn(garbageCollector.Image, garbageCollector.Position.X);
|
||||
CollectorBoard.Children.Add(garbageCollector.Image);
|
||||
CollectorBoard.ShowGridLines = true;
|
||||
|
||||
CollectorInfo.Items.Add(garbageCollector);
|
||||
CollectorInfo.Columns.Add(new DataGridTextColumn {Header="X", Binding = new Binding("Position.X")});
|
||||
CollectorInfo.Columns.Add(new DataGridTextColumn { Header = "Y", Binding = new Binding("Position.Y") });
|
||||
}
|
||||
|
||||
private void MainWindow_OnKeyDown(object sender, KeyEventArgs e)
|
||||
@ -91,9 +81,13 @@ namespace CzokoŚmieciarka.WPFv2
|
||||
|
||||
if (e.Key == Key.Space)
|
||||
{
|
||||
|
||||
garbageCollector.Position = garbageCollector.MoveRight();
|
||||
}
|
||||
|
||||
|
||||
CollectorBoard.Children.Clear();
|
||||
Grid.SetRow(garbageCollector.Image, garbageCollector.Position.Y);
|
||||
Grid.SetColumn(garbageCollector.Image, garbageCollector.Position.X);
|
||||
CollectorBoard.Children.Add(garbageCollector.Image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
@ -9,11 +11,12 @@ using System.Windows.Media.Imaging;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
||||
using CzokoŚmieciarka.DataModels.Models;
|
||||
using CzokoŚmieciarka.WPFv2.Annotations;
|
||||
using CzokoŚmieciarka.WPFv2.Interfaces;
|
||||
|
||||
namespace CzokoŚmieciarka.WPFv2.Models
|
||||
{
|
||||
class WPFGarbageCollector : AGarbageCollector, IWPFObject
|
||||
class WPFGarbageCollector : AGarbageCollector, IWPFObject, INotifyPropertyChanged
|
||||
{
|
||||
public string ImagePath { get; set; }
|
||||
public Image Image { get; set; }
|
||||
@ -27,5 +30,13 @@ namespace CzokoŚmieciarka.WPFv2.Models
|
||||
@"..\..\Images\garbageCollector.png"))
|
||||
};
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1065
Trunk/Interface/CzokoŚmieciarka.WPFv2/Properties/Annotations.cs
Normal file
1065
Trunk/Interface/CzokoŚmieciarka.WPFv2/Properties/Annotations.cs
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user