internal CliScalingDlg(ViewOpts viewOpts) { this.viewOpts = viewOpts; if (App.DevCap.Lvl >= DevCapLvl.PocketPc) { okBtn = new Button(); cancelBtn = new Button(); if (App.DevCap.Lvl == DevCapLvl.PocketPc && App.DevCap.Res >= ResLvl.High) { widthBox.Height *= 2; heightBox.Height *= 2; okBtn.Width *= 2; okBtn.Height *= 2; cancelBtn.Width *= 2; cancelBtn.Height *= 2; } } else { okItem = new MenuItem(); cancelItem = new MenuItem(); } widthBox.Text = String.Empty; heightBox.Text = String.Empty; if (viewOpts.CliScaling == CliScaling.Custom) { widthBox.Text = viewOpts.CliScalingWidth.ToString(); heightBox.Text = viewOpts.CliScalingHeight.ToString(); } }
private void CleanUp() { // We don't cleanup majorVer, minorVer, etc. here because // we will always read them when run is called. if (writer != null) { writer.Close(); writer = null; } if (reader != null) { reader.Close(); reader = null; } if (stream != null) { stream.Close(); stream = null; } if (tcpClient != null) { tcpClient.Close(); tcpClient = null; } RelNetworkConn(); opts = null; viewOpts = null; }
protected override void SetOptions(ViewOpts viewOpts) { base.SetOptions(viewOpts); sendMouseLocWhenIdleBox.Checked = viewOpts.SendMouseLocWhenIdle; if (viewOpts.MouseAccelMode) { mouseSpeedBox.SelectedIndex = 0; } else { switch (viewOpts.MouseSpeed) { case MouseSpeed.Low: mouseSpeedBox.SelectedIndex = 1; break; case MouseSpeed.High: mouseSpeedBox.SelectedIndex = 3; break; default: mouseSpeedBox.SelectedIndex = 2; break; } } }
internal ConnOpts(int port, string passwd, ViewOpts viewOpts) { // TODO: Check the minimum and maximum values. if (port < 0) { throw new ArgumentException("port", "Not a valid value"); } if (viewOpts == null) { throw new ArgumentException("viewOpts", "Cannot be null"); } ConnMode = ConnMode.Passive; Host = "localhost"; Port = port; Passwd = passwd; ViewOpts = viewOpts; }
internal static SessDlg Create(ViewOpts viewOpts) { if (App.DevCap.Lvl >= DevCapLvl.Desktop) { return(new SessDlgDt(viewOpts)); } else if (App.DevCap.Lvl >= DevCapLvl.PocketPc) { return(new SessDlgPpc(viewOpts)); } else if (App.DevCap.Lvl >= DevCapLvl.Smartphone) { return(new SessDlgSp(viewOpts)); } else { throw new NotSupportedException(App.GetStr("Device capability is unknown.")); } }
internal static void NewConn() { Conn conn = new Conn(); try { ViewOpts viewOpts = new ViewOpts(App.SettingsFileName); conn.Run(viewOpts); } catch (FileNotFoundException) { conn.Run(); } catch (IOException) { MessageBox.Show(App.GetStr("Unable to read from the setting file!"), App.GetStr("Error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); conn.Run(); } catch (XmlException) { MessageBox.Show(App.GetStr("The setting file is corrupted!"), App.GetStr("Error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); conn.Run(); } catch (FormatException) { MessageBox.Show(App.GetStr("The setting file is corrupted!"), App.GetStr("Error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); conn.Run(); } }
internal ConnOpts(string host, int port, string passwd, ViewOpts viewOpts) { if (host == null) { throw new ArgumentException("host", "Cannot be null"); } // TODO: Check the minimum and maximum values. if (port < 0) { throw new ArgumentException("port", "Not a valid value"); } if (viewOpts == null) { throw new ArgumentException("viewOpts", "Cannot be null"); } Host = host; Port = port; Passwd = passwd; ViewOpts = viewOpts; }
private void RestoreDefsClicked(object sender, EventArgs e) { try { viewOpts.Load(App.SettingsFileName); } catch (FileNotFoundException) { viewOpts = new ViewOpts(); } catch (IOException) { MessageBox.Show(App.GetStr("Unable to read from the setting file!"), App.GetStr("Error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } catch (XmlException) { MessageBox.Show(App.GetStr("The setting file is corrupted!"), App.GetStr("Error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } catch (FormatException) { MessageBox.Show(App.GetStr("The setting file is corrupted!"), App.GetStr("Error"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } SetOptions(viewOpts); }
internal SessDlg(ViewOpts viewOpts) : base() { this.viewOpts = viewOpts; SetupHdrs(); }
internal SessDlg() : base() { viewOpts = new ViewOpts(); SetupHdrs(); }
protected virtual void SetOptions(ViewOpts viewOpts) { this.viewOpts = viewOpts; fullScrnBox.Checked = viewOpts.IsFullScrn; switch (viewOpts.Orientation) { case Orientation.Portrait: rotateBox.SelectedIndex = 0; break; case Orientation.Landscape90: rotateBox.SelectedIndex = 1; break; case Orientation.Portrait180: rotateBox.SelectedIndex = 3; break; case Orientation.Landscape270: rotateBox.SelectedIndex = 2; break; } switch (viewOpts.PixelSize) { case PixelSize.Unspec: pixelSizeBox.SelectedIndex = 0; break; case PixelSize.Force8Bit: pixelSizeBox.SelectedIndex = 1; break; case PixelSize.Force16Bit: pixelSizeBox.SelectedIndex = 2; break; } cliScalingWidthBox.Text = String.Empty; cliScalingHeightBox.Text = String.Empty; switch (viewOpts.CliScaling) { case CliScaling.None: cliScalingBox.SelectedIndex = 0; break; case CliScaling.Auto: cliScalingBox.SelectedIndex = 1; break; case CliScaling.OneHalf: cliScalingBox.SelectedIndex = 2; break; case CliScaling.OneThird: cliScalingBox.SelectedIndex = 3; break; case CliScaling.OneFourth: cliScalingBox.SelectedIndex = 4; break; case CliScaling.OneFifth: cliScalingBox.SelectedIndex = 5; break; case CliScaling.Double: cliScalingBox.SelectedIndex = 6; break; case CliScaling.Custom: cliScalingBox.SelectedIndex = 7; cliScalingWidthBox.Text = viewOpts.CliScalingWidth.ToString(); cliScalingHeightBox.Text = viewOpts.CliScalingHeight.ToString(); break; } servScalingBox.SelectedIndex = (int)viewOpts.ServScaling; viewOnlyBox.Checked = viewOpts.ViewOnly; shareServBox.Checked = !viewOpts.ShareServ; scrnUpdAlgoBox.Checked = viewOpts.ScrnUpdAlgo == ScrnUpdAlgo.Asap; }
internal SessDlgFullCf(ViewOpts viewOpts) : base(viewOpts) { }
internal void Run(ViewOpts viewOpts) { this.viewOpts = viewOpts; Run(); }
internal SessDlgSp(ViewOpts viewOpts) : base(viewOpts) { SetupMouseSpeedBox(); }
internal void Load(string fileName) { XmlDocument doc = new XmlDocument(); doc.Load(fileName); XmlNodeList list = doc.GetElementsByTagName(ConnModeName); if (list.Count > 0) { switch (list[0].InnerText) { case PassiveName: ConnMode = ConnMode.Passive; break; default: ConnMode = ConnMode.Active; break; } } else { ConnMode = ConnMode.Active; } if (ConnMode == ConnMode.Active) { list = doc.GetElementsByTagName(HostName); if (list.Count > 0) { Host = list[0].InnerText; } else { throw new FormatException("Host name is not found."); } } else { Host = "localhost"; } list = doc.GetElementsByTagName(PortName); if (list.Count > 0) { Port = Int32.Parse(list[0].InnerText); } else { throw new FormatException("Port number is not found."); } list = doc.GetElementsByTagName(PasswdName); if (list.Count > 0) { Passwd = list[0].InnerText; } else { Passwd = ""; // This means we did not save the password. } ViewOpts = new ViewOpts(); ViewOpts.ReadFromXml(doc, doc.DocumentElement); }