/[AnywhereTS-MSSQL]/trunk/TSAdminTool/frmConfigInternalServices.cs
ViewVC logotype

Contents of /trunk/TSAdminTool/frmConfigInternalServices.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations) (download)
Wed Jul 11 14:19:13 2012 UTC (7 years, 7 months ago) by william
File size: 6961 byte(s)
imported from https://anywherets.svn.sourceforge.net/svnroot/anywherets/trunk/
Revision: 1
Author: beartown
Date: 3:10:40 AM, Monday, June 21, 2010
Message:
First upload. Still todo in order to get a fully working product: Replace Thinstation images with vanilla Thinstation, modify ImageDesigntimeConfig.cs, ImageRuntimeConfig.cs in order to support the Thinstation image
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Text;
7 using System.Windows.Forms;
8 using System.Net;
9
10 namespace AnywhereTS
11 {
12 public partial class frmConfigInternalServices : Form
13 {
14 public frmConfigInternalServices()
15 {
16 InitializeComponent();
17 }
18
19
20 private void chkTFTPnet_CheckedChanged(object sender, EventArgs e)
21 {
22 if (chkTFTPnet.Checked)
23 {
24 cboTFTP.Enabled = true;
25 }
26 else
27 {
28 cboTFTP.Enabled = false;
29 }
30
31 }
32
33
34 private void btnOkDHCP_Click(object sender, EventArgs e)
35 {
36
37 // DHCP...
38 {
39 // Check valid IP pool start address
40 IPAddress ipValid;
41 if (ATSGlobals.dhcpConfig == 0) // If we are using the internal DHCP server
42 {
43 if (!IPAddress.TryParse(txtIPpool.Text, out ipValid))
44 {
45 MessageBox.Show("Please enter a valid IP address");
46 txtIPpool.Focus();
47 txtIPpool.SelectAll();
48 return;
49 }
50 // Check valid Net Mask address
51 if (!IPAddress.TryParse(txtNetMask.Text, out ipValid))
52 {
53 MessageBox.Show("Please enter a valid IP address");
54 txtNetMask.Focus();
55 txtNetMask.SelectAll();
56 return;
57 }
58 // Check valid IP address (router)
59 if (!IPAddress.TryParse(txtRouter.Text, out ipValid))
60 {
61 MessageBox.Show("Please enter a valid IP address");
62 txtRouter.Focus();
63 txtRouter.SelectAll();
64 return;
65 }
66 // Check valid IP address (DNS)
67 if (!IPAddress.TryParse(txtDNS.Text, out ipValid))
68 {
69 MessageBox.Show("Please enter a valid IP address");
70 txtDNS.Focus();
71 txtDNS.SelectAll();
72 return;
73 }
74 // Check valid address pool size
75 if (txtPoolSize.Text == "")
76 {
77 MessageBox.Show("You must enter a number");
78 txtPoolSize.Focus();
79 return;
80 }
81 IPAddress ipRegIP;
82 ipRegIP = IPAddress.Parse(txtNetMask.Text);
83 AtsDhcp.intNetMask = BitConverter.ToInt32(ipRegIP.GetAddressBytes(), 0);
84 ipRegIP = IPAddress.Parse(txtRouter.Text);
85 AtsDhcp.intGateway = BitConverter.ToInt32(ipRegIP.GetAddressBytes(), 0);
86 ipRegIP = IPAddress.Parse(txtDNS.Text);
87 AtsDhcp.intDNS = BitConverter.ToInt32(ipRegIP.GetAddressBytes(), 0);
88 ipRegIP = IPAddress.Parse(txtIPpool.Text);
89 AtsDhcp.intIP_Pool = BitConverter.ToInt32(ipRegIP.GetAddressBytes(), 0);
90 AtsDhcp.intPoolSize = Int32.Parse(txtPoolSize.Text);
91 AtsDhcp.intDHCPon = 5;
92 }
93 else
94 {
95 AtsDhcp.intDHCPon = 1;
96 }
97 if (ATSGlobals.tftpConfig == 0) // If we are using the internal TFTP server
98 {
99 if (chkTFTPnet.Checked)
100 {
101
102 if (!IPAddress.TryParse(cboTFTP.Text, out ipValid))
103 {
104 MessageBox.Show("Please Select or enter a valid IP address");
105 {
106 cboTFTP.Focus();
107 return;
108 }
109 }
110 else
111 {
112 AtsDhcp.strTftpd32IP = cboTFTP.Text;
113 }
114 }
115 else
116 {
117 AtsDhcp.strTftpd32IP = "";
118 }
119 AtsDhcp.ConfTFTPD32(ATSGlobals.tftpConfig == 0);
120 { // Terminate this form
121 DialogResult = DialogResult.OK;
122 }
123 }
124 }
125 }
126
127 private void frmDHCPoptions_Load(object sender, EventArgs e)
128 {
129 helpProvider.HelpNamespace = ATSGlobals.strHelpFilePath; // Initiate helpProvider
130
131 // Disable controls that should not be used
132
133 if (ATSGlobals.tftpConfig != 0)
134 { // Other TFTP used, disable controls for internal TFTP.
135 grbTFTP.Enabled = false;
136 }
137
138 if (ATSGlobals.dhcpConfig != 0)
139 { // Other DHCP used, disable controls for internal DHCP.
140 grbDHCP.Enabled = false;
141 }
142
143 AtsDhcp.OpenTFTP32regKey();
144 if (AtsDhcp.strTftpd32IP == "")
145 {
146 cboTFTP.Text = "";
147 chkTFTPnet.Checked = false;
148 }
149 else
150 {
151 cboTFTP.Text = AtsDhcp.strTftpd32IP;
152 chkTFTPnet.Checked = true;
153 }
154 byte[] byteArray;
155 byteArray = BitConverter.GetBytes(AtsDhcp.intDNS);
156 txtDNS.Text = byteArray[0].ToString() + "." + byteArray[1].ToString() + "." + byteArray[2].ToString() + "." + byteArray[3].ToString();
157 byteArray = BitConverter.GetBytes(AtsDhcp.intIP_Pool);
158 txtIPpool.Text = byteArray[0].ToString() + "." + byteArray[1].ToString() + "." + byteArray[2].ToString() + "." + byteArray[3].ToString();
159 byteArray = BitConverter.GetBytes(AtsDhcp.intGateway);
160 txtRouter.Text = byteArray[0].ToString() + "." + byteArray[1].ToString() + "." + byteArray[2].ToString() + "." + byteArray[3].ToString();
161 byteArray = BitConverter.GetBytes(AtsDhcp.intNetMask);
162 txtNetMask.Text = byteArray[0].ToString() + "." + byteArray[1].ToString() + "." + byteArray[2].ToString() + "." + byteArray[3].ToString();
163 txtPoolSize.Text = AtsDhcp.intPoolSize.ToString();
164
165 if (chkTFTPnet.Checked)
166 cboTFTP.Enabled = true;
167 else
168 cboTFTP.Enabled = false;
169 ProSupport.ThisComputerIp(cboTFTP,false);
170 cboTFTP.SelectedIndex = 0;
171 }
172 }
173 }

  ViewVC Help
Powered by ViewVC 1.1.22