示例#1
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            if (listView_users.SelectedItems.Count == 0)
            {
                // prompt user
                string title     = LanguageINI.GetString("headerSelectUserFromList");
                string msg       = LanguageINI.GetString("lblSelectUserFromList");
                string buttonTxt = LanguageINI.GetString("Ok");
                GUI_Controls.RoboMessagePanel prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_WARNING, msg, title, buttonTxt);
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                prompt.Dispose();
                RoboSep_UserConsole.hideOverlay();
                return;
            }
            SelectedUser = listView_users.SelectedItems[0].Tag as string;
            RoboSep_UserConsole.hideOverlay();
            this.DialogResult = DialogResult.OK;
            this.Close();

            // LOG
            string logMSG = "User " + listView_users.SelectedItems[0].Text + " Selected";

            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
        }
示例#2
0
        private List <string> AskUserToInsertUSBDrive()
        {
            List <string> lstUSBDrives = Utilities.GetUSBDrives();

            if (lstUSBDrives == null)
            {
                return(null);
            }

            if (lstUSBDrives.Count > 0)
            {
                return(lstUSBDrives);
            }

            // show dialog prompting user to insert USB key
            string msg = LanguageINI.GetString("SaveReport");

            GUI_Controls.RoboMessagePanel prompt = new GUI_Controls.RoboMessagePanel(
                RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_INFORMATION, msg, LanguageINI.GetString("headerSaveReport"),
                LanguageINI.GetString("Yes"), LanguageINI.GetString("Cancel"));
            RoboSep_UserConsole.showOverlay();
            prompt.ShowDialog();
            RoboSep_UserConsole.hideOverlay();

            if (prompt.DialogResult != DialogResult.OK)
            {
                prompt.Dispose();
                return(null);
            }
            prompt.Dispose();
            return(AskUserToInsertUSBDrive());
        }
        public void LoadUserToServer(string ActiveUser)
        {
            // LOG
            string logMSG = "Loading user profile";

            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
            // load user from ini
            List <RoboSep_Protocol> tempList = RoboSep_UserDB.getInstance().loadUserProtocols(ActiveUser);

            if (tempList == null)
            {
                // prompt user that no protocols to load
                string           sTitle  = LanguageINI.GetString("headerNoProtocols");
                string           sMsg    = LanguageINI.GetString("msgNoProtocols");
                string           sButton = LanguageINI.GetString("Ok");
                RoboMessagePanel prompt  = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING, sMsg, sTitle, sButton);
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                prompt.Dispose();
                RoboSep_UserConsole.hideOverlay();
                return;
            }

            StartLoadingProtocolsToServer(ActiveUser, tempList);
        }
        private void button_SaveList_Click(object sender, EventArgs e)
        {
            // Check if User list contains atleast 1 protocol (otherwise don't exit screen)
            bool validUser = myUserProtocols.Count > 0;

            if (validUser)
            {
                // save list
                saveUserList();

                // close protocol list and user protocol list
                RoboSep_Protocols.getInstance().UserName = strUserName;
                RoboSep_UserConsole.getInstance().Controls.Add(RoboSep_Protocols.getInstance());
                RoboSep_UserConsole.getInstance().Controls.Remove(this);

                // Update user list
                RoboSep_Protocols.getInstance().LoadUsers();

                // LOG
                string logMSG = "Save List button clicked";
                //GUI_Controls.uiLog.LOG(this, "button_SaveList_Click", GUI_Controls.uiLog.LogLevel.EVENTS, logMSG);
                //  (logMSG);
                LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
            }
            else
            {
                GUI_Controls.RoboMessagePanel prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING,
                                                                                         LanguageINI.GetString("msgValidUser"), LanguageINI.GetString("headerValidUser"), LanguageINI.GetString("Ok"));
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                prompt.Dispose();
                RoboSep_UserConsole.hideOverlay();
            }
        }
示例#5
0
        private bool validateUser()
        {
            string username = textBox_UserName.Text.ToUpper();

            if (username.Length < 5)
            {
                string sTitle = GUI_Controls.UserDetails.getValue("GUI", "headerLoginError3");
                string sMSG   = GUI_Controls.UserDetails.getValue("GUI", "msgLoginError3");
                sMSG = sMSG == null ? "User Name entered is not long enough" : sMSG;
                GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_ERROR,
                                                                                            sMSG, sTitle);
                RoboSep_UserConsole.getInstance().addForm(newPrompt, newPrompt.Offset);
                RoboSep_UserConsole.showOverlay();
                newPrompt.ShowDialog();
                newPrompt.Dispose();
                RoboSep_UserConsole.hideOverlay();
                //MessageBox.Show("User name not long enough");
                return(false);
            }
            for (int i = 0; i < username.Length; i++)
            {
                if (!((int)username[i] >= 65 && (int)username[i] <= 90 || (int)username[i] == 32))
                {
                    string sTitle  = GUI_Controls.UserDetails.getValue("GUI", "headerLoginError");
                    string sMSG    = GUI_Controls.UserDetails.getValue("GUI", "msgLoginError1");
                    string sButton = GUI_Controls.UserDetails.getValue("GUI", "Ok");
                    sMSG = sMSG == null ? "User name should not include numbers, symbols, or punctuation" : sMSG;
                    GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_ERROR,
                                                                                                sMSG, sTitle, sButton);
                    RoboSep_UserConsole.getInstance().addForm(newPrompt, newPrompt.Offset);
                    RoboSep_UserConsole.showOverlay();
                    newPrompt.ShowDialog();
                    newPrompt.Dispose();
                    RoboSep_UserConsole.hideOverlay();
                    //MessageBox.Show("User name should not include symbols or punctuation");
                    return(false);
                }
                if (i < (username.Length - 2))
                {
                    if (username[i] == username[i + 1] && username[i] == username[i + 2])
                    {
                        string sTitle = GUI_Controls.UserDetails.getValue("GUI", "headerLoginError");
                        string sMSG   = GUI_Controls.UserDetails.getValue("GUI", "msgLoginError2");
                        sMSG = sMSG == null ? "Incorrenctly typed User Name" : sMSG;
                        string sButton = GUI_Controls.UserDetails.getValue("GUI", "Ok");
                        GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_ERROR,
                                                                                                    sMSG, sTitle, sButton);
                        RoboSep_UserConsole.getInstance().addForm(newPrompt, newPrompt.Offset);
                        RoboSep_UserConsole.showOverlay();
                        newPrompt.ShowDialog();
                        newPrompt.Dispose();
                        RoboSep_UserConsole.hideOverlay();
                        //MessageBox.Show("Incorrectly typed user name");
                        return(false);
                    }
                }
            }
            return(true);
        }
示例#6
0
        private void showGeneralErrorMessage(string errMsg)
        {
            RoboMessagePanel dlg = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_ERROR,
                                                        errMsg, "Error", LanguageINI.GetString("Ok"));

            RoboSep_UserConsole.showOverlay();
            dlg.ShowDialog();
            dlg.Dispose();
            RoboSep_UserConsole.hideOverlay();
        }
        /*
         * protected override void btn_home_Click(object sender, EventArgs e)
         * {
         *  if (LoadUserRequired && !RoboSep_UserConsole.bIsRunning)
         *  {
         *      // changing profile to a pre-defined protocol list will not
         *      // require loading protocols to server
         *      if (textBox_UserName.Text != "All Human" && textBox_UserName.Text != "All Mouse" && textBox_UserName.Text != "Whole Blood"
         *          && textBox_UserName.Text != "Full List" && textBox_UserName.Text != "USER NAME")
         *      {
         *          LoadUserRequired = false;
         *          LoadUserToServer(textBox_UserName.Text);
         *      }
         *      elseYou go
         *      {
         *          //
         *          //
         *          // Set up for No- All Protocols
         *          // !! REMOVE ALL PROTOCOLS LIST
         *          //
         #if true            // get list for preset
         *          string[] PresetList = RoboSep_ProtocolList.getInstance().LoadPresetList(this.textBox_UserName.Text);
         *          protocolsToLoad = PresetList.Length;
         *
         *          // save list to User1.udb
         *          RoboSep_UserDB.getInstance().XML_SaveUserProfile(this.textBox_UserName.Text, PresetList);
         *
         *          // load user1.udb to server.
         *          myReloadProtocolsThread = new Thread(new ThreadStart(this.ReloadProtocolsThread));
         *          myReloadProtocolsThread.IsBackground = true;
         *          myReloadProtocolsThread.Start();
         *
         *          // set sep-gateway to updating Separator Protocols
         *          // so that we can watch for when it is updated
         *          // (in timer_tick)
         *          SeparatorGateway.GetInstance().separatorUpdating = true;
         *
         *          //Thread.Sleep(SERVER_WAIT_TIME);
         *          // add loop to that polls loading status
         *          LoadUserTimer.Start();
         #else
         *          base.btn_home_Click(sender, e);
         #endif
         *      }
         *  }
         *  else
         *  {
         *      base.btn_home_Click(sender, e);
         *  }
         *
         * }
         */

        private void Prompt_RunInProgress()
        {
            string           sMSG   = LanguageINI.GetString("msgIsRunning");
            RoboMessagePanel prompt = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING, sMSG,
                                                           LanguageINI.GetString("headerIsRunning"), LanguageINI.GetString("Ok"));

            RoboSep_UserConsole.showOverlay();
            prompt.ShowDialog();
            prompt.Dispose();
            RoboSep_UserConsole.hideOverlay();
        }
        public void StartLoadingProtocolsToServer(string ActiveUser, List <RoboSep_Protocol> tempList)
        {
            if (tempList == null)
            {
                return;
            }

            // LOG
            string logMSG = "Start thread for loading profile";

            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
            try
            {
                RoboSep_UserConsole.strCurrentUser = ActiveUser;// textBox_UserName.Text;
                UserNameHeader.Text = ActiveUser;

                string[] sProtocols = new string[tempList.Count];
                for (int i = 0; i < tempList.Count; i++)
                {
                    sProtocols[i] = tempList[i].Protocol_FileName;
                }

                // save over user1.udb
                RoboSep_UserDB.getInstance().XML_SaveUserProfile(ActiveUser, sProtocols);
                protocolsToLoad = sProtocols.Length;

                // Reload protocols with SeparatorGateway using a thread
                myReloadProtocolsThread = new Thread(new ThreadStart(this.ReloadProtocolsThread));
                myReloadProtocolsThread.IsBackground = true;
                myReloadProtocolsThread.Start();

                // set sep-gateway to updating Separator Protocols
                // so that we can watch for when it is updated
                // (in timer_tick)
                SeparatorGateway.GetInstance().separatorUpdating = true;

                string sMSG   = LanguageINI.GetString("msgLoadingProtocols");
                string sTitle = LanguageINI.GetString("headerLoadingUserProtocols");
                loading = new RoboMessagePanel5(RoboSep_UserConsole.getInstance(), sTitle, sMSG, GUI_Controls.GifAnimationMode.eUploadingMultipleFiles);
                RoboSep_UserConsole.showOverlay();
                loading.Show();
                //Thread.Sleep(SERVER_WAIT_TIME);
                // add loop to that polls loading status
                LoadUserTimer.Start();
            }
            catch (Exception ex)
            {
                // LOG
                logMSG = "Failed to save user to server";

                LogFile.AddMessage(System.Diagnostics.TraceLevel.Error, logMSG);
            }
        }
示例#9
0
        private DialogResult confirmSpecificProtocol(SharingProtocol sharingProtocol)
        {
            string logMSG;

            if (sharingProtocol == null)
            {
                logMSG = "confirmSpecificProtocol called. Invalid input parameter 'sharingProtocol' is null.";

                LogFile.AddMessage(System.Diagnostics.TraceLevel.Verbose, logMSG);
                return(DialogResult.Cancel);
            }

            ArrayList sharingWith = sharingProtocol.SharingWith;

            if (sharingWith == null)
            {
                logMSG = "confirmSpecificProtocol called. Invalid input parameter 'sharingProtocol.SharingWith' is null.";
                LogFile.AddMessage(System.Diagnostics.TraceLevel.Verbose, logMSG);
                return(DialogResult.Cancel);
            }

            int initQuadrantIndex = sharingProtocol.InitQuadrant;

            //build message
            string quadrantsLabel = "Q" + (initQuadrantIndex + 1);

            for (int i = 0; i < sharingWith.Count; i++)
            {
                if (i >= sharingWith.Count - 1)
                {
                    quadrantsLabel += " and Q" + sharingWith[i];
                }
                else
                {
                    quadrantsLabel += ", Q" + sharingWith[i];
                }
            }

            //ask the user
            string sMSG = LanguageINI.GetString("QS1") + " " + quadrantsLabel + " " + LanguageINI.GetString("QS2") + " "
                          + sharingProtocol.Name + " " + LanguageINI.GetString("QS3");
            RoboMessagePanel messageDialog = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_QUESTION, sMSG,
                                                                  LanguageINI.GetString("headerQS"), LanguageINI.GetString("Yes"), LanguageINI.GetString("No"));

            RoboSep_UserConsole.showOverlay();
            DialogResult result = messageDialog.ShowDialog();

            RoboSep_UserConsole.hideOverlay();
            messageDialog.Dispose();
            return(result);//messageDialog.DialogResult;
        }
示例#10
0
        private void hex_protocols_Click(object sender, EventArgs e)
        {
            // check if any protocols are selected
            int[] CurrentQuadrants = RoboSep_RunSamples.getInstance().iSelectedProtocols;
            if (CurrentQuadrants.Length > 0)
            {
                // prompt if user is sure they want to manage protocols if all protocol selections are removed
                string           msg    = LanguageINI.GetString("msgManageProtocols");
                RoboMessagePanel prompt = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING, msg,
                                                               LanguageINI.GetString("headerManageProtocols"), LanguageINI.GetString("Ok"), LanguageINI.GetString("Cancel"));
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                RoboSep_UserConsole.hideOverlay();

                if (prompt.DialogResult != DialogResult.OK)
                {
                    prompt.Dispose();
                    return;
                }
                prompt.Dispose();
            }

            // remove all currently selected protocols
            for (int i = 0; i < CurrentQuadrants.Length; i++)
            {
                RoboSep_RunSamples.getInstance().CancelQuadrant(CurrentQuadrants[i]);
            }

            RoboSep_UserConsole.getInstance().SuspendLayout();
            RoboSep_ProtocolList myProtocolsListPage = RoboSep_ProtocolList.getInstance();

            if (myProtocolsListPage.IsInitialized)
            {
                myProtocolsListPage.ReInitialized();
            }

            myProtocolsListPage.Location    = new Point(0, 0);
            myProtocolsListPage.strUserName = RoboSep_UserConsole.strCurrentUser;
            RoboSep_UserConsole.getInstance().Controls.Add(myProtocolsListPage);
            RoboSep_UserConsole.ctrlCurrentUserControl = myProtocolsListPage;

            closeHomeWindow();

            myProtocolsListPage.BringToFront();
            // LOG
            string logMSG = "Protocols button clicked";

            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
        }
示例#11
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            string logMSG = "Saving user preferences for '" + userName + "'";

            //  (logMSG);
            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
            getPreferences(dictUserPreferencesFromConfig, dictUserPreferences);
            getPreferences(dictDevicePreferencesFromConfig, dictDevicePreferences);

            if (bIsNewUser == true)
            {
                if (GetUserPreferences != null)
                {
                    GetUserPreferences(this, new EventArgs());
                }
            }
            else
            {
                string            title  = LanguageINI.GetString("headerSavingInProgress");
                RoboMessagePanel4 prompt = new GUI_Controls.RoboMessagePanel4(RoboSep_UserConsole.getInstance(), title, 500, 20);
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();

                RoboSep_UserConsole.hideOverlay();

                // update the user preferences file for old user
                UserDetails.SaveUserPreferences(userName, dictUserPreferences, dictDevicePreferences);

                // reload the user preferences to refresh the changes
                RoboSep_UserDB.getInstance().loadCurrentUserPreferences(userName);

                prompt.Dispose();
            }

            this.SendToBack();

            if (ClosingUserPreferencesApp != null)
            {
                ClosingUserPreferencesApp(this, new EventArgs());
            }

            this.Hide();
        }
 private void linkLabel_Click(object sender, EventArgs e)
 {
     if (RoboSep_UserConsole.bIsRunning)
     {
         RoboMessagePanel prompt = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING,
                                                        LanguageINI.GetString("tabHelpVideoCannotBePlayed"), LanguageINI.GetString("Warning"), LanguageINI.GetString("Ok"));
         RoboSep_UserConsole.showOverlay();
         prompt.ShowDialog();
         prompt.Dispose();
         RoboSep_UserConsole.hideOverlay();
     }
     else
     {
         LinkLabel.Link link = (sender as LinkLabel).Links[0] as LinkLabel.Link;
         string         path = link.LinkData as string;
         mediaPlayer.URL = @path;
         mediaPlayer.Ctlcontrols.play();
     }
 }
        public bool createDropDown(out string saveString)
        {
            // LOG
            string logMSG = "Selecting User from Dropdown";

            //GUI_Controls.uiLog.LOG(this, "dropDownMenu_Click", GUI_Controls.uiLog.LogLevel.EVENTS, logMSG);

            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
            // Create list of names, add them to an auto complete source
            List <string> UserNames = new List <string>();

            for (int i = 0; i < textBox_UserName.AutoCompleteCustomSource.Count; i++)
            {
                UserNames.Add(textBox_UserName.AutoCompleteCustomSource[i]);
            }

            // Show Overlay window
            RoboSep_UserConsole.showOverlay();
            RoboSep_UserConsole.getInstance().frmOverlay.BringToFront();

            // create new user select control form
            IniFile         LanguageINI    = GUI_Console.RoboSep_UserConsole.getInstance().LanguageINI;
            string          windowTitle    = LanguageINI.GetString("lblSelectUser");
            Form_UserSelect UserSelectMenu = new Form_UserSelect(UserNames, windowTitle);

            UserSelectMenu.ShowDialog();
            // check to see if user name was selected
            string temp = UserSelectMenu.User;

            saveString = "????";
            if (temp != null && temp != string.Empty)
            {
                saveString = temp;
            }


            bool userSelected = UserSelectMenu.DialogResult == DialogResult.OK;

            UserSelectMenu.Dispose();

            return(userSelected);
        }
示例#14
0
 private void Login()
 {
     if (validateUser())
     {
         bool[] userType = new bool[3] {
             checkBox_standardUser.Check, checkBox_maintenanceUser.Check, checkBox_superUser.Check
         };
         for (int i = 0; i < 3; i++)
         {
             if (userType[i])
             {
                 if (textBox_servicePassword.Text == Passwords[i])
                 {
                     GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_INFORMATION,
                                                                                                 "Success, you have entered the right password!", "Password Correct");
                     RoboSep_UserConsole.getInstance().addForm(newPrompt, newPrompt.Offset);
                     RoboSep_UserConsole.showOverlay();
                     newPrompt.ShowDialog();
                     RoboSep_UserConsole.hideOverlay();
                     if (newPrompt.DialogResult == DialogResult.OK)
                     {
                         ActiveControl = textBox_servicePassword;
                     }
                     newPrompt.Dispose();
                 }
                 else
                 {
                     GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_ERROR,
                                                                                                 "Incorrect password, Password is case sensetive", "Incorrect Password");
                     RoboSep_UserConsole.showOverlay();
                     newPrompt.ShowDialog();
                     RoboSep_UserConsole.hideOverlay();
                     if (newPrompt.DialogResult == DialogResult.OK)
                     {
                         ActiveControl = textBox_servicePassword;
                     }
                     newPrompt.Dispose();
                 }
             }
         }
     }
 }
        private bool checkForSelectedProtocols( )
        {
            // check if Protocols have been selected on Run Samples page
            // can not load protocols from multiple users
            if (RoboSep_RunSamples.getInstance().iSelectedProtocols.Length > 0)
            {
                // set up message prompt
                string sMSG = LanguageINI.GetString("msgChangeUser");

                RoboMessagePanel prompt = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING, sMSG,
                                                               LanguageINI.GetString("headerChangeUsr"), LanguageINI.GetString("Ok"), LanguageINI.GetString("Cancel"));
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                RoboSep_UserConsole.hideOverlay();

                if (prompt.DialogResult == DialogResult.OK)
                {
                    int[] CurrentlySelectedProtocols = RoboSep_RunSamples.getInstance().iSelectedProtocols;
                    // remove protocols from sample list
                    for (int i = 0; i < CurrentlySelectedProtocols.Length; i++)
                    {
                        int Q = CurrentlySelectedProtocols[i];
                        RoboSep_RunSamples.getInstance().CancelQuadrant(Q);

                        // LOG
                        string LOGmsg = "Changing User and removing all selected protocols from current run";
                        //GUI_Controls.uiLog.LOG(this, "textBox_UserName_Enter", GUI_Controls.uiLog.LogLevel.EVENTS, LOGmsg);
                        //  (LOGmsg);
                        LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, LOGmsg);
                    }
                    prompt.Dispose();
                    return(false);
                }
                prompt.Dispose();
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#16
0
        private void hex_Users_Click(object sender, EventArgs e)
        {
            // check if any protocols are selected
            int[] CurrentQuadrants = RoboSep_RunSamples.getInstance().iSelectedProtocols;
            if (CurrentQuadrants.Length > 0)
            {
                // prompt if user is sure they want to switch users if
                // all protocol selections are removed
                string           msg    = LanguageINI.GetString("msgChangeUser");
                RoboMessagePanel prompt = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING, msg,
                                                               LanguageINI.GetString("headerChangeUsr"), LanguageINI.GetString("Ok"), LanguageINI.GetString("Cancel"));
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                RoboSep_UserConsole.hideOverlay();

                if (prompt.DialogResult != DialogResult.OK)
                {
                    prompt.Dispose();
                    return;
                }
                prompt.Dispose();
            }

            // remove all currently selected protocols
            for (int i = 0; i < CurrentQuadrants.Length; i++)
            {
                RoboSep_RunSamples.getInstance().CancelQuadrant(CurrentQuadrants[i]);
            }

            // change to robosep user select window
            RoboSep_UserConsole.getInstance().SuspendLayout();
            RoboSep_UserSelect usrSelect = new RoboSep_UserSelect();

            RoboSep_UserConsole.getInstance().Controls.Add(usrSelect);
            RoboSep_UserConsole.ctrlCurrentUserControl = usrSelect;

            usrSelect.BringToFront();
            usrSelect.Focus();
        }
