-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSetupDialogForm.cs
More file actions
61 lines (55 loc) · 2.23 KB
/
SetupDialogForm.cs
File metadata and controls
61 lines (55 loc) · 2.23 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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using ASCOM.Utilities;
using ASCOM.DigitalLoggers;
namespace ASCOM.DigitalLoggers
{
[ComVisible(false)] // Form not registered for COM!
public partial class SetupDialogForm : Form
{
public SetupDialogForm()
{
InitializeComponent();
// Initialise current values of user settings from the ASCOM Profile
textBoxIpAddress.Text = Switch.IpAddress;
textBoxUserName.Text = Switch.UserName;
textBoxPassword.Text = Switch.Password;
chkTrace.Checked = Switch.traceState;
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
labelVersion.Text = "Version: " + version.ToString();
}
private void cmdOK_Click(object sender, EventArgs e) // OK button event handler
{
// Place any validation constraint checks here
Switch.IpAddress = textBoxIpAddress.Text; // Update the state variables with results from the dialogue
Switch.UserName = textBoxUserName.Text; // Update the state variables with results from the dialogue
Switch.Password = textBoxPassword.Text; // Update the state variables with results from the dialogue
Switch.traceState = chkTrace.Checked;
}
private void cmdCancel_Click(object sender, EventArgs e) // Cancel button event handler
{
Close();
}
private void BrowseToAscom(object sender, EventArgs e) // Click on ASCOM logo event handler
{
try
{
System.Diagnostics.Process.Start("http://ascom-standards.org/");
}
catch (System.ComponentModel.Win32Exception noBrowser)
{
if (noBrowser.ErrorCode == -2147467259)
MessageBox.Show(noBrowser.Message);
}
catch (System.Exception other)
{
MessageBox.Show(other.Message);
}
}
}
}