Пример #1
0
        /// <summary>
        ///     Display the application's Options dialog box
        /// </summary>
        private void ShowOptionsDialog()
        {
            if (_optionsForm == null)
            {
                Extractor extractor = Extractor.GetInstance(); //get a reference to the main Extractor engine
                mnuCtxExit.Enabled = false;                    //disable the Exit action on the system tray icon's menu
                //Stop();

                //display the application's Options form to the user
                _optionsForm = new frmOptions();
                _optionsForm.ShowDialog(this);

                extractor.LoadSettings();
                //ask the Extractor engine to refresh its settings from the application's user-config file

                //re-enable the Exit action on the system tray icon's menu
                mnuCtxExit.Enabled = true;

                //free the memory used by the reference to the Options form
                _optionsForm = null;
            }
            else
            {
                //if the Options form is already being displayed, just bring it to the front
                _optionsForm.BringToFront();
            }
        }
Пример #2
0
 private void btnOptions_Click(object sender, EventArgs e)
 {
     using (var frm = new frmOptions())
     {
         frm.ShowDialog(this);
     }
 }
        private void btnGoOnForm_Click(object sender, EventArgs e)
        {
            List <CheckAccount> listAcc = new List <CheckAccount>();

            listAcc = checkAccountService.GetVerificationCode();
            foreach (var acc in listAcc)
            {
                if (acc.Code == txtVerificationCode.Text.Trim())
                {
                    this.Hide();
                    frmOptions           frm_Opn   = new frmOptions();
                    SendEmailToFrmOption sendEmail = new SendEmailToFrmOption(frm_Opn.FunDataOption);
                    sendEmail(_email);
                    checkAccountService.DeleteVerificationCode();
                    frm_Opn.ShowDialog();
                    break;
                }
                else
                {
                    _countVerification++;
                    txtVerificationCode.Clear();
                    btnGoOnForm.Enabled = false;
                    MessageBox.Show("Mã xác thực không đúng. Vui lòng kiểm tra lại. " + "\n" + "Bạn đã xác thực " + _countVerification
                                    + " lần. Nếu vượt quá 3 lần tài khoản sẻ bị khóa", "Thông Báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.lblNote.ForeColor = Color.Red;
                    lblNote.Text           = "Mã Xác Thực không tồn tại. Còn " + (3 - _countVerification) + " lần xác thực trước khi tài khoản bị khóa.";
                    if (_countVerification > 3)
                    {
                        LockAccount();
                    }
                }
            }
        }
Пример #4
0
        protected override void OnClick()
        {
            try
            {
                frmOptions frm = new frmOptions();
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ESRI.ArcGIS.esriSystem.IUID pUI = new ESRI.ArcGIS.esriSystem.UID();
                    pUI.Value = ThisAddIn.IDs.ucProjectExplorer;

                    ESRI.ArcGIS.Framework.IDockableWindow docWin = ArcMap.DockableWindowManager.GetDockableWindow((ESRI.ArcGIS.esriSystem.UID)pUI);
                    if (docWin is ESRI.ArcGIS.Framework.IDockableWindow)
                    {
                        try
                        {
                            // Try and refresh the project window.
                            ucProjectExplorer.AddinImpl winImpl = ESRI.ArcGIS.Desktop.AddIns.AddIn.FromID <ucProjectExplorer.AddinImpl>(ThisAddIn.IDs.ucProjectExplorer);
                            winImpl.UI.RefreshBaseMaps();
                        }
                        catch (Exception ex)
                        {
                            ErrorHandling.frmException.HandleException(ex, "Error showing project explorer.", string.Empty);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.frmException.HandleException(ex, "Error Showing RAVE Options Form", string.Empty);
            }

            ArcMap.Application.CurrentTool = null;
        }
Пример #5
0
        private void toolsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmOptions frm = new frmOptions(this);

            frm.ShowDialog(this);
            frm.Dispose();
            UpdateOptions();
        }
Пример #6
0
        private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            frmOptions frmOptions = new frmOptions();

            frmOptions.ShowDialog(this);
            Cursor = Cursors.Default;
        }
Пример #7
0
        private void butOptions_Click(object sender, EventArgs e)
        {
            frmOptions frm = new frmOptions(this);

            frm.ShowDialog(this);
            frm.Dispose();
            UpdateOptions();
        }
Пример #8
0
 protected override void OnOptionsFormOpeningRequested()
 {
     using (frmOptions frmOptions = new frmOptions())
     {
         frmOptions.LoadLabels();
         frmOptions.LoadConfiguration();
         frmOptions.ShowDialog(_view.WindowInstance);
     }
 }
Пример #9
0
        private void button2_Click(object sender, EventArgs e)
        {
            frmOptions optionsForm = new frmOptions();

            optionsForm.Options = m_options;
            if (optionsForm.ShowDialog(this) == DialogResult.OK)
            {
                m_options = optionsForm.Options;
            }
        }
Пример #10
0
    // This sub is the first one that executes when the Screen Saver
    //   program is run.  Since Windows will pass parameters to the this
    //   program whenever a user is setting up the screen saver using the
    //   Display Properties -> Screen Saver property screen.
    [STAThread()] static void Main(string[] args)
    {
        // Check to see if there were any passed arguments. if not, then
        //   the user simply double-clicked on the .scr file.

        if (args.Length > 0)
        {
            // This means we have some passed arguments.  Windows will
            //   automatically pass a "/s", "/p" or a "/c" depending
            //   on how the screen saver should behave.  The meanings for each
            //   of these parameters is seen below.
            // Check to see if the Screen saver should preview.

            if (args[0].ToLower() == "/p")
            {
                // This functionality is not implemented here because it involves
                //   creating and joining threads and is beyond the scope of this
                //   How-To.
                // Simply exit the application
                Application.Exit();
            }
            // Check to see if the Screen saver should show user definable options.
            if (args[0].ToLower().Trim().Substring(0, 2) == "/c")
            {
                // Create a frmOptions form and display it.
                frmOptions userOptionsForm = new frmOptions();
                userOptionsForm.ShowDialog();
                // Exit the application.
                Application.Exit();
            }

            // Check to see if the Screen saver should simply execute
            if (args[0].ToLower() == "/s")
            {
                // Create a frmSceenSaver form and display it.
                frmSceenSaver screenSaverForm = new frmSceenSaver();
                screenSaverForm.ShowDialog();
                // Exit the application when the form is closed
                Application.Exit();
            }
        }
        else
        {
            // Fire up the Screen saver.  Note: This is only used when the user
            //   Double clicks on the EXE, since otherwise windows passes a
            //   parameter to the application.
            // Create a frmSceenSaver form and display it.
            frmSceenSaver screenSaverForm = new frmSceenSaver();
            screenSaverForm.ShowDialog();
            // Exit the application when the form is closed
            Application.Exit();
        }
    }
Пример #11
0
        private async void DoImport()
        {
            TreeNode objSelectedNode = treCharacterList.SelectedNode;

            if (objSelectedNode == null || objSelectedNode.Level <= 0)
            {
                return;
            }
            int intIndex = Convert.ToInt32(objSelectedNode.Tag, GlobalOptions.InvariantCultureInfo);

            if (intIndex < 0 || intIndex >= _lstCharacterCache.Count)
            {
                return;
            }
            string strFile        = _lstCharacterCache[intIndex]?.FilePath;
            string strCharacterId = _lstCharacterCache[intIndex]?.CharacterId;

            if (string.IsNullOrEmpty(strFile) || string.IsNullOrEmpty(strCharacterId))
            {
                return;
            }
            string strFilePath = Path.Combine(Application.StartupPath, "settings", "default.xml");

            if (!File.Exists(strFilePath) &&
                Program.MainForm.ShowMessageBox(this, LanguageManager.GetString("Message_CharacterOptions_OpenOptions"), LanguageManager.GetString("MessageTitle_CharacterOptions_OpenOptions"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                using (new CursorWait(this))
                    using (frmOptions frmOptions = new frmOptions())
                        frmOptions.ShowDialog(this);
            }
            using (new CursorWait(this))
            {
                cmdImport.Enabled     = false;
                cmdSelectFile.Enabled = false;
                Character objCharacter = new Character();
                Program.MainForm.OpenCharacters.Add(objCharacter);
                //Timekeeper.Start("load_file");
                bool blnLoaded = await objCharacter.LoadFromHeroLabFile(strFile, strCharacterId);

                //Timekeeper.Finish("load_file");
                if (!blnLoaded)
                {
                    Program.MainForm.OpenCharacters.Remove(objCharacter);
                    cmdImport.Enabled     = true;
                    cmdSelectFile.Enabled = true;
                    return;
                }

                Program.MainForm.OpenCharacter(objCharacter);
            }

            Close();
        }
Пример #12
0
        private void btnTiepTuc2_Click(object sender, EventArgs e)
        {
            string checkText = txtKetQua2.Text;

            if (checkText.Equals("Phải"))
            {
                MessageBox.Show("Hay Lắm Thằng Ngu ạ, Câu trả lời đúng r", "Đúng Rồi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Hide();
                frmOptions frm_option = new frmOptions();
                frm_option.ShowDialog();
            }
            else
            {
                MessageBox.Show("M thông minh lắm thằng ngu ạ, Nhưng sai r", "Sai Rồi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #13
0
        private void mbutton_options_Click(object sender, EventArgs e)
        {
            frmOptions options = new frmOptions();

            options.Options       = m_options;
            options.Icon          = ParentForm.Icon;
            options.StartPosition = FormStartPosition.CenterParent;
            DialogResult result = options.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (!m_options.Equals(options.Options))
                {
                    UpdateAnalysis(options.Options);
                    mbutton_saveDatabase.Visible = false;
                }
            }
        }
Пример #14
0
        protected override void OnOptionsFormOpeningRequested()
        {
            using (frmOptions frmOptions = new frmOptions())
            {
                frmOptions.LoadLabels();

                try
                {
                    frmOptions.LoadConfiguration();
                }
                catch
                {
                    MRCCompressorGlobals.ImageSaveAsPDFMRCActionConfiguration = ConfigurationManager.ResetDefaultImageSaveAsPDFMRCActionConfiguration();
                    frmOptions.LoadConfiguration();
                }

                frmOptions.ShowDialog(_view.WindowInstance);
            }
        }
Пример #15
0
 private void btnSettings_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         frmOptions myOptions = new frmOptions();
         myOptions.ShowDialog();
         if (myOptions.DialogResult == DialogResult.OK)
         {
             // Refresh the drop down items
             this.LoadDropDown();
             // Refresh the command bar
             this.ShowHideButtons();
         }
     }
     catch (System.Exception ex) // TODO we should not catch all exceptions
     {
         MessageBox.Show("caught: \r\n" + ex.ToString());
     }
 }
Пример #16
0
 private void Settings(Office.CommandBarButton btn, ref bool cancel)
 {
     try
     {
         frmOptions myOptions = new frmOptions();
         myOptions.ShowDialog();
         if (myOptions.DialogResult == DialogResult.OK)
         {
             // Refresh the drop down items
             this.LoadDropDown();
             // Refresh the command bar
             this.ShowHideButtons();
         }
     }
     catch (System.Exception ex) // TODO we should not catch all exceptions
     {
         MessageBox.Show("caught: \r\n" + ex.ToString());
     }
 }
Пример #17
0
        /// <summary>
        /// Create a new character and show the Create Form.
        /// </summary>
        private void ShowNewForm(object sender, EventArgs e)
        {
            string strFilePath = Path.Combine(Application.StartupPath, "settings", "default.xml");

            if (!File.Exists(strFilePath))
            {
                if (MessageBox.Show(LanguageManager.GetString("Message_CharacterOptions_OpenOptions", GlobalOptions.Language), LanguageManager.GetString("MessageTitle_CharacterOptions_OpenOptions", GlobalOptions.Language), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Cursor = Cursors.WaitCursor;
                    frmOptions frmOptions = new frmOptions();
                    frmOptions.ShowDialog();
                    Cursor = Cursors.Default;
                }
            }
            Cursor = Cursors.WaitCursor;
            Character objCharacter = new Character();
            string    settingsPath = Path.Combine(Application.StartupPath, "settings");

            string[] settingsFiles = Directory.GetFiles(settingsPath, "*.xml");

            if (settingsFiles.Length > 1)
            {
                frmSelectSetting frmPickSetting = new frmSelectSetting();
                frmPickSetting.ShowDialog(this);

                if (frmPickSetting.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                objCharacter.SettingsFile = frmPickSetting.SettingsFile;
            }
            else
            {
                string strSettingsFile = settingsFiles[0];
                objCharacter.SettingsFile = Path.GetFileName(strSettingsFile);
            }

            // Show the BP selection window.
            frmSelectBuildMethod frmBP = new frmSelectBuildMethod(objCharacter);

            frmBP.ShowDialog();
            Cursor = Cursors.Default;

            if (frmBP.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            if (objCharacter.BuildMethod == CharacterBuildMethod.Karma || objCharacter.BuildMethod == CharacterBuildMethod.LifeModule)
            {
                Cursor = Cursors.WaitCursor;
                frmKarmaMetatype frmSelectMetatype = new frmKarmaMetatype(objCharacter);
                frmSelectMetatype.ShowDialog();
                Cursor = Cursors.Default;

                if (frmSelectMetatype.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }
            // Show the Metatype selection window.
            else if (objCharacter.BuildMethod == CharacterBuildMethod.Priority || objCharacter.BuildMethod == CharacterBuildMethod.SumtoTen)
            {
                Cursor = Cursors.WaitCursor;
                frmPriorityMetatype frmSelectMetatype = new frmPriorityMetatype(objCharacter);
                frmSelectMetatype.ShowDialog();
                Cursor = Cursors.Default;

                if (frmSelectMetatype.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }
            Cursor = Cursors.WaitCursor;

            // Add the Unarmed Attack Weapon to the character.
            XmlDocument objXmlDocument = XmlManager.Load("weapons.xml");
            XmlNode     objXmlWeapon   = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"Unarmed Attack\"]");

            if (objXmlWeapon != null)
            {
                List <Weapon> lstWeapons = new List <Weapon>();
                Weapon        objWeapon  = new Weapon(objCharacter);
                objWeapon.Create(objXmlWeapon, lstWeapons);
                objWeapon.ParentID = Guid.NewGuid().ToString("D"); // Unarmed Attack can never be removed
                objCharacter.Weapons.Add(objWeapon);
                foreach (Weapon objLoopWeapon in lstWeapons)
                {
                    objCharacter.Weapons.Add(objLoopWeapon);
                }
            }

            frmCreate frmNewCharacter = new frmCreate(objCharacter)
            {
                MdiParent   = this,
                WindowState = FormWindowState.Maximized
            };

            frmNewCharacter.Show();

            objCharacter.CharacterNameChanged += objCharacter_CharacterNameChanged;
            Cursor = Cursors.Default;
        }
Пример #18
0
 public static void Show(WindowType windowType)
 {
     try
     {
         if (windowType.Equals(WindowType.About))
         {
             if (aboutForm == null || aboutForm.IsDisposed)
             {
                 aboutForm  = new AboutWindow(aboutPanel);
                 aboutPanel = aboutForm;
             }
             aboutForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.ActiveDirectoryImport))
         {
             if (adimportForm == null || adimportForm.IsDisposed)
             {
                 adimportForm  = new ActiveDirectoryImportWindow(adimportPanel);
                 adimportPanel = adimportForm;
             }
             adimportPanel.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Options))
         {
             using (var optionsForm = new frmOptions())
             {
                 optionsForm.ShowDialog(frmMain.Default.pnlDock);
             }
         }
         else if (windowType.Equals(WindowType.SSHTransfer))
         {
             sshtransferForm  = new SSHTransferWindow(sshtransferPanel);
             sshtransferPanel = sshtransferForm;
             sshtransferForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Update))
         {
             if (updateForm == null || updateForm.IsDisposed)
             {
                 updateForm  = new UpdateWindow(updatePanel);
                 updatePanel = updateForm;
             }
             updateForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Help))
         {
             if (helpForm == null || helpForm.IsDisposed)
             {
                 helpForm  = new HelpWindow(helpPanel);
                 helpPanel = helpForm;
             }
             helpForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.ExternalApps))
         {
             if (externalappsForm == null || externalappsForm.IsDisposed)
             {
                 externalappsForm  = new ExternalToolsWindow(externalappsPanel);
                 externalappsPanel = externalappsForm;
             }
             externalappsForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.PortScan))
         {
             portscanForm  = new PortScanWindow(portscanPanel);
             portscanPanel = portscanForm;
             portscanForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.UltraVNCSC))
         {
             if (ultravncscForm == null || ultravncscForm.IsDisposed)
             {
                 ultravncscForm  = new UltraVNCWindow(ultravncscPanel);
                 ultravncscPanel = ultravncscForm;
             }
             ultravncscForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.ComponentsCheck))
         {
             if (componentscheckForm == null || componentscheckForm.IsDisposed)
             {
                 componentscheckForm  = new ComponentsCheckWindow(componentscheckPanel);
                 componentscheckPanel = componentscheckForm;
             }
             componentscheckForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Announcement))
         {
             if (AnnouncementForm == null || AnnouncementForm.IsDisposed)
             {
                 AnnouncementForm  = new AnnouncementWindow(AnnouncementPanel);
                 AnnouncementPanel = AnnouncementForm;
             }
             AnnouncementForm.Show(frmMain.Default.pnlDock);
         }
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddExceptionStackTrace("App.Runtime.Windows.Show() failed.", ex);
     }
 }