示例#17
0
        private void b_Click(object sender, EventArgs e)
        {
            GUI_Controls.GUIButton b = sender as GUI_Controls.GUIButton;
            if (b == null)
            {
                return;
            }

            string msg = b.Tag as string;

            if (string.IsNullOrEmpty(msg))
            {
                return;
            }

            GUI_Controls.RoboMessagePanel prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_INFORMATION, msg, String.Empty);
            RoboSep_UserConsole.showOverlay();
            prompt.ShowDialog();
            prompt.Dispose();
            RoboSep_UserConsole.hideOverlay();
            return;
        }
        private void button_CloneUser_Click(object sender, EventArgs e)
        {
            // Get list of user names
            List <string> UserNames = new List <string>();

            for (int i = 0; i < Users.Count; i++)
            {
                UserNames.Add(Users[i].Username);
            }

            // Show Overlay window
            RoboSep_UserConsole.showOverlay();
            RoboSep_UserConsole.getInstance().frmOverlay.BringToFront();

            // create new user select control form
            IniFile LanguageINI = GUI_Console.RoboSep_UserConsole.getInstance().LanguageINI;
            string  windowTitle = LanguageINI.GetString("lblSelectUserToClone");

            Form_UserSelect UserSelectMenu = new Form_UserSelect(UserNames, windowTitle);

            UserSelectMenu.ShowDialog();

            RoboSep_UserConsole.hideOverlay();
            if (UserSelectMenu.DialogResult != DialogResult.OK)
            {
                UserSelectMenu.Dispose();
                ResumeLayout();
                return;
            }

            // check to see if user name was selected
            string selectedUser = UserSelectMenu.User;

            UserSelectMenu.Dispose();
            if (selectedUser == null && selectedUser == string.Empty)
            {
                return;
            }

            // Show Overlay window
            RoboSep_UserConsole.showOverlay();

            Form_UserLoginNew NewUserForm = new Form_UserLoginNew(UserNames, null, true);

            NewUserForm.ShowDialog();
            string newUserLoginID = "";

            if (NewUserForm.DialogResult == DialogResult.OK)
            {
                newUserLoginID = (NewUserForm.NewUserLoginID);

                CloneUser(newUserLoginID, selectedUser);

                // update the list
                UpdateUserProfiles();

                // ensure the new user is visible
                ListViewItem lvItem = lvUser.FindItemWithText(newUserLoginID);
                if (lvItem != null)
                {
                    lvItem.Selected = true;
                    lvUser.EnsureVisible(lvItem.Index);
                }

                lvUser.UpdateScrollbar();
            }
            NewUserForm.Dispose();
            RoboSep_UserConsole.hideOverlay();

            ResumeLayout();

            // LOG
            string logMSG = "Opening user screen to select user to be cloned.";

            //  (logMSG);
            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
        }
        private void button_NewUser_Click(object sender, EventArgs e)
        {
            SuspendLayout();

            bool          bNewUser           = true;
            string        sUserNameParameter = string.Empty;
            Button_Circle btn = sender as Button_Circle;

            if (btn != null)
            {
                sUserNameParameter = btn.Tag as string;
                if (!string.IsNullOrEmpty(sUserNameParameter))
                {
                    bNewUser = false;
                }
            }

            // create new user select control form
            List <string> UserNames = new List <string>();

            for (int i = 0; i < Users.Count; i++)
            {
                string name = Users[i].Username;
                UserNames.Add(name);
            }

            // Show Overlay window
            RoboSep_UserConsole.showOverlay();

            Form_UserLoginNew NewUserForm = new Form_UserLoginNew(UserNames, sUserNameParameter, bNewUser);

            NewUserForm.ShowDialog();
            string newUserLoginID = "";

            if (NewUserForm.DialogResult == DialogResult.OK)
            {
                newUserLoginID = (NewUserForm.NewUserLoginID);

                // update the list
                UpdateUserProfiles();

                // ensure the new user is visible
                ListViewItem lvItem = lvUser.FindItemWithText(newUserLoginID);
                if (lvItem != null)
                {
                    lvItem.Selected = true;
                    lvUser.EnsureVisible(lvItem.Index);
                }

                lvUser.UpdateScrollbar();
            }

            NewUserForm.Dispose();

            RoboSep_UserConsole.hideOverlay();

            ResumeLayout();

            // LOG
            string logMSG = "Opening new user login screen";

            //  (logMSG);
            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
        }
        private bool ValidateName(string iLoginID)
        {
            if (string.IsNullOrEmpty(iLoginID))
            {
                return(false);
            }

            string newLoginID = iLoginID.Trim();

            char[] invalidCharacters = new char[] { '~', '[', ']', '{', '}', '<', '>', '&', '/', '\\', '\'', '=', '~' };
            int    nIndex            = -1;

            // Check for duplicate
            if (slistUserNames.Contains(newLoginID))
            {
                // prompt user
                string sMsg    = LanguageINI.GetString("msgUserOccupied");
                string sHeader = LanguageINI.GetString("headerUserInvalid");
                string sButton = LanguageINI.GetString("Ok");
                GUI_Controls.RoboMessagePanel prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_ERROR, sMsg, sHeader, sButton);
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                prompt.Dispose();
                RoboSep_UserConsole.hideOverlay();
                return(false);
            }
            else if ((nIndex = newLoginID.IndexOfAny(invalidCharacters)) >= 0)
            {
                string sInvalidCharacter = newLoginID.Substring(nIndex, 1);

                // prompt user
                string sTemp   = LanguageINI.GetString("msgUserInvalidCharacters");
                string sMsg    = String.Format(sTemp, sInvalidCharacter);
                string sHeader = LanguageINI.GetString("headerUserInvalid");
                string sButton = LanguageINI.GetString("Ok");
                GUI_Controls.RoboMessagePanel prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_ERROR, sMsg, sHeader, sButton);
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                prompt.Dispose();
                RoboSep_UserConsole.hideOverlay();
                return(false);
            }
            else
            {
                string[] aPresetNames = RoboSep_UserDB.getInstance().GetProtocolPresetNames();
                if (aPresetNames != null && aPresetNames.Length > 0)
                {
                    string sName = Array.Find(aPresetNames, (x => { return(!string.IsNullOrEmpty(x) && x.ToLower() == newLoginID.ToLower()); }));
                    if (!string.IsNullOrEmpty(sName))
                    {
                        // prompt user
                        string sMsg    = LanguageINI.GetString("msgNameUsedByPresets");
                        string sHeader = LanguageINI.GetString("headerUserInvalid");
                        string sButton = LanguageINI.GetString("Ok");
                        GUI_Controls.RoboMessagePanel prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_ERROR, sMsg, sHeader, sButton);
                        RoboSep_UserConsole.showOverlay();;
                        prompt.ShowDialog();
                        prompt.Dispose();
                        RoboSep_UserConsole.hideOverlay();
                        return(false);
                    }
                }
            }
            return(true);
        }
