forked from adlnet-archive/LR-Publisher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNodeInfoWidget.cs
85 lines (69 loc) · 1.83 KB
/
NodeInfoWidget.cs
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
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Collections.Generic;
using Gtk;
using PublishGUI;
[System.ComponentModel.ToolboxItem(true)]
public partial class NodeInfoWidget : Gtk.Bin
{
public string NodeUrl
{
get
{
return this.lbl_http.Text+this.NodeUrlTextBox.Text;
}
set
{
this.NodeUrlTextBox.Text = value.Replace(this.lbl_http.Text, "");
}
}
public string HttpUsername
{
get { return this.AuthUsernameTextBox.Text; }
}
public string HttpPassword
{
get { return this.AuthPasswordTextBox.Text; }
}
public AuthType AuthenticationType
{
get { return (AuthType)this.AuthTypeComboBox.Active; }
}
public NodeInfoWidget ()
{
this.Build ();
this.Shown += HandleAuthTypeChanged;
}
public void HandleAuthTypeChanged (object sender, System.EventArgs e)
{
AuthType selectedType = (AuthType)this.AuthTypeComboBox.Active;
this.AuthCredentialsContainer.Visible = selectedType == AuthType.Basic;
this.AuthCredentialsContainer.ChildVisible = selectedType == AuthType.Basic;
}
public void ResetFields()
{
this.AuthTypeComboBox.Active = 0;
this.AuthUsernameTextBox.Text = "";
this.AuthPasswordTextBox.Text = "";
}
public List<Gtk.Label> GetMissingFields()
{
List<Gtk.Label> missingFields = new List<Gtk.Label>();
if(String.IsNullOrEmpty(this.NodeUrlTextBox.Text))
missingFields.Add(this.lbl_NodeUrl);
if(this.AuthTypeComboBox.Active == (int)AuthType.Basic)
{
if(String.IsNullOrEmpty(this.AuthUsernameTextBox.Text))
missingFields.Add(this.lbl_AuthUsername);
if(String.IsNullOrEmpty(this.AuthPasswordTextBox.Text))
missingFields.Add(this.lbl_AuthPassword);
}
return missingFields;
}
protected void OnUseSslCheckboxClicked (object sender, System.EventArgs e)
{
if(this.UseSslCheckbox.Active)
this.lbl_http.Text = "https://";
else
this.lbl_http.Text = "http://";
}
}