diff --git a/SuperCom/Entity/CustomSerialPort.cs b/SuperCom/Entity/CustomSerialPort.cs index 7c6ba4b..1b421c5 100644 --- a/SuperCom/Entity/CustomSerialPort.cs +++ b/SuperCom/Entity/CustomSerialPort.cs @@ -45,12 +45,18 @@ public CustomSerialPort(string portName) } public string Remark = ""; + public bool Pinned = false; public void SaveRemark(string remark) { this.Remark = remark; SettingJson = PortSettingToJson(); // 保存 } + public void SavePinned(bool pinned) + { + this.Pinned = pinned; + SettingJson = PortSettingToJson(); // 保存 + } public void SaveProperties() @@ -86,6 +92,7 @@ public string PortSettingToJson() dic.Add("StopBits", this.StopBitsString); dic.Add("Parity", this.ParityString); dic.Add("Remark", this.Remark); + dic.Add("Pinned", this.Pinned); dic.Add("TextFontSize", this.TextFontSize); dic.Add("HighLightIndex", this.HighLightIndex); return JsonUtils.TrySerializeObject(dic); @@ -122,6 +129,8 @@ public void SetPortSettingByJson(string json) this.StopBitsString = dict["StopBits"].ToString(); if (dict.ContainsKey("Remark")) this.Remark = dict["Remark"].ToString(); + if (dict.ContainsKey("Pinned")) + this.Pinned = dict["Pinned"].ToString().ToLower().Equals("true") ? true : false; } } @@ -135,6 +144,17 @@ public static string GetRemark(string json) } return ""; } + public static bool GetPinned(string json) + { + Dictionary dict = JsonUtils.TryDeserializeObject>(json); + string pinned = ""; + if (dict != null) + { + if (dict.ContainsKey("Pinned")) + pinned = dict["Pinned"].ToString(); + } + return pinned.ToLower().Equals("true") ? true : false; + } diff --git a/SuperCom/Entity/PortTabItem.cs b/SuperCom/Entity/PortTabItem.cs index dcba0e4..a0087aa 100644 --- a/SuperCom/Entity/PortTabItem.cs +++ b/SuperCom/Entity/PortTabItem.cs @@ -189,6 +189,13 @@ public ObservableCollection VarMonitors } } + private bool _Pinned; + public bool Pinned + { + get { return _Pinned; } + set { _Pinned = value; RaisePropertyChanged(); } + } + public bool RunningCommands { get; set; } public Queue ResultChecks { get; set; } diff --git a/SuperCom/Entity/SideComPort.cs b/SuperCom/Entity/SideComPort.cs index 8dd7e20..dd50a71 100644 --- a/SuperCom/Entity/SideComPort.cs +++ b/SuperCom/Entity/SideComPort.cs @@ -42,6 +42,12 @@ public string Remark get { return _Remark; } set { _Remark = value; RaisePropertyChanged(); } } + private bool _Hide; + public bool Hide + { + get { return _Hide; } + set { _Hide = value; RaisePropertyChanged(); } + } public SideComPort(string name, bool connected) { diff --git a/SuperCom/MainWindow.xaml b/SuperCom/MainWindow.xaml index e6b9f79..4a31102 100644 --- a/SuperCom/MainWindow.xaml +++ b/SuperCom/MainWindow.xaml @@ -48,6 +48,11 @@ Margin="0" Source="{x:Null}" Stretch="UniformToFill" /> + + + + + @@ -642,6 +647,31 @@ + + + + + + + + + + + + + @@ -731,94 +762,113 @@ ItemsSource="{Binding SideComPorts}" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Style="{StaticResource NormalListBox}"> + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + + + @@ -1319,7 +1369,9 @@ MinWidth="150" BorderThickness="1" Cursor="Hand" + PreviewMouseLeftButtonDown="BeginDragTabItem" PreviewMouseLeftButtonUp="SetPortSelected" + PreviewMouseMove="Border_PreviewMouseMove" Tag="{Binding Name}">