示例#21
0
        private void button_SaveReports_Click(object sender, EventArgs e)
        {
            string msg = "", title = "";

            GUI_Controls.RoboMessagePanel prompt = null;

            int[] arrItemsChecked = GetItemsChecked();
            if (arrItemsChecked == null || arrItemsChecked.Length == 0)
            {
                msg    = LanguageINI.GetString("msgSelectReports");
                title  = LanguageINI.GetString("headerSelectReports");
                prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING, msg, title, LanguageINI.GetString("Ok"));
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                RoboSep_UserConsole.hideOverlay();
                prompt.Dispose();
                return;
            }

            List <string> lstUSBDrives = AskUserToInsertUSBDrive();

            if (lstUSBDrives == null || lstUSBDrives.Count == 0)
            {
                return;
            }

            string USBDrive = "";

            // search for directory
            foreach (string drive in lstUSBDrives)
            {
                if (Directory.Exists(drive))
                {
                    USBDrive = drive;
                    break;
                }
            }

            if (string.IsNullOrEmpty(USBDrive))
            {
                msg    = LanguageINI.GetString("msgUSBFail");
                prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_ERROR, msg, LanguageINI.GetString("headerSaveUSB"), LanguageINI.GetString("Ok"));
                //RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                RoboSep_UserConsole.hideOverlay();

                //GUI_Controls.uiLog.LOG(this, "button_SaveReports_Click", GUI_Controls.uiLog.LogLevel.WARNING, "USB drive not detected");
                LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, "USB drive not detected");
                prompt.Dispose();
                return;
            }

            // see if save target directory exist
            string systemPath  = RoboSep_UserDB.getInstance().sysPath;
            string reportsPath = systemPath + "reports\\";

            if (!Directory.Exists(reportsPath))
            {
                Directory.CreateDirectory(reportsPath);
            }

            string      sTitle       = LanguageINI.GetString("headerSaveReportUSB");
            FileBrowser SelectFolder = new FileBrowser(RoboSep_UserConsole.getInstance(), sTitle, USBDrive, "");

            SelectFolder.ShowDialog();
            if (SelectFolder.DialogResult != DialogResult.Yes)
            {
                RoboSep_UserConsole.hideOverlay();
                SelectFolder.Dispose();
                return;
            }

            string Target = SelectFolder.Target;

            List <string> lstSourceFiles = new List <string>();

            // copy all selected folders to Target Directory
            FileInfo selectedReport;
            int      nIndex = 0;

            for (int i = 0; i < arrItemsChecked.Length; i++)
            {
                int ReportNumber = arrItemsChecked[i];

                // open file browser to allow user to select specific file location
                selectedReport = myReportFiles[ReportNumber];

                nIndex = selectedReport.Name.LastIndexOf('.');
                if (nIndex < 0)
                {
                    return;
                }

                string sFileName = selectedReport.Name.Substring(0, nIndex);
                sFileName += ".pdf";

                string sFullFileName = selectedReport.DirectoryName;
                if (sFullFileName.LastIndexOf('\\') != sFullFileName.Length - 1)
                {
                    sFullFileName += "\\";
                }

                sFullFileName += sFileName;
                if (File.Exists(sFullFileName))
                {
                    lstSourceFiles.Add(sFullFileName);
                }
            }

            // Copy files
            SelectFolder.ShowProgressBarWhileCopying = true;
            SelectFolder.CopyToTargetDirEx(lstSourceFiles.ToArray(), Target);
            SelectFolder.Dispose();
        }
示例#22
0
        private void LaunchAdobe(string sFullPdfFileName)
        {
            if (string.IsNullOrEmpty(sFullPdfFileName))
            {
                return;
            }

            string errMsg;

            if (File.Exists(sFullPdfFileName))
            {
                try
                {
                    var adobe = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Classes").OpenSubKey("acrobat").OpenSubKey("shell").OpenSubKey("open").OpenSubKey("command");
                    if (adobe == null)
                    {
                        errMsg = String.Format("Failed to view report because it cannot find the registry key of acrobat reader.");
                        LogFile.AddMessage(System.Diagnostics.TraceLevel.Warning, errMsg);
                        return;
                    }
                    var    pathAdobe = adobe.GetValue("");
                    string path      = pathAdobe as string;
                    if (string.IsNullOrEmpty(path))
                    {
                        // Show message that Adobe has not been installed
                        IniFile          LanguageINI = RoboSep_UserConsole.getInstance().LanguageINI;
                        string           sMSG        = LanguageINI.GetString("msgViewReportFailed");
                        RoboMessagePanel prompt      = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_ERROR, sMSG,
                                                                            LanguageINI.GetString("headerViewReportFailed"), LanguageINI.GetString("Ok"));
                        RoboSep_UserConsole.showOverlay();
                        prompt.ShowDialog();
                        RoboSep_UserConsole.hideOverlay();
                        errMsg = String.Format("Failed to view report because it cannot find the registry key of acrobat reader.");
                        LogFile.AddMessage(System.Diagnostics.TraceLevel.Warning, errMsg);
                        prompt.Dispose();
                        return;
                    }

                    string pattern = @"\b[a-zA-Z]:[\\/]([ ()._a-zA-Z0-9]+[\\/]?)*([_a-zA-Z0-9]+\.[_a-zA-Z0-9]{0,3})?";
                    Match  m       = Regex.Match(path, pattern, RegexOptions.Singleline);
                    if (!m.Success)
                    {
                        // Show message that Adobe has not been installed
                        IniFile          LanguageINI = RoboSep_UserConsole.getInstance().LanguageINI;
                        string           sMSG        = LanguageINI.GetString("msgViewReportFailed2");
                        RoboMessagePanel prompt      = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_ERROR, sMSG,
                                                                            LanguageINI.GetString("headerViewReportFailed"), LanguageINI.GetString("Ok"));
                        RoboSep_UserConsole.showOverlay();
                        prompt.ShowDialog();
                        RoboSep_UserConsole.hideOverlay();
                        errMsg = String.Format("Failed to view report because it cannot the directory of acrobat reader.");
                        LogFile.AddMessage(System.Diagnostics.TraceLevel.Warning, errMsg);
                        prompt.Dispose();
                        return;
                    }

                    string sZoom = GUIini.IniReadValue("Report", "DefaultPdfZoomPercent", DefaultPdfZoomPercent);
                    if (string.IsNullOrEmpty(sZoom))
                    {
                        errMsg = String.Format("Failed to view report because DefaultPdfZoomPercent is not configured in GUI.ini file.");
                        LogFile.AddMessage(System.Diagnostics.TraceLevel.Warning, errMsg);
                        return;
                    }
                    int zoom;
                    if (!int.TryParse(sZoom.Trim(), out zoom))
                    {
                        errMsg = String.Format("Failed to view report because DefaultPdfZoomPercent cannot be converted to a number, it is not configured properly in GUI.ini file.");
                        LogFile.AddMessage(System.Diagnostics.TraceLevel.Warning, errMsg);
                        return;
                    }

                    // Check range
                    if (zoom < minPdfZoomPercent)
                    {
                        zoom = minPdfZoomPercent;
                    }

                    if (zoom > maxPdfZoomPercent)
                    {
                        zoom = maxPdfZoomPercent;
                    }

                    string   temp     = String.Format("zoom={0}=OpenActions", zoom);
                    string   param    = "/A \"" + temp + "\" " + sFullPdfFileName;
                    FileInfo fileInfo = new FileInfo(m.Value);

                    System.Diagnostics.Process.Start(fileInfo.Name, param);
                }
                catch (Win32Exception ex)
                {
                    errMsg = String.Format("Failed to view report. Exception: {0}", ex.Message);
                    LogFile.AddMessage(System.Diagnostics.TraceLevel.Warning, errMsg);
                }
            }
        }
