Skip to content

Commit 643909d

Browse files
committed
feat: <subject>
fix: docs: style: refactor: chore: <body>
1 parent b183078 commit 643909d

File tree

5 files changed

+18
-30
lines changed

5 files changed

+18
-30
lines changed

Shawn.Utils

Ui/Model/Protocol/Base/ProtocolBase.cs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Collections.ObjectModel;
43
using System.ComponentModel;
54
using System.Diagnostics;
6-
using System.IO;
75
using System.Linq;
86
using System.Reflection;
97
using System.Windows.Media.Imaging;
108
using _1RM.Service;
11-
using _1RM.Service.DataSource;
129
using _1RM.Service.DataSource.Model;
1310
using _1RM.Utils;
14-
using FluentFTP.Helpers;
1511
using Newtonsoft.Json;
1612
using Shawn.Utils;
17-
using Shawn.Utils.Interface;
1813
using Shawn.Utils.Wpf;
1914
using Shawn.Utils.Wpf.Image;
20-
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
2115

2216
namespace _1RM.Model.Protocol.Base
2317
{
@@ -46,7 +40,7 @@ public string Id
4640
get
4741
{
4842
if (string.IsNullOrEmpty(_id))
49-
GenerateIdForTmpSession();
43+
_id = "TMP_SESSION_" + new DateTimeOffset(DateTime.Now).ToUnixTimeMilliseconds();
5044
return _id;
5145
}
5246
set => SetAndNotifyIfChanged(ref _id, value);
@@ -57,12 +51,6 @@ public bool IsTmpSession()
5751
return _id.StartsWith("TMP_SESSION_") || string.IsNullOrEmpty(_id);
5852
}
5953

60-
public void GenerateIdForTmpSession()
61-
{
62-
Debug.Assert(IsTmpSession());
63-
_id = "TMP_SESSION_" + new DateTimeOffset(DateTime.Now).ToUnixTimeMilliseconds();
64-
}
65-
6654
/// <summary>
6755
/// protocol name
6856
/// </summary>
@@ -408,16 +396,6 @@ public virtual bool IsThisTimeConnWithFullScreen()
408396
[JsonIgnore]
409397
public DataSourceBase? DataSource { get; set; }
410398

411-
/// <summary>
412-
/// check if every value is ok
413-
/// </summary>
414-
public virtual bool Verify()
415-
{
416-
if (string.IsNullOrEmpty(DisplayName))
417-
return false;
418-
return true;
419-
}
420-
421399
/// <summary>
422400
/// build the id for host
423401
/// </summary>

Ui/Model/Protocol/SSH.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System;
2+
using System.Collections.Generic;
23
using Newtonsoft.Json;
34
using _1RM.Model.Protocol.Base;
45
using _1RM.Utils.KiTTY;
56
using Shawn.Utils;
67
using System.Text.RegularExpressions;
8+
using System.Windows.Controls;
79

810
namespace _1RM.Model.Protocol
911
{

Ui/Model/ProtocolActionHelper.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Windows;
4+
using _1RM.Model.Protocol;
45
using _1RM.Model.Protocol.Base;
56
using _1RM.Model.ProtocolRunner;
67
using _1RM.Model.ProtocolRunner.Default;
@@ -150,6 +151,18 @@ public static List<ProtocolAction> GetActions(this ProtocolBase server, bool for
150151
AppStartupHelper.InstallDesktopShortcutByUlid(server.DisplayName, new[] { server.Id }, iconPath);
151152
}));
152153

154+
if (forTabHeader)
155+
{
156+
if (server is SSH ssh)
157+
{
158+
actions.Add(new ProtocolAction(IoC.Translate("Create desktop shortcut"), () =>
159+
{
160+
var iconPath = AppStartupHelper.MakeIcon(server.Id, server.IconImg);
161+
AppStartupHelper.InstallDesktopShortcutByUlid(server.DisplayName, new[] { server.Id }, iconPath);
162+
}));
163+
}
164+
}
165+
153166
#endregion Build Actions
154167

155168
return actions;

Ui/View/Host/ProtocolHosts/HostBase.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Diagnostics;
43
using System.Windows;
54
using System.Windows.Controls;
6-
using System.Windows.Controls.Ribbon;
75
using System.Windows.Data;
86
using System.Windows.Interop;
97
using _1RM.Model;
10-
using _1RM.Model.Protocol;
118
using _1RM.Model.Protocol.Base;
12-
using _1RM.Service;
139
using _1RM.View.Settings;
1410
using Shawn.Utils;
1511
using Shawn.Utils.Wpf;
1612
using Shawn.Utils.WpfResources.Theme.Styles;
17-
using Stylet;
1813

1914
namespace _1RM.View.Host.ProtocolHosts
2015
{
@@ -189,7 +184,7 @@ public string ConnectionId
189184
/// <summary>
190185
/// special menu for tab
191186
/// </summary>
192-
public List<MenuItem> MenuItems { get; set; } = new List<MenuItem>();
187+
public List<System.Windows.Controls.MenuItem> MenuItems { get; set; } = new List<System.Windows.Controls.MenuItem>();
193188

194189
/// <summary>
195190
/// since resizing when rdp is connecting would not tiger the rdp size change event

0 commit comments

Comments
 (0)