Пример #19
0
        /// <summary>
        /// Create a new character and show the Create Form.
        /// </summary>
        private void ShowNewForm(object sender, EventArgs e)
        {
            string strFilePath = Path.Combine(Environment.CurrentDirectory, "settings", "default.xml");

            if (!File.Exists(strFilePath))
            {
                if (MessageBox.Show(LanguageManager.Instance.GetString("Message_CharacterOptions_OpenOptions"), LanguageManager.Instance.GetString("MessageTitle_CharacterOptions_OpenOptions"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    frmOptions frmOptions = new frmOptions();
                    frmOptions.ShowDialog();
                }
            }
            Character objCharacter = new Character();
            string    settingsPath = Path.Combine(Environment.CurrentDirectory, "settings");

            string[] settingsFiles = Directory.GetFiles(settingsPath, "*.xml");

            if (settingsFiles.Length > 1)
            {
                frmSelectSetting frmPickSetting = new frmSelectSetting();
                frmPickSetting.ShowDialog(this);

                if (frmPickSetting.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                objCharacter.SettingsFile = frmPickSetting.SettingsFile;
            }
            else
            {
                string strSettingsFile = settingsFiles[0];
                objCharacter.SettingsFile = Path.GetFileName(strSettingsFile);
            }

            // Show the BP selection window.
            frmSelectBuildMethod frmBP = new frmSelectBuildMethod(objCharacter);

            frmBP.ShowDialog();

            if (frmBP.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            if (objCharacter.BuildMethod == CharacterBuildMethod.Karma || objCharacter.BuildMethod == CharacterBuildMethod.LifeModule)
            {
                frmKarmaMetatype frmSelectMetatype = new frmKarmaMetatype(objCharacter);
                frmSelectMetatype.ShowDialog();

                if (frmSelectMetatype.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }
            // Show the Metatype selection window.
            else if (objCharacter.BuildMethod == CharacterBuildMethod.Priority || objCharacter.BuildMethod == CharacterBuildMethod.SumtoTen)
            {
                frmPriorityMetatype frmSelectMetatype = new frmPriorityMetatype(objCharacter);
                frmSelectMetatype.ShowDialog();

                if (frmSelectMetatype.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }

            // Add the Unarmed Attack Weapon to the character.
            try
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
                XmlNode     objXmlWeapon   = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"Unarmed Attack\"]");
                TreeNode    objDummy       = new TreeNode();
                Weapon      objWeapon      = new Weapon(objCharacter);
                objWeapon.Create(objXmlWeapon, objCharacter, objDummy, null, null);
                objCharacter.Weapons.Add(objWeapon);
            }
            catch
            {
            }

            frmCreate frmNewCharacter = new frmCreate(objCharacter);

            frmNewCharacter.MdiParent   = this;
            frmNewCharacter.WindowState = FormWindowState.Maximized;
            frmNewCharacter.Show();

            objCharacter.CharacterNameChanged += objCharacter_CharacterNameChanged;
        }
Пример #20
0
        private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmOptions frmOptions = new frmOptions();

            frmOptions.ShowDialog(this);
        }
Пример #21
0
 private void parametersToolStripMenuItem_Click(object sender, EventArgs e)
 {
     option.ShowDialog();
 }
Пример #22
0
        private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmOptions OptionsInstance = new frmOptions();

            OptionsInstance.ShowDialog();
        }
Пример #23
0
        private async void DoImport()
        {
            TreeNode objSelectedNode = treCharacterList.SelectedNode;

            if (objSelectedNode != null && objSelectedNode.Level > 0)
            {
                int intIndex = Convert.ToInt32(objSelectedNode.Tag, GlobalOptions.InvariantCultureInfo);
                if (intIndex >= 0 && intIndex < _lstCharacterCache.Count)
                {
                    string strFile        = _lstCharacterCache[intIndex]?.FilePath;
                    string strCharacterId = _lstCharacterCache[intIndex]?.CharacterId;
                    if (!string.IsNullOrEmpty(strFile) && !string.IsNullOrEmpty(strCharacterId))
                    {
                        string strFilePath  = Path.Combine(Application.StartupPath, "settings", "default.xml");
                        Cursor objOldCursor = Cursor;
                        if (!File.Exists(strFilePath))
                        {
                            if (MessageBox.Show(LanguageManager.GetString("Message_CharacterOptions_OpenOptions"), LanguageManager.GetString("MessageTitle_CharacterOptions_OpenOptions"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                Cursor = Cursors.WaitCursor;
                                using (frmOptions frmOptions = new frmOptions())
                                    frmOptions.ShowDialog();
                                Cursor = objOldCursor;
                            }
                        }
                        Cursor                = Cursors.WaitCursor;
                        cmdImport.Enabled     = false;
                        cmdSelectFile.Enabled = false;
                        Character objCharacter  = new Character();
                        string    settingsPath  = Path.Combine(Application.StartupPath, "settings");
                        string[]  settingsFiles = Directory.GetFiles(settingsPath, "*.xml");

                        if (settingsFiles.Length > 1)
                        {
                            using (frmSelectSetting frmPickSetting = new frmSelectSetting())
                            {
                                frmPickSetting.ShowDialog(this);

                                if (frmPickSetting.DialogResult == DialogResult.Cancel)
                                {
                                    return;
                                }

                                objCharacter.SettingsFile = frmPickSetting.SettingsFile;
                            }
                        }
                        else
                        {
                            string strSettingsFile = settingsFiles[0];
                            objCharacter.SettingsFile = Path.GetFileName(strSettingsFile);
                        }

                        Program.MainForm.OpenCharacters.Add(objCharacter);
                        //Timekeeper.Start("load_file");
                        bool blnLoaded = await objCharacter.LoadFromHeroLabFile(strFile, strCharacterId, objCharacter.SettingsFile).ConfigureAwait(true);

                        //Timekeeper.Finish("load_file");
                        if (!blnLoaded)
                        {
                            Program.MainForm.OpenCharacters.Remove(objCharacter);
                            Cursor                = objOldCursor;
                            cmdImport.Enabled     = true;
                            cmdSelectFile.Enabled = true;
                            return;
                        }

                        Program.MainForm.OpenCharacter(objCharacter);
                        Close();
                    }
                }
            }
        }
Пример #24
0
 public static void Show(WindowType windowType)
 {
     try
     {
         if (windowType.Equals(WindowType.About))
         {
             if (_aboutForm == null || _aboutForm.IsDisposed)
             {
                 _aboutForm  = new AboutWindow(_aboutPanel);
                 _aboutPanel = _aboutForm;
             }
             _aboutForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.ActiveDirectoryImport))
         {
             if (_adimportForm == null || _adimportForm.IsDisposed)
             {
                 _adimportForm  = new ActiveDirectoryImportWindow(_adimportPanel);
                 _adimportPanel = _adimportForm;
             }
             _adimportPanel.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Options))
         {
             using (var optionsForm = new frmOptions())
             {
                 optionsForm.ShowDialog(frmMain.Default.pnlDock);
             }
         }
         else if (windowType.Equals(WindowType.SSHTransfer))
         {
             SshtransferForm   = new SSHTransferWindow(_sshtransferPanel);
             _sshtransferPanel = SshtransferForm;
             SshtransferForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Update))
         {
             if (UpdateForm == null || UpdateForm.IsDisposed)
             {
                 UpdateForm  = new UpdateWindow(UpdatePanel);
                 UpdatePanel = UpdateForm;
             }
             UpdateForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Help))
         {
             if (_helpForm == null || _helpForm.IsDisposed)
             {
                 _helpForm  = new HelpWindow(_helpPanel);
                 _helpPanel = _helpForm;
             }
             _helpForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.ExternalApps))
         {
             if (_externalappsForm == null || _externalappsForm.IsDisposed)
             {
                 _externalappsForm  = new ExternalToolsWindow(_externalappsPanel);
                 _externalappsPanel = _externalappsForm;
             }
             _externalappsForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.PortScan))
         {
             _portscanForm  = new PortScanWindow(_portscanPanel);
             _portscanPanel = _portscanForm;
             _portscanForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.UltraVNCSC))
         {
             if (_ultravncscForm == null || _ultravncscForm.IsDisposed)
             {
                 _ultravncscForm  = new UltraVNCWindow(_ultravncscPanel);
                 _ultravncscPanel = _ultravncscForm;
             }
             _ultravncscForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.ComponentsCheck))
         {
             Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Showing ComponentsCheck window", true);
             if (_componentscheckForm == null || _componentscheckForm.IsDisposed)
             {
                 _componentscheckForm  = new ComponentsCheckWindow(_componentscheckPanel);
                 _componentscheckPanel = _componentscheckForm;
             }
             _componentscheckForm.Show(frmMain.Default.pnlDock);
         }
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddExceptionStackTrace("App.Runtime.Windows.Show() failed.", ex);
     }
 }
Пример #25
0
        private void toolStripMenuItemOptions_Click(object sender, EventArgs e)
        {
            var opts = new frmOptions(cache, config);

            opts.ShowDialog(this);
        }