mirror of
https://github.com/egmont11/NetworkDiagram.git
synced 2026-07-24 07:09:43 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
038eb43f1d |
Generated
+7
@@ -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.
@@ -52,8 +52,8 @@
|
|||||||
|
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<ComboBox x:Name="LangCombo" VerticalAlignment="Center" Width="80" SelectionChanged="LangCombo_SelectionChanged" Margin="10,0,0,0">
|
<ComboBox x:Name="LangCombo" VerticalAlignment="Center" Width="80" SelectionChanged="LangCombo_SelectionChanged" Margin="10,0,0,0">
|
||||||
<ComboBoxItem Tag="en">EN</ComboBoxItem>
|
<ComboBoxItem Tag="en" IsSelected="True">EN</ComboBoxItem>
|
||||||
<ComboBoxItem Tag="cs" IsSelected="True">CZ</ComboBoxItem>
|
<ComboBoxItem Tag="cs">CZ</ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace NetworkDiagram
|
|||||||
|
|
||||||
private void AddDeviceToCanvas(DeviceTemplate template, double x, double y)
|
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);
|
_currentDiagram.Devices.Add(placed);
|
||||||
RenderDevice(placed);
|
RenderDevice(placed);
|
||||||
}
|
}
|
||||||
@@ -445,6 +445,13 @@ namespace NetworkDiagram
|
|||||||
var model = JsonSerializer.Deserialize<DiagramSaveModel>(json);
|
var model = JsonSerializer.Deserialize<DiagramSaveModel>(json);
|
||||||
if (model == null) return;
|
if (model == null) return;
|
||||||
_currentDiagram = new Diagram { Devices = model.Devices };
|
_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();
|
DiagramCanvas.Children.Clear();
|
||||||
_connectionLines.Clear();
|
_connectionLines.Clear();
|
||||||
_deviceElements.Clear();
|
_deviceElements.Clear();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace NetworkDiagram.Models
|
namespace NetworkDiagram.Models
|
||||||
{
|
{
|
||||||
@@ -30,6 +31,9 @@ namespace NetworkDiagram.Models
|
|||||||
set { _name = value; OnPropertyChanged(); }
|
set { _name = value; OnPropertyChanged(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string TemplateName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public string IconPath { get; set; } = string.Empty;
|
public string IconPath { get; set; } = string.Empty;
|
||||||
|
|
||||||
public double X
|
public double X
|
||||||
|
|||||||
Reference in New Issue
Block a user