예제 #1
0
 void notifyIconServer_DoubleClick(object sender, EventArgs e)
 {
     if (this.Visible == false)
     {
         FormLogin formLogin = new FormLogin(USERNAME, PASSWORD);
         if (formLogin.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             // show this dialog
             this.Visible     = true;
             this.WindowState = FormWindowState.Normal;
         }
     }
 }
예제 #2
0
        private void onFormLoad(object sender, EventArgs e)
        {
            string vncClientPath = mainPresenter.VncPath;

            // validate if the file existed
            if (vncClientPath == String.Empty ||
                vncClientPath.Contains("tvnviewer.exe") ||
                File.Exists(vncClientPath) == false)
            {
                // vncviewer.exe
                foreach (String matchPath in Utils.Files.DirSearch(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "vncviewer.exe"))
                {
                    vncClientPath = matchPath;
                    break;
                }

                if (vncClientPath == String.Empty)
                {
                    foreach (String matchPath in Utils.Files.DirSearch(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "vncviewer.exe"))
                    {
                        vncClientPath = matchPath;
                        break;
                    }
                }
            }

            if (vncClientPath == String.Empty)
            {
                MessageBox.Show("VNC executable not found." + Environment.NewLine + "Please install VNC application to use VNC feature.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                vncServerPath = vncClientPath;
            }

            notifyIconServer.Text            = "Vistrol server is offline";
            notifyIconServer.BalloonTipTitle = "Vistrol Server";
            notifyIconServer.BalloonTipIcon  = ToolTipIcon.Info;
            notifyIconServer.Icon            = Properties.Resources.server1;
            notifyIconServer.Visible         = true;
            notifyIconServer.DoubleClick    += notifyIconServer_DoubleClick;

            this.Resize += FormServer_Resize;

            setupDataGrid(dataGridViewUsers, userPresenter.GetUsersTable());
            setupDataGrid(dataGridViewGroup, groupPresenter.GetGroupsTable());
            setupDataGrid(dataGridViewMonitors, monitorPresenter.GetMonitorsTable());
            setupDataGrid(dataGridViewApp, applicationPresenter.GetApplicationTable());
            setupDataGrid(dataGridViewRemote, remoteVncPresenter.GetRemoteVncData());
            setupDataGrid(dataGridVisionInput, visionInputPresenter.GetVisionInputTable());

            // customize for vision control
            dataGridVisionInput.Columns[2].Visible = false;
            dataGridVisionInput.Columns[3].Visible = false;
            dataGridVisionInput.Columns[4].Visible = false;

            textBoxGeneralMin.Text = mainPresenter.PortMin.ToString();
            textBoxGeneralMax.Text = mainPresenter.PortMax.ToString();

            numericUpDownRow.Value = mainPresenter.ScreenRow == 0 ? 1 : mainPresenter.ScreenRow;
            numericUpDownCol.Value = mainPresenter.ScreenColumn == 0 ? 1 : mainPresenter.ScreenColumn;

            refreshGeneralPanel();

            // customization
            if (mainPresenter.PortMin != 0 &&
                mainPresenter.PortMax != 0)
            {
                // start the server automatically
                btnGeneralStart_Click(this, new EventArgs());

                this.WindowState = FormWindowState.Minimized;
            }
            else
            {
                FormLogin formLogin = new FormLogin(USERNAME, PASSWORD);
                System.Windows.Forms.DialogResult result = formLogin.ShowDialog(this);
                while (result != System.Windows.Forms.DialogResult.OK)
                {
                    result = formLogin.ShowDialog(this);
                }
            }
        }