Dodano board i wyświetlanie obrazu w gridzie
This commit is contained in:
parent
58ba4a5b1c
commit
c165a3f07a
@ -56,6 +56,7 @@
|
|||||||
<Compile Include="Interfaces\TrashCans\ATrashCan.cs" />
|
<Compile Include="Interfaces\TrashCans\ATrashCan.cs" />
|
||||||
<Compile Include="Interfaces\TrashCans\IStep.cs" />
|
<Compile Include="Interfaces\TrashCans\IStep.cs" />
|
||||||
<Compile Include="Models\Coords.cs" />
|
<Compile Include="Models\Coords.cs" />
|
||||||
|
<Compile Include="Models\Map.cs" />
|
||||||
<Compile Include="Models\Steps\CollectStep.cs" />
|
<Compile Include="Models\Steps\CollectStep.cs" />
|
||||||
<Compile Include="Models\Steps\MoveStep.cs" />
|
<Compile Include="Models\Steps\MoveStep.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
24
Trunk/Components/CzokoŚmieciarka.DataModels/Models/Map.cs
Normal file
24
Trunk/Components/CzokoŚmieciarka.DataModels/Models/Map.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using CzokoŚmieciarka.DataModels.Interfaces;
|
||||||
|
|
||||||
|
namespace CzokoŚmieciarka.DataModels.Models
|
||||||
|
{
|
||||||
|
public class Map
|
||||||
|
{
|
||||||
|
public Map(Rectangle mapRectangle, IEnumerable<IGarbageLocalization> garbageLocalizations = null)
|
||||||
|
{
|
||||||
|
this.MapRectangle = mapRectangle;
|
||||||
|
this.GarbageLocalizations = garbageLocalizations;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle MapRectangle { get; }
|
||||||
|
|
||||||
|
IEnumerable<IGarbageLocalization> GarbageLocalizations { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{AFCA9593-EF6B-4860-95F5-4F56F2AF221B}</ProjectGuid>
|
<ProjectGuid>{06937DFB-242D-46BD-9A4B-486D156B62A9}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>CzokoŚmieciarka.WPF</RootNamespace>
|
<RootNamespace>CzokoŚmieciarka.WPF</RootNamespace>
|
||||||
<AssemblyName>CzokoŚmieciarka.WPF</AssemblyName>
|
<AssemblyName>CzokoŚmieciarka.WPF</AssemblyName>
|
||||||
@ -37,7 +37,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@ -71,6 +70,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Models\Board.cs" />
|
<Compile Include="Models\Board.cs" />
|
||||||
|
<Compile Include="Models\Tile.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -96,16 +96,5 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj">
|
|
||||||
<Project>{f2e11fee-c5ac-47d2-ba9c-819909b6dff7}</Project>
|
|
||||||
<Name>CzokoŚmieciarka.DataModels</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Resource Include="Images\dirt.jpg">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Resource>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 27 KiB |
@ -6,8 +6,8 @@
|
|||||||
xmlns:local="clr-namespace:CzokoŚmieciarka.WPF"
|
xmlns:local="clr-namespace:CzokoŚmieciarka.WPF"
|
||||||
xmlns:models="clr-namespace:CzokoŚmieciarka.WPF.Models"
|
xmlns:models="clr-namespace:CzokoŚmieciarka.WPF.Models"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainWindow" Height="450" Width="800">
|
Title="MainWindow" Height="800" Width="800">
|
||||||
<ItemsControl ItemsSource="{Binding Tiles}" BorderBrush="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}">
|
<ItemsControl ItemsSource="{Binding Tiles}">
|
||||||
<ItemsControl.Resources>
|
<ItemsControl.Resources>
|
||||||
<DataTemplate DataType="{x:Type models:Tile}">
|
<DataTemplate DataType="{x:Type models:Tile}">
|
||||||
<Grid Background="{Binding Background}">
|
<Grid Background="{Binding Background}">
|
||||||
@ -17,7 +17,7 @@
|
|||||||
</ItemsControl.Resources>
|
</ItemsControl.Resources>
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<UniformGrid Rows="{Binding Rows}" Columns="{Binding Columns}" Margin="10" Background="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"/>
|
<UniformGrid Rows="{Binding Rows}" Columns="{Binding Columns}"></UniformGrid>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ItemsControl.ItemsPanel>
|
</ItemsControl.ItemsPanel>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@ -27,5 +28,6 @@ namespace CzokoŚmieciarka.WPF
|
|||||||
|
|
||||||
this.DataContext = new Board(10, 10);
|
this.DataContext = new Board(10, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using CzokoŚmieciarka.DataModels.Interfaces;
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace CzokoŚmieciarka.WPF.Models
|
namespace CzokoŚmieciarka.WPF.Models
|
||||||
{
|
{
|
||||||
@ -21,17 +18,15 @@ namespace CzokoŚmieciarka.WPF.Models
|
|||||||
{
|
{
|
||||||
_rows = rows;
|
_rows = rows;
|
||||||
_columns = columns;
|
_columns = columns;
|
||||||
|
ImageBrush imgBrush = new ImageBrush(new BitmapImage(new Uri(@"F:\Projects\In-progress\CzokoSmieciarka\Trunk\CzokoŚmieciarka.WPF\Images\dirt.jpg")));
|
||||||
for (int r = 0; r < rows; r++)
|
for (int r = 0; r < rows; r++)
|
||||||
{
|
{
|
||||||
for (int c = 0; c < columns; c++)
|
for (int c = 0; c < columns; c++)
|
||||||
{
|
{
|
||||||
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Images\dirt.jpg");
|
|
||||||
var Bitmap = new Bitmap(path);
|
|
||||||
_tiles.Add(new Tile()
|
_tiles.Add(new Tile()
|
||||||
{
|
{
|
||||||
Data = string.Format("Tile {0}", r*10+c),
|
Data = string.Format("Dirt {0}", r * 10 + c),
|
||||||
Img = Bitmap
|
Background = imgBrush
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,10 +50,4 @@ namespace CzokoŚmieciarka.WPF.Models
|
|||||||
set { _tiles = value; }
|
set { _tiles = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Tile
|
|
||||||
{
|
|
||||||
public string Data { get; set; }
|
|
||||||
public Bitmap Img { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
15
Trunk/CzokoŚmieciarka.WPF/Models/Tile.cs
Normal file
15
Trunk/CzokoŚmieciarka.WPF/Models/Tile.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace CzokoŚmieciarka.WPF.Models
|
||||||
|
{
|
||||||
|
public class Tile
|
||||||
|
{
|
||||||
|
public string Data { get; set; }
|
||||||
|
public ImageBrush Background { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@ VisualStudioVersion = 15.0.28307.136
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.DataModels", "Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj", "{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.DataModels", "Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj", "{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.WPF", "CzokoŚmieciarka.WPF\CzokoŚmieciarka.WPF.csproj", "{AFCA9593-EF6B-4860-95F5-4F56F2AF221B}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.WPF", "CzokoŚmieciarka.WPF\CzokoŚmieciarka.WPF.csproj", "{06937DFB-242D-46BD-9A4B-486D156B62A9}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -17,10 +17,10 @@ Global
|
|||||||
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{AFCA9593-EF6B-4860-95F5-4F56F2AF221B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{06937DFB-242D-46BD-9A4B-486D156B62A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{AFCA9593-EF6B-4860-95F5-4F56F2AF221B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{06937DFB-242D-46BD-9A4B-486D156B62A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{AFCA9593-EF6B-4860-95F5-4F56F2AF221B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{06937DFB-242D-46BD-9A4B-486D156B62A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{AFCA9593-EF6B-4860-95F5-4F56F2AF221B}.Release|Any CPU.Build.0 = Release|Any CPU
|
{06937DFB-242D-46BD-9A4B-486D156B62A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
Loading…
Reference in New Issue
Block a user