📄 configwindow.cs
字号:
// project created on 16/08/2005 at 22:50using System;using Gtk;using Glade;using System.Diagnostics;public class ConfigWindow{ [Glade.Widget] private Gtk.Window window1; [Glade.Widget] private Entry ssid; [Glade.Widget] private Entry wep; [Glade.Widget] private Entry ip; [Glade.Widget] private Entry netmask; [Glade.Widget] private Entry gateway; [Glade.Widget] private ComboBox combobox1; private Network net ; private OS os; public ConfigWindow (OS ooss) { os = ooss; Glade.XML gxml = new Glade.XML (null, "Config.glade", "window1", null); gxml.Autoconnect (this); } public ConfigWindow(Network n, OS ooss){ os = ooss; net=n; Glade.XML gxml = new Glade.XML (null, "Config.glade", "window1", null); gxml.Autoconnect (this); ssid.Text = n.SSID; //Show Profile.. ShowProfile(); } private void Ok(object o, EventArgs a){ if (false) //Check if the values looks good.. return; if (SelectedMethod=="DHCP") os.DHCP(ssid.Text,WepKeyString()); else if (SelectedMethod=="Static IP") os.StaticIP(ssid.Text,ip.Text,netmask.Text,WepKeyString(),gateway.Text); //Update the info of the network... SaveProfile(); Cancel(o,a); } private string WepKeyString(){ if (wep.Text.Trim().Length<1) return null; else return wep.Text; } private string SelectedMethod{ get { string Method = null; TreeIter iter; if (combobox1.GetActiveIter(out iter)) Method = (string)combobox1.Model.GetValue(iter,0); return Method; } } private void Cancel(object o, EventArgs a){ //window.Destroy(); window1.Hide(); } private void ShowProfile(){ if (net.wep!=null) wep.Text = net.wep; if (net.ip!=null) ip.Text = net.ip; if (net.netmask!=null) netmask.Text = net.netmask; if (net.gateway!=null) gateway.Text = net.gateway; if (net.method!=null) method = net.method; } private void SaveProfile(){ if (wep.Text.Length>1) net.wep = wep.Text; if (ip.Text.Length>1) net.ip = ip.Text; if (netmask.Text.Length>1) net.netmask = netmask.Text; if (gateway.Text.Length>1) net.gateway = gateway.Text; if (method!=null) net.method = method; } public string method{ get { TreeIter iter; if (combobox1.GetActiveIter (out iter)) return ((string) combobox1.Model.GetValue (iter, 0)); else return ""; } set { if (value=="Static IP") combobox1.Active = 0; else if (value=="DHCP") combobox1.Active =1; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -