forked from LogExperts/LogExpert
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenUriDialog.cs
More file actions
71 lines (52 loc) · 1.32 KB
/
OpenUriDialog.cs
File metadata and controls
71 lines (52 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System.Runtime.Versioning;
namespace LogExpert.UI.Dialogs;
[SupportedOSPlatform("windows")]
internal partial class OpenUriDialog : Form
{
#region Fields
#endregion
#region cTor
public OpenUriDialog()
{
SuspendLayout();
AutoScaleDimensions = new SizeF(96F, 96F);
AutoScaleMode = AutoScaleMode.Dpi;
InitializeComponent();
ResumeLayout();
}
#endregion
#region Properties
public string Uri => cmbUri.Text;
public IList<string> UriHistory { get; set; }
#endregion
#region Events handler
private void OnOpenUriDialogLoad(object sender, EventArgs e)
{
if (UriHistory != null)
{
cmbUri.Items.Clear();
foreach (var uri in UriHistory)
{
cmbUri.Items.Add(uri);
}
}
}
private void OnBtnOkClick(object sender, EventArgs e)
{
UriHistory = [];
foreach (var item in cmbUri.Items)
{
UriHistory.Add(item.ToString());
}
if (UriHistory.Contains(cmbUri.Text))
{
UriHistory.Remove(cmbUri.Text);
}
UriHistory.Insert(0, cmbUri.Text);
while (UriHistory.Count > 20)
{
UriHistory.RemoveAt(UriHistory.Count - 1);
}
}
#endregion
}