1 Commits
5 changed files with 21 additions and 3 deletions
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
Binary file not shown.
+2 -2
View File
@@ -52,8 +52,8 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<ComboBox x:Name="LangCombo" VerticalAlignment="Center" Width="80" SelectionChanged="LangCombo_SelectionChanged" Margin="10,0,0,0">
<ComboBoxItem Tag="en">EN</ComboBoxItem>
<ComboBoxItem Tag="cs" IsSelected="True">CZ</ComboBoxItem>
<ComboBoxItem Tag="en" IsSelected="True">EN</ComboBoxItem>
<ComboBoxItem Tag="cs">CZ</ComboBoxItem>
</ComboBox>
</StackPanel>
</DockPanel>
+8 -1
View File
@@ -100,7 +100,7 @@ namespace NetworkDiagram
private void AddDeviceToCanvas(DeviceTemplate template, double x, double y)
{
var placed = new PlacedDevice { Name = template.Name, IconPath = template.IconPath, X = x, Y = y };
var placed = new PlacedDevice { Name = template.Name, TemplateName = template.Name, IconPath = template.IconPath, X = x, Y = y };
_currentDiagram.Devices.Add(placed);
RenderDevice(placed);
}
@@ -445,6 +445,13 @@ namespace NetworkDiagram
var model = JsonSerializer.Deserialize<DiagramSaveModel>(json);
if (model == null) return;
_currentDiagram = new Diagram { Devices = model.Devices };
foreach (var device in _currentDiagram.Devices)
{
var template = _deviceTemplates.FirstOrDefault(t => t.Name == device.TemplateName);
if (template != null) device.IconPath = template.IconPath;
}
DiagramCanvas.Children.Clear();
_connectionLines.Clear();
_deviceElements.Clear();
+4
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text.Json.Serialization;
namespace NetworkDiagram.Models
{
@@ -30,6 +31,9 @@ namespace NetworkDiagram.Models
set { _name = value; OnPropertyChanged(); }
}
public string TemplateName { get; set; } = string.Empty;
[JsonIgnore]
public string IconPath { get; set; } = string.Empty;
public double X