示例#23
0
        private void ViewReport2()
        {
            int[] arrItemsChecked = GetItemsChecked();
            if (arrItemsChecked == null || arrItemsChecked.Length != 1)
            {
                return;
            }

            int index = arrItemsChecked[0];

            FileInfo fInfo = new FileInfo(myReportFiles[index].FullName);

            if (fInfo == null)
            {
                return;
            }

            int nIndex = fInfo.Name.LastIndexOf('.');

            if (nIndex < 0)
            {
                return;
            }

            string sFileName    = fInfo.Name.Substring(0, nIndex);
            string sXmlFileName = sFileName + ".xml";
            string sPdfFileName = sFileName + ".pdf";

            sFileName += ".pdf";

            string sFullFileName = fInfo.DirectoryName;

            if (sFullFileName.LastIndexOf('\\') != sFullFileName.Length - 1)
            {
                sFullFileName += "\\";
            }

            string sFullPdfFileName = sFullFileName + sPdfFileName;

            // Generate PDF file if not created
            if (!File.Exists(sFullPdfFileName) == true)
            {
                string sMsg    = LanguageINI.GetString("msgGeneratingReport");
                string sHeader = LanguageINI.GetString("headerGeneratingReport");
                WaitingMSG = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_INFORMATION, sMsg, sHeader, true, false);
                RoboSep_UserConsole.showOverlay();
                WaitingMSG.Show();

                string   sFullXmlFileName = sFullFileName + sXmlFileName;
                string[] aFileNames       = new string[] { sFullXmlFileName, sFullPdfFileName };

                BackgroundWorker bwGenerateReport = new BackgroundWorker();
                bwGenerateReport.WorkerSupportsCancellation = true;

                // Attach the event handlers
                bwGenerateReport.DoWork             += new DoWorkEventHandler(bwGenerateReport_DoWork);
                bwGenerateReport.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwGenerateReport_RunWorkerCompleted);

                // Kick off the Async thread
                bwGenerateReport.RunWorkerAsync(aFileNames);
            }
            else
            {
                LaunchAdobe(sFullPdfFileName);
            }
        }
