Skip to content

Commit

Permalink
选项卡右键支持:关闭、移动、固定操作
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperStudio committed Feb 4, 2023
1 parent 4a4338d commit fae419f
Show file tree
Hide file tree
Showing 6 changed files with 664 additions and 137 deletions.
20 changes: 20 additions & 0 deletions SuperCom/Entity/CustomSerialPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}

Expand All @@ -135,6 +144,17 @@ public static string GetRemark(string json)
}
return "";
}
public static bool GetPinned(string json)
{
Dictionary<string, object> dict = JsonUtils.TryDeserializeObject<Dictionary<string, object>>(json);
string pinned = "";
if (dict != null)
{
if (dict.ContainsKey("Pinned"))
pinned = dict["Pinned"].ToString();
}
return pinned.ToLower().Equals("true") ? true : false;
}



Expand Down
7 changes: 7 additions & 0 deletions SuperCom/Entity/PortTabItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ public ObservableCollection<VarMonitor> VarMonitors
}
}

private bool _Pinned;
public bool Pinned
{
get { return _Pinned; }
set { _Pinned = value; RaisePropertyChanged(); }
}

public bool RunningCommands { get; set; }

public Queue<ResultCheck> ResultChecks { get; set; }
Expand Down
6 changes: 6 additions & 0 deletions SuperCom/Entity/SideComPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading

0 comments on commit fae419f

Please sign in to comment.