Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 internal ViewPpc(Conn conn, ConnOpts connOpts, UInt16 width, UInt16 height) : base(conn, connOpts, width, height)
 {
     if (App.DevCap.Res >= ResLvl.High)
     {
         TapHoldRadius       *= 2;
         BigCircleRadius     *= 2;
         TapHoldCircleRadius *= 2;
         hScrlBar.Height     *= 2;
         vScrlBar.Width      *= 2;
     }
 }
Esempio n. 3
0
        private void GetConnDetails(string ip, string port, bool readOnly)
        {
            SessDlg sessDlg;

            if (viewOpts == null)
            {
                sessDlg = SessDlgFactory.Create();
            }
            else
            {
                sessDlg = SessDlgFactory.Create(viewOpts);
            }
            //if (sessDlg.ShowDialog() != DialogResult.OK)
            //    throw new QuietEx();
            sessDlg.Ok(ip, port, readOnly);
            opts = sessDlg.ConnOpts;
        }
Esempio n. 4
0
        private void GetConnDetails()
        {
            SessDlg sessDlg;

            if (viewOpts == null)
            {
                sessDlg = SessDlgFactory.Create();
            }
            else
            {
                sessDlg = SessDlgFactory.Create(viewOpts);
            }
            //if (sessDlg.ShowDialog() != DialogResult.OK)
            //    throw new QuietEx();
            sessDlg.Ok("10.25.25.91", "12005", false);
            opts = sessDlg.ConnOpts;
        }
Esempio n. 5
0
        private void SaveConnOpts(bool savePwd)
        {
            if (!ValidateCliScaling())
            {
                return;
            }
            GetConnMode();
            if (ConnMode == ConnMode.Active)
            {
                if (!ValidateHostPort())
                {
                    return;
                }
            }
            else
            {
                if (!ValidateListenPort())
                {
                    return;
                }
            }
            GetPasswd();
            GetOptions();

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = App.GetStr("VNC files (*.vncxml)|*.vncxml|All files (*.*)|*.*");
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                ConnOpts.Save(dlg.FileName, savePwd);
            }
            catch (IOException)
            {
                MessageBox.Show(App.GetStr("Unable to save!"),
                                App.GetStr("Error"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 6
0
        private void GetConnDetails()
        {
            SessDlg sessDlg;

            if (viewOpts == null)
            {
                sessDlg = SessDlgFactory.Create();
            }
            else
            {
                sessDlg = SessDlgFactory.Create(viewOpts);
            }
            if (sessDlg.ShowDialog() != DialogResult.OK)
            {
                throw new QuietEx();
            }
            opts = sessDlg.ConnOpts;
        }
Esempio n. 7
0
 internal static View Create(Conn conn, ConnOpts connOpts, UInt16 width, UInt16 height)
 {
     if (App.DevCap.Lvl >= DevCapLvl.Desktop)
     {
         return(new ViewDt(conn, connOpts, width, height));
     }
     else if (App.DevCap.Lvl >= DevCapLvl.PocketPc)
     {
         return(new ViewPpc(conn, connOpts, width, height));
     }
     else if (App.DevCap.Lvl >= DevCapLvl.Smartphone)
     {
         return(new ViewSp(conn, connOpts, width, height));
     }
     else
     {
         throw new NotSupportedException(App.GetStr("Device capability is unknown."));
     }
 }
Esempio n. 8
0
 internal static void NewConn(string fileName)
 {
     try
     {
         ConnOpts connOpts = new ConnOpts(fileName);
         Conn     conn     = new Conn();
         conn.Run(connOpts);
     }
     catch (FileNotFoundException)
     {
         MessageBox.Show(App.GetStr("Unable to open the file!"),
                         App.GetStr("Error"),
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation,
                         MessageBoxDefaultButton.Button1);
     }
     catch (IOException)
     {
         MessageBox.Show(App.GetStr("Unable to read from the file!"),
                         App.GetStr("Error"),
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation,
                         MessageBoxDefaultButton.Button1);
     }
     catch (XmlException)
     {
         MessageBox.Show(App.GetStr("The file is corrupted!"),
                         App.GetStr("Error"),
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation,
                         MessageBoxDefaultButton.Button1);
     }
     catch (FormatException)
     {
         MessageBox.Show(App.GetStr("The file is corrupted!"),
                         App.GetStr("Error"),
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation,
                         MessageBoxDefaultButton.Button1);
     }
 }
Esempio n. 9
0
        internal ViewFullCf(Conn conn, ConnOpts connOpts, UInt16 width, UInt16 height) : base(conn, connOpts, width, height)
        {
            MenuItem item;

            menu.MenuItems.Add(connMenu);
            connMenu.MenuItems.Add(newConnItem);
            item        = new MenuItem();
            item.Text   = App.GetStr("Open...");
            item.Click += new EventHandler(LoadConnOptsClicked);
            connMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Save as...");
            item.Click += new EventHandler(SaveConnOptsClicked);
            connMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Save as (with password)...");
            item.Click += new EventHandler(SaveConnOptsPwdClicked);
            connMenu.MenuItems.Add(item);
            item      = new MenuItem();
            item.Text = "-";
            connMenu.MenuItems.Add(item);
            connMenu.MenuItems.Add(refreshItem);
            item      = new MenuItem();
            item.Text = "-";
            connMenu.MenuItems.Add(item);
            connMenu.MenuItems.Add(closeConnItem);

            menu.MenuItems.Add(viewMenu);
            menu.MenuItems.Add(keysMenu);
            menu.MenuItems.Add(optionsMenu);
            item      = new MenuItem();
            item.Text = App.GetStr("Help");
            menu.MenuItems.Add(item);
            item.MenuItems.Add(aboutItem);

            item         = new MenuItem();
            item.Text    = App.GetStr("Full screen");
            item.Checked = true; // If we see this we are using full screen.
            item.Click  += fullScrnHdr;
            ctxMenu.MenuItems.Add(item);
            ctxRotateMenu.Text = App.GetStr("Rotate");
            ctxMenu.MenuItems.Add(ctxRotateMenu);
            item        = new MenuItem();
            item.Text   = App.GetStr("Portrait");
            item.Click += rotateHdr;
            ctxRotateMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Screen rotated clockwise");
            item.Click += rotateHdr;
            ctxRotateMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Screen rotated counter-clockwise");
            item.Click += rotateHdr;
            ctxRotateMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Upside down");
            item.Click += rotateHdr;
            ctxRotateMenu.MenuItems.Add(item);
            CheckRotate(ctxRotateMenu);
            ctxCliScalingMenu.Text = App.GetStr("Client-side scaling");
            ctxMenu.MenuItems.Add(ctxCliScalingMenu);
            item        = new MenuItem();
            item.Text   = App.GetStr("None");
            item.Click += cliScalingHdr;
            ctxCliScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Auto");
            item.Click += cliScalingHdr;
            ctxCliScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/2 of server");
            item.Click += cliScalingHdr;
            ctxCliScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/3 of server");
            item.Click += cliScalingHdr;
            ctxCliScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/4 of server");
            item.Click += cliScalingHdr;
            ctxCliScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/5 of server");
            item.Click += cliScalingHdr;
            ctxCliScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("2 of server");
            item.Click += cliScalingHdr;
            ctxCliScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Custom...");
            item.Click += cliScalingHdr;
            ctxCliScalingMenu.MenuItems.Add(item);
            CheckCliScaling(ctxCliScalingMenu);
            ctxServScalingMenu.Text = App.GetStr("Server-side scaling");
            ctxMenu.MenuItems.Add(ctxServScalingMenu);
            item        = new MenuItem();
            item.Text   = App.GetStr("None");
            item.Click += servScalingHdr;
            ctxServScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/2");
            item.Click += servScalingHdr;
            ctxServScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/3");
            item.Click += servScalingHdr;
            ctxServScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/4");
            item.Click += servScalingHdr;
            ctxServScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/5");
            item.Click += servScalingHdr;
            ctxServScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/6");
            item.Click += servScalingHdr;
            ctxServScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/7");
            item.Click += servScalingHdr;
            ctxServScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/8");
            item.Click += servScalingHdr;
            ctxServScalingMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("1/9");
            item.Click += servScalingHdr;
            ctxServScalingMenu.MenuItems.Add(item);
            CheckServScaling(ctxServScalingMenu);
            ctxKeysMenu.Text = App.GetStr("Keys");
            ctxMenu.MenuItems.Add(ctxKeysMenu);
            item        = new MenuItem();
            item.Text   = App.GetStr("Shift down");
            item.Click += keysHdr;
            ctxKeysMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Shift up");
            item.Click += keysHdr;
            ctxKeysMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Esc");
            item.Click += keysHdr;
            ctxKeysMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Tab");
            item.Click += keysHdr;
            ctxKeysMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Ctrl-");
            item.Click += keysHdr;
            ctxKeysMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Alt-");
            item.Click += keysHdr;
            ctxKeysMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Ctrl-Alt-");
            item.Click += keysHdr;
            ctxKeysMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Ctrl-Alt-Del");
            item.Click += keysHdr;
            ctxKeysMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("Ctrl-Esc (Start Menu)");
            item.Click += keysHdr;
            ctxKeysMenu.MenuItems.Add(item);
            ctxFnMenu.Text = App.GetStr("Fn");
            ctxKeysMenu.MenuItems.Add(ctxFnMenu);
            item        = new MenuItem();
            item.Text   = App.GetStr("F1");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F2");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F3");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F4");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F5");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F6");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F7");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F8");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F9");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F10");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F11");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("F12");
            item.Click += keysHdr;
            ctxFnMenu.MenuItems.Add(item);
            item      = new MenuItem();
            item.Text = "-";
            ctxMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("View single window");
            item.Click += viewWinHdr;
            ctxMenu.MenuItems.Add(item);
            item        = new MenuItem();
            item.Text   = App.GetStr("View desktop");
            item.Click += viewWinHdr;
            ctxMenu.MenuItems.Add(item);
        }
Esempio n. 10
0
        private void LoadConnOptsClicked(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = App.GetStr("VNC files (*.vncxml)|*.vncxml|All files (*.*)|*.*");
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            ConnOpts connOpts;

            try
            {
                connOpts = new ConnOpts(dlg.FileName);
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show(App.GetStr("Unable to open the file!"),
                                App.GetStr("Error"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                return;
            }
            catch (IOException)
            {
                MessageBox.Show(App.GetStr("Unable to read from the file!"),
                                App.GetStr("Error"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                return;
            }
            catch (XmlException)
            {
                MessageBox.Show(App.GetStr("The file is corrupted!"),
                                App.GetStr("Error"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                return;
            }
            catch (FormatException)
            {
                MessageBox.Show(App.GetStr("The file is corrupted!"),
                                App.GetStr("Error"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                return;
            }
            listenBox.Checked = connOpts.ConnMode == ConnMode.Passive;
            if (connOpts.ConnMode == ConnMode.Active)
            {
                remoteEndPt.Text = connOpts.Host + "::" + connOpts.Port;
            }
            else
            {
                listenPortBox.Text = connOpts.Port.ToString();
            }
            passwdBox.Text = connOpts.Passwd;
            SetOptions(connOpts.ViewOpts);
        }
Esempio n. 11
0
 internal void Run(ConnOpts opts)
 {
     this.opts = opts;
     Run();
 }
Esempio n. 12
0
        internal ViewSp(Conn conn, ConnOpts connOpts, UInt16 width, UInt16 height) : base(conn, connOpts, width, height)
        {
            mouseAccelModeHdr = new EventHandler(MouseAccelModeClicked);

            MenuItem item;
            MenuItem subItem;

            item        = new MenuItem();
            item.Text   = App.GetStr("Left click");
            item.Click += new EventHandler(LeftClicked);
            menu.MenuItems.Add(item);
            item      = new MenuItem();
            item.Text = App.GetStr("Menu");
            menu.MenuItems.Add(item);

            subItem        = new MenuItem();
            subItem.Text   = App.GetStr("Right click");
            subItem.Click += new EventHandler(RightClicked);
            item.MenuItems.Add(subItem);
            subItem      = new MenuItem();
            subItem.Text = "-";
            item.MenuItems.Add(subItem);
            item.MenuItems.Add(connMenu);
            connMenu.MenuItems.Add(newConnItem);
            connMenu.MenuItems.Add(refreshItem);
            item.MenuItems.Add(viewMenu);
            item.MenuItems.Add(keysMenu);
            item.MenuItems.Add(optionsMenu);
            subItem         = new MenuItem();
            subItem.Text    = App.GetStr("Send mouse location when idle");
            subItem.Checked = connOpts.ViewOpts.SendMouseLocWhenIdle;
            subItem.Click  += new EventHandler(SendMouseLocWhenIdleClicked);
            optionsMenu.MenuItems.Add(subItem);
            mouseAccelModeMenu.Text = App.GetStr("Mouse speed");
            optionsMenu.MenuItems.Add(mouseAccelModeMenu);
            subItem         = new MenuItem();
            subItem.Text    = App.GetStr("Acceleration on");
            subItem.Checked = connOpts.ViewOpts.MouseAccelMode;
            subItem.Click  += mouseAccelModeHdr;
            mouseAccelModeMenu.MenuItems.Add(subItem);
            subItem         = new MenuItem();
            subItem.Text    = App.GetStr("Low");
            subItem.Checked = !connOpts.ViewOpts.MouseAccelMode && (connOpts.ViewOpts.MouseSpeed == MouseSpeed.Low);
            subItem.Click  += mouseAccelModeHdr;
            mouseAccelModeMenu.MenuItems.Add(subItem);
            subItem         = new MenuItem();
            subItem.Text    = App.GetStr("Normal");
            subItem.Checked = !connOpts.ViewOpts.MouseAccelMode && (connOpts.ViewOpts.MouseSpeed == MouseSpeed.Normal);
            subItem.Click  += mouseAccelModeHdr;
            mouseAccelModeMenu.MenuItems.Add(subItem);
            subItem         = new MenuItem();
            subItem.Text    = App.GetStr("High");
            subItem.Checked = !connOpts.ViewOpts.MouseAccelMode && (connOpts.ViewOpts.MouseSpeed == MouseSpeed.High);
            subItem.Click  += mouseAccelModeHdr;
            mouseAccelModeMenu.MenuItems.Add(subItem);
            subItem      = new MenuItem();
            subItem.Text = "-";
            item.MenuItems.Add(subItem);
            item.MenuItems.Add(aboutItem);
            item.MenuItems.Add(closeConnItem);

            cursorTimer.Tick    += new EventHandler(CursorTicked);
            cursorTimer.Interval = CursorDelta;
            cursorTimer.Enabled  = true;

            mouseIdleTimer.Tick    += new EventHandler(MouseIdleTicked);
            mouseIdleTimer.Interval = MouseIdleDelta;
            mouseIdleTimer.Enabled  = connOpts.ViewOpts.SendMouseLocWhenIdle;

            Graphics graphics = CreateGraphics();

            inputTimer.Tick      += new EventHandler(InputTicked);
            inputTimer.Interval   = InputDelta;
            inputBox.Enabled      = false;
            inputBox.Visible      = false;
            inputBox.MaxLength    = 1;
            inputBox.Size         = graphics.MeasureString("M", Font).ToSize(); // M should be the widest character
            inputBox.Width       += App.DialogSpacing;                          // Give the textbox some more space.
            inputBox.TextChanged += new EventHandler(OnInputTextChanged);
            inputBox.KeyDown     += new KeyEventHandler(OnInputKeyDown);
            inputBox.KeyUp       += new KeyEventHandler(OnInputKeyUp);
            inputBox.KeyPress    += new KeyPressEventHandler(OnInputKeyPress);
            Controls.Add(inputBox);

            graphics.Dispose();
        }
Esempio n. 13
0
 internal ViewDt(Conn conn, ConnOpts connOpts, UInt16 width, UInt16 height) : base(conn, connOpts, width, height)
 {
 }