示例#24
0
        private bool querySpecificProtocol(QuadrantSelectionDialog.QuadrantSelectionState[] QStates, SharingProtocol sharer)
        {
            string logMSG;

            if (QStates == null)
            {
                logMSG = "querySpecificProtocol called. Invalid input parameter 'QStates' is null.";
                LogFile.AddMessage(System.Diagnostics.TraceLevel.Verbose, logMSG);
                return(false);
            }

            DialogResult result = DialogResult.Retry;

            bool[] QuadrantStatus = null;

            //error checking case
            while (result == DialogResult.Retry)
            {
                QuadrantSelectionDialog dlg = new QuadrantSelectionDialog(QStates[0], QStates[1],
                                                                          QStates[2], QStates[3]);
                dlg.Location = RoboSep_UserConsole.getInstance().Location;
                RoboSep_UserConsole.showOverlay();
                result = dlg.ShowDialog();

                RoboSep_UserConsole.hideOverlay();
                if (result == DialogResult.OK)
                {
                    QuadrantStatus = dlg.getQuadrantSelectionStatus();
                    //error check here

                    /*
                     * if (!checkValidCombo(QStates, QuadrantStatus))
                     * {
                     *  //error message
                     *  RoboMessagePanel errorPrompt = new RoboMessagePanel(RoboSep_UserConsole.getInstance(),  MessageIcon.MBICON_ERROR,
                     *      LanguageINI.GetString("msgOverload"), LanguageINI.GetString("Error"), LanguageINI.GetString("Ok"));
                     *  RoboSep_UserConsole.showOverlay();
                     *  errorPrompt.ShowDialog();
                     *  RoboSep_UserConsole.hideOverlay();
                     *  errorPrompt.Dispose();
                     *  result = DialogResult.Retry;
                     * }
                     */
                }
                dlg.Dispose();
            }


            //redo loop if cancel
            if (result == DialogResult.Cancel)
            {
                return(false);
            }
            else
            {
                //Done was pressed
                //don't set isSharing if nothing is selected
                //remove translation (include 2nd Q...) if not selected

                bool selected = false;

                //for special case all 4 the same
                SharingProtocol nextSharer = null;

                for (int quad = 0; quad < 4; ++quad)
                {
                    //this check makes sure k is initial quadrant of protocol
                    if (quad < QStates.Length && QStates[quad] == QuadrantSelectionDialog.QuadrantSelectionState.ENABLED)
                    {
                        System.Diagnostics.Debug.WriteLine("+++++++++++++++++++++++" + quad + " "
                                                           + QuadrantStatus[quad] + " "
                                                           + nextSharer + " ");
                        if (quad < QuadrantStatus.Length && QuadrantStatus[quad])
                        {
                            selected = true;
                        }
                        else
                        {
                            //if a quadrant is not selected
                            //do not translate quadrants with the same protocol index
                            if (sharedSectorsProtocolIndex != null && quad < sharedSectorsProtocolIndex.Length)
                            {
                                removeSharingWithProtocolIndex(sharer, sharedSectorsProtocolIndex[quad]);
                            }

                            int nIndex = 0;
                            if (nextSharer == null)
                            {
                                if (quad < sharedSectorsProtocolIndex.Length)
                                {
                                    nIndex = sharedSectorsProtocolIndex[quad];
                                    if (0 <= nIndex && nIndex < myAllProtocols.Length)
                                    {
                                        nextSharer = myAllProtocols[nIndex];
                                    }
                                }
                            }
                            else
                            {
                                nextSharer.SharingWith.Add((quad + 1));
                                nIndex = sharedSectorsProtocolIndex[quad];
                                SharingProtocol leechProtocol = null;
                                if (0 <= nIndex && nIndex < myAllProtocols.Length)
                                {
                                    leechProtocol = myAllProtocols[nIndex];
                                }

                                //Now Fill in current protocol's leeching info

                                if (leechProtocol != null)
                                {
                                    int quadrants = leechProtocol.Quadrants;
                                    int translate = nextSharer.InitQuadrant + 1;
                                    for (int k = 0; k < quadrants; k++)
                                    {
                                        if (0 <= (leechProtocol.InitQuadrant + k) && (leechProtocol.InitQuadrant + k) < sharedSectorsTranslation.Length)
                                        {
                                            sharedSectorsTranslation[leechProtocol.InitQuadrant + k] = translate + k;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                //isSharing only if something is selected
                if (selected)
                {
                    isSharing = true;
                }
            }
            return(true);
        }
        private bool LoadPicture(string[] drives)
        {
            if (drives == null)
            {
                return(false);
            }


            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, "Report SysPath: " + systemPath);
            //systemPath = @"C:\Program Files (x86)\STI\RoboSep\";

            string IconsPath = systemPath + "images\\";

            if (!Directory.Exists(IconsPath))
            {
                Directory.CreateDirectory(IconsPath);
            }

            string TempPath = systemPath + "temp\\";

            if (!Directory.Exists(TempPath))
            {
                Directory.CreateDirectory(TempPath);
            }

            // Check if there is any previous images
            if (tempUser.ImageIcon != null)
            {
                LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, "User has already load an image");
                if (tempUser.TempImageIconPath != null)
                {
                    LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, "Temporary image file location: " + tempUser.TempImageIconPath);
                }

                // Sunny to do
                // set up message prompt
                string sMSG  = LanguageINI.GetString("lblPreviousImageLoaded");;
                string sMSG2 = LanguageINI.GetString("lblOverwritePreviousImage");
                sMSG += sMSG2;
                RoboMessagePanel prompt = new RoboMessagePanel(this, MessageIcon.MBICON_WARNING, sMSG,
                                                               LanguageINI.GetString("Warning"), LanguageINI.GetString("Yes"), LanguageINI.GetString("No"));
                RoboSep_UserConsole.showOverlay();

                //prompt user
                prompt.ShowDialog();
                RoboSep_UserConsole.hideOverlay();

                if (prompt.DialogResult != DialogResult.OK)
                {
                    prompt.Dispose();
                    return(false);
                }
                prompt.Dispose();
                try
                {
                    // Remove the temporary directory and its contents
                    Utilities.RemoveTempFileDirectory(tempUser.TempImageIconPath);
                }
                catch (Exception ex)
                {
                    // LOG
                    LogFile.LogException(System.Diagnostics.TraceLevel.Error, ex);
                }

                // Clear the previous image info
                tempUser.TempImageIconPath = "";
                tempUser.ImageIcon         = null;
            }

            // get the default image directory
            string sDefaultImgDirectory = String.Empty;
            string sTempImgDirectory    = GUIini.IniReadValue("General", "DefaultUserHDImageDirectory", DefaultUserHDImageDirectory);

            sTempImgDirectory = Utilities.RemoveIllegalCharsInDirectory(sTempImgDirectory);

            DriveInfo d = new DriveInfo(sTempImgDirectory);

            if (d.IsReady)
            {
                string        sName    = d.Name;
                List <string> lstDrive = new List <string>(drives);
                string        sDrive   = lstDrive.Find(x => { return(!string.IsNullOrEmpty(x) && x.ToLower() == sName.ToLower()); });
                if (!string.IsNullOrEmpty(sDrive))
                {
                    if (Directory.Exists(sTempImgDirectory))
                    {
                        sDefaultImgDirectory = sTempImgDirectory;
                    }
                }
            }

            if (string.IsNullOrEmpty(sDefaultImgDirectory))
            {
                // search for directory
                string[] dirs     = drives;
                int      dirIndex = -1;
                for (int i = 0; i < dirs.Length; i++)
                {
                    if (Directory.Exists(dirs[i]))
                    {
                        dirIndex             = i;
                        sDefaultImgDirectory = dirs[dirIndex];
                        break;
                    }
                }
            }

            if (!string.IsNullOrEmpty(sDefaultImgDirectory))
            {
                string      sTitle = LanguageINI.GetString("headerSelectImageFile");
                FileBrowser fb     = new FileBrowser(RoboSep_UserConsole.getInstance(), sTitle, sDefaultImgDirectory, IconsPath,
                                                     new string[] { ".jpg", ".jpeg", ".png", ".tga", ".bmp" }, FileBrowser.BrowseResult.SelectFile);
                fb.ShowDialog();
                // make sure that file browser finished properly
                if (fb.DialogResult == DialogResult.OK)
                {
                    LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, "File Browser result: OK!!");
                    // store target file path
                    string fileTarget = fb.Target;

                    LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, "File target = " + fileTarget);
                    // generate icon graphic
                    string IconPath = GenerateProfileIcon(fileTarget);

                    LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, "Temorary Icon Path : " + IconPath);
                }
                fb.Dispose();
                return(true);
            }
            else
            {
                LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, "Failed to locate drive");
            }
            return(false);
        }
        private void button_EditList_Click(object sender, EventArgs e)
        {
            if (!RoboSep_UserConsole.bIsRunning)
            {
                // check if protocols loaded for run will be lost if list is re-loaded
                // caused by adding from the "All list" section of the selct protocol window
                if (RoboSep_RunSamples.getInstance().iSelectedProtocols.Length > 0)
                {
                    List <RoboSep_Protocol> usrLst  = RoboSep_UserDB.getInstance().loadUserProtocols(textBox_UserName.Text);
                    QuadrantInfo[]          RunInfo = RoboSep_RunSamples.getInstance().RunInfo;

                    List <int> removeQuadrants = new List <int>();

                    for (int Quadrant = 0; Quadrant < 4; Quadrant++)
                    {
                        if (RunInfo[Quadrant].bQuadrantInUse)
                        {
                            bool ProtocolInList = false;
                            for (int i = 0; i < usrLst.Count; i++)
                            {
                                if (RunInfo[Quadrant].QuadrantLabel == usrLst[i].Protocol_Name)
                                {
                                    ProtocolInList = true;
                                    break;
                                }
                            }
                            if (!ProtocolInList)
                            {
                                for (int i = 0; i < RunInfo[Quadrant].QuadrantsRequired; i++)
                                {
                                    removeQuadrants.Add(Quadrant + i);
                                }
                            }
                        }
                    }

                    // check if any protocols have been selected
                    // for the current run and will be lost
                    // when reloading profile
                    if (removeQuadrants.Count > 0)
                    {
                        string           sMSG   = LanguageINI.GetString("msgRefreshList") + "\r\n\r\n" + LanguageINI.GetString("msgRefreshList2");
                        RoboMessagePanel prompt = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING,
                                                                       sMSG, LanguageINI.GetString("Warning"), LanguageINI.GetString("Yes"), LanguageINI.GetString("Cancel"));
                        RoboSep_UserConsole.showOverlay();
                        prompt.ShowDialog();

                        // wait for response

                        if (prompt.DialogResult == DialogResult.OK)
                        {
                            for (int i = 0; i < removeQuadrants.Count; i++)
                            {
                                RoboSep_RunSamples.getInstance().CancelQuadrant(removeQuadrants[i]);
                            }
                        }

                        prompt.Dispose();
                    }
                    else
                    {
                        return;
                    }
                }


                LoadRequired = true;

                //RoboSep_UserConsole.strCurrentUser = textBox_UserName.Text;
                openProtocolList();

                // LOG
                string LOGmsg = "Edit list button clicked";
                //GUI_Controls.uiLog.LOG(this, "button_EditList_Click", GUI_Controls.uiLog.LogLevel.EVENTS, LOGmsg);
                //  (LOGmsg);
                LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, LOGmsg);
            }
            else
            {
                Prompt_RunInProgress();
            }
        }
        private void button_DeleteUser_Click(object sender, EventArgs e)
        {
            // Get list of user names
            List <string> UserNames = new List <string>();

            for (int i = 0; i < Users.Count; i++)
            {
                if (Users[i].Username != RoboSep_UserConsole.strCurrentUser && !RoboSep_UserDB.getInstance().IsPresetUser(Users[i].Username))
                {
                    UserNames.Add(Users[i].Username);
                }
            }

            // Show Overlay window
            RoboSep_UserConsole.showOverlay();
            RoboSep_UserConsole.getInstance().frmOverlay.BringToFront();

            // create new user select control form
            IniFile LanguageINI = GUI_Console.RoboSep_UserConsole.getInstance().LanguageINI;
            string  windowTitle = LanguageINI.GetString("lblSelectUserToDelete");

            Form_UserSelect UserSelectMenu = new Form_UserSelect(UserNames, windowTitle);

            UserSelectMenu.ShowDialog();

            RoboSep_UserConsole.hideOverlay();
            if (UserSelectMenu.DialogResult != DialogResult.OK)
            {
                UserSelectMenu.Dispose();
                ResumeLayout();
                return;
            }

            // check to see if user name was selected
            string selectedUser = UserSelectMenu.User;

            UserSelectMenu.Dispose();
            if (selectedUser == null && selectedUser == string.Empty)
            {
                return;
            }

            // Show Overlay window
            RoboSep_UserConsole.showOverlay();

            DeleteUser(selectedUser);

            // update the list
            UpdateUserProfiles();

            lvUser.UpdateScrollbar();

            RoboSep_UserConsole.hideOverlay();

            ResumeLayout();

            // LOG
            string logMSG = "Opening user screen to select user to be deleted.";

            //  (logMSG);
            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
        }
        public void UpdateUserImage(string userName, bool ChangeIcon)
        {
            IniFile       UserINI    = new IniFile(IniFile.iniFile.User);
            List <string> users      = UserINI.IniGetCategories();
            bool          userExists = false;

            // first check if profile already exists
            // profile must exist to change graphic
            for (int i = 0; i < users.Count; i++)
            {
                if (users[i] == userName)
                {
                    userExists = true;
                    break;
                }
            }

            if (userExists)
            {
                // only do this part if on the protocols page
                if (ChangeIcon)
                {
                    Form_IconSelect myIconSelect = new Form_IconSelect(userName);
                    RoboSep_UserConsole.showOverlay();
                    myIconSelect.ShowDialog();
                    myIconSelect.Dispose();
                    RoboSep_UserConsole.hideOverlay();
                }

                string ImgPath = UserINI.GetString(userName + "Image");
                if (ImgPath.StartsWith("Default"))
                {
                    switch (ImgPath)
                    {
                    default:
                        UserIcon.Image = Properties.Resources.DefaultUser_GREY;
                        break;

                    case "Default1":
                        UserIcon.Image = Properties.Resources.DefaultUser_GREY;
                        break;

                    case "Default2":
                        UserIcon.Image = Properties.Resources.DefaultUser_PURPLE;
                        break;

                    case "Default3":
                        UserIcon.Image = Properties.Resources.DefaultUser_BLUE;
                        break;

                    case "Default4":
                        UserIcon.Image = Properties.Resources.DefaultUser_GREEN;
                        break;
                    }
                }
                else
                {
                    UserIcon.Image = Image.FromFile(ImgPath);
                }
            }
        }
示例#29
0
        // Create the modal dialog in the Pausing or Paused state (as indicated)
        public DialogResult ShowDialog(Form parent, bool isPausing, bool isLidClosed, bool isPauseCommand, string pauseCommandCaption) // bdr new
        {
            // LOG

            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, "Show PauseResumeDialog");
            DialogResult result = DialogResult.Abort;

            if (myEventSink != null)
            {
                if (isPausing)
                {
                    System.Diagnostics.Debug.WriteLine("(new) in PauseResumeDlg.cs ShowDLg() state: isPausing");  // bdr

                    myMessage = string.Format(
                        SeparatorResourceManager.GetSeparatorString(StringId.PausePausingMessage),
                        (timerPausingTimeout.Interval / 1000)
                        );
                    myCaption = SeparatorResourceManager.GetSeparatorString(StringId.RunPausingText);
                    this.label_WindowTitle.Text = myCaption;
                    SetIcon(GUI_Controls.MessageIcon.MBICON_INFORMATION);
                    myButtonLabels = new string[] { };

                    // hide the OK button
                    SetButton1Visible(false);
                    SetButton2Visible(false);

                    // enable the timeout timer
                    timerPausingTimeout.Start();

                    LogFile.AddMessage(TraceLevel.Warning, "Run is pausing");
                }
                else // already Paused
                {
                    System.Diagnostics.Debug.WriteLine("(new) in PauseResumeDlg.cs ShowDLg() state: Paused");  // bdr
                    SetPausedMode(isLidClosed, isPauseCommand, pauseCommandCaption); // bdr new

                    LogFile.AddMessage(TraceLevel.Warning, "Run Paused");
                }

                // Register to receive SeparatorState changes from the event sink
                if (myStatusDelegate == null)
                {
                    myStatusDelegate = new SeparatorStatusDelegate(AtSeparatorStateUpdate);
                }

                myEventSink.UpdateSeparatorState += myStatusDelegate;

                //result = base.ShowDialog(parent, myMessage, myCaption, myButtonLabels,
                //    System.Drawing.SystemIcons.Information);

                //
                // << Jason Modification to fit new GUI >>
                //
                this.PreviousForm = parent != null ? parent : RoboSep_UserConsole.getInstance();
                this.message      = myMessage;
                this.SetMessage(myMessage);
                this.button_1.Text = LanguageINI.GetString("lblResume");
                this.button_2.Text = LanguageINI.GetString("lblStop");
                this.SetIcon(GUI_Controls.MessageIcon.MBICON_WAIT);
                this.Size = determineSize(myMessage);
                ResizeButtons();
                this.button_1.Refresh();
                this.button_2.Refresh();

                // show dialog
                RoboSep_UserConsole.showOverlay();
                this.ShowDialog();
                RoboSep_UserConsole.hideOverlay();

                result = this.DialogResult;

                string dbg = string.Format("PsRsDlg result {0}", result);
                System.Diagnostics.Debug.WriteLine(dbg); // bdr

                // De-Register to receive SeparatorState changes from the event sink
                if (myStatusDelegate != null)
                {
                    myEventSink.UpdateSeparatorState -= myStatusDelegate;
                }

                this.Dispose();
            }

            return(result);
        }
示例#30
0
        private void copyDeleteFiles(bool isCopy)
        {
            List <string> paths = getSelectedLogs();

            if (paths.Count > 0)
            {
                if (isCopy)
                {
                    List <string> lstUSBDrives = Utilities.GetUSBDrives();
                    if (lstUSBDrives != null && lstUSBDrives.Count > 0)
                    {
                        // determine usb directory
                        string USBpath = string.Empty;
                        try
                        {
                            for (int i = 0; i < lstUSBDrives.Count; i++)
                            {
                                if (Directory.Exists(lstUSBDrives[i]))
                                {
                                    USBpath = lstUSBDrives[i];
                                    break;
                                }
                            }
                            if (USBpath != string.Empty)
                            {
                                FileBrowser SelectFolder = new FileBrowser(RoboSep_UserConsole.getInstance(), "Please pick a destination folder", USBpath, "");
                                SelectFolder.ShowDialog();
                                if (SelectFolder.DialogResult == DialogResult.Yes)
                                {
                                    String destinationFolder = SelectFolder.Target;
                                    for (int i = 0; i < paths.Count; i++)
                                    {
                                        File.Copy(paths[i], destinationFolder + getLogFileName(paths[i]), true);
                                        File.Copy(getPathInSMIExt(paths[i]), destinationFolder + getPathInSMIExt(getLogFileName(paths[i])), true);
                                    }
                                }
                                SelectFolder.Dispose();
                            }
                        }
                        catch (Exception ex)
                        {
                            showGeneralErrorMessage(ex.Message);
                        }
                    }
                    else
                    {
                        showNoUSBErrorMessage();
                    }
                }
                else
                {
                    RoboMessagePanel dlg = new RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_WARNING,
                                                                "Are you sure to delete the selected logs?", "", LanguageINI.GetString("Yes"), LanguageINI.GetString("No"));
                    RoboSep_UserConsole.showOverlay();
                    dlg.ShowDialog();
                    RoboSep_UserConsole.hideOverlay();

                    if (dlg.DialogResult == DialogResult.OK)
                    {
                        for (int i = 0; i < paths.Count; i++)
                        {
                            File.Delete(paths[i]);
                            File.Delete(getPathInSMIExt(paths[i]));
                        }
                    }
                    dlg.Dispose();
                }
                refreshTableLayoutPanel();
            }
            else
            {
                showNoSelectionErrorMessage();
            }
        }