コード例 #1
0
ファイル: BSISettings.cs プロジェクト: resuarez/myzilla
        public void SaveGlobalSettings(TDSettings.GlobalSettingsRow globalSettingsRow)
        {
            if (this.GlobalSettings.Rows.Count == 0)
            {
                TDSettings.GlobalSettingsRow newGlobalSettingsRow = this.GlobalSettings.NewGlobalSettingsRow();

                newGlobalSettingsRow.ShowLoadingForm            = globalSettingsRow.ShowLoadingForm;
                newGlobalSettingsRow.MainFormHeight             = globalSettingsRow.MainFormHeight;
                newGlobalSettingsRow.MainFormWidth              = globalSettingsRow.MainFormWidth;
                newGlobalSettingsRow.TreePanelWidth             = globalSettingsRow.TreePanelWidth;
                newGlobalSettingsRow.ConfirmSuccessfullyEditBug = globalSettingsRow.ConfirmSuccessfullyEditBug;
                newGlobalSettingsRow.ShowBugsCount              = globalSettingsRow.ShowBugsCount;
                newGlobalSettingsRow.ReportFilesPath            = globalSettingsRow.ReportFilesPath;


                this.GlobalSettings.Rows.Add(newGlobalSettingsRow);
            }
            else
            {
                (this.GlobalSettings.Rows[0] as TDSettings.GlobalSettingsRow).ShowLoadingForm            = globalSettingsRow.ShowLoadingForm;
                (this.GlobalSettings.Rows[0] as TDSettings.GlobalSettingsRow).MainFormHeight             = globalSettingsRow.MainFormHeight;
                (this.GlobalSettings.Rows[0] as TDSettings.GlobalSettingsRow).MainFormWidth              = globalSettingsRow.MainFormWidth;
                (this.GlobalSettings.Rows[0] as TDSettings.GlobalSettingsRow).TreePanelWidth             = globalSettingsRow.TreePanelWidth;
                (this.GlobalSettings.Rows[0] as TDSettings.GlobalSettingsRow).ConfirmSuccessfullyEditBug = globalSettingsRow.ConfirmSuccessfullyEditBug;
                (this.GlobalSettings.Rows[0] as TDSettings.GlobalSettingsRow).ShowBugsCount              = globalSettingsRow.ShowBugsCount;
                (this.GlobalSettings.Rows[0] as TDSettings.GlobalSettingsRow).ReportFilesPath            = globalSettingsRow.ReportFilesPath;
            }

            this.SaveXML(null);
        }
コード例 #2
0
        private void LoadGlobalSettings()
        {
            settings = _appSettings.GetGlobalSettings();

            chkShowLoadingForm.Checked = settings.ShowLoadingForm;

            chkEditConfirm.Checked = settings.ConfirmSuccessfullyEditBug;

            chkShowBugsCount.Checked = settings.ShowBugsCount;

            txtPath.Text = settings.ReportFilesPath;
        }
コード例 #3
0
        void bkgAddBug_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            bool continueBugEdit = false;

            try
            {
                // check the status of the async operation.

                if (e.Error != null)
                {
                    //display error message from bugzilla
                    string errorMessage = e.Error.Message;

                    DialogResult dr = MessageBox.Show(Utils.FormContainer, errorMessage, Messages.Error, MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation);

                    continueBugEdit = (dr == DialogResult.Retry);

#if DEBUG
                    (Utils.FormContainer as MainForm).wb.DocumentText = MyZilla.BL.Interfaces.Utils.htmlContents;
#endif
                }
                else
                {
                    // status OK
                    if (!e.Cancelled && e.Error == null)
                    {
                        string strResult = e.Result.ToString();

#if DEBUG
                        (Utils.FormContainer as MainForm).wb.DocumentText = MyZilla.BL.Interfaces.Utils.htmlContents;
#endif

                        // set the last selected item for some properties

                        Utils.lastSelectedHardware = cmbHardware.Text;

                        Utils.lastSelectedOS = cmbOS.Text;

                        Utils.lastSelectedProduct = cmbProduct.Text;

                        Utils.lastSelectedVersion = cmbVersion.Text;

                        Utils.lastSelectedMilestone = cmbMilestone.Text;

                        // confirmation message
                        MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.GetInstance();

                        TDSettings.GlobalSettingsRow globalSettings = _appSettings.GetGlobalSettings();

                        if (globalSettings.ConfirmSuccessfullyEditBug)
                        {
                            DialogResult dr = MessageBox.Show(this, strResult, Messages.Info, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }

                if (!continueBugEdit)
                {
                    btnCancel_Click(this, null);
                }

                btnInsertBug.Enabled = true;
            }

            catch (Exception ex)
            {
                // The thread could continue to execute after the form was closed.
                // In this case, an exception is generated. It is no need to be logged or be shown those type of exceptions.
                if (!_formClosed)
                {
                    MyLogger.Write(ex, "bkgAddBug_RunWorkerCompleted", LoggingCategory.Exception);

                    MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #4
0
        private void bkgBugUpdate_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                // check the status of the async operation.

                if (e.Error != null)
                {
                    string errorMessage = Messages.ErrUpdBug + Environment.NewLine + e.Error.Message;

                    MessageBox.Show(Utils.FormContainer, errorMessage, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                // status OK
                if (!e.Cancelled && e.Error == null)
                {
                    ArrayList al = e.Result as ArrayList;

                    string errorMessage = al[0].ToString();

                    string strResult = al[1].ToString();

                    btnSave.Enabled = true;

                    if (string.IsNullOrEmpty(errorMessage))
                    {
                        // confirmation message
                        TDSettings.GlobalSettingsRow globalSettings = _appSettings.GetGlobalSettings();

                        if (globalSettings.ConfirmSuccessfullyEditBug)
                        {
                            MessageBox.Show(this, strResult, Messages.Info, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }

                        _updateSuccessfully = true;

                        btnCancel_Click(null, null);
                    }
                    else
                    {
                        MessageBox.Show(this, strResult, Messages.Info, MessageBoxButtons.OK, MessageBoxIcon.Information);

                        GetBugDetailsAndSetControls(bugId, false);
                    }
                }


#if DEBUG
                (Utils.FormContainer as MainForm).wb.DocumentText = MyZilla.BL.Interfaces.Utils.htmlContents;
#endif
            }
            catch (Exception ex)
            {
                // The thread could continue to execute after the form was closed.
                // In this case, an exception is generated. It is no need to be logged or be shown those type of exceptions.
                if (!_formClosed)
                {
                    MyLogger.Write(ex, "bkgBugUpdate_RunWorkerCompleted", LoggingCategory.Exception);

                    MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #5
0
ファイル: BSISettings.cs プロジェクト: resuarez/myzilla
        public TDSettings.GlobalSettingsRow GetGlobalSettings(System.Drawing.Rectangle screenSize)
        {
            if (_instance.GlobalSettings.Rows.Count == 0)
            {
                TDSettings.GlobalSettingsRow result = _instance.GlobalSettings.NewGlobalSettingsRow();

                result.ShowLoadingForm = true;
                result.TreePanelWidth  = 180;

                result.MainFormHeight = 768 - 20;
                result.MainFormWidth  = 1024 - 50;

                result.MainFormLeft = (screenSize.Width - result.MainFormWidth) / 2;
                result.MainFormTop  = (screenSize.Height - result.MainFormHeight) / 2;

                result.ConfirmSuccessfullyEditBug = true;

                result.ShowBugsCount = false;

                result.ReportFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

                _instance.GlobalSettings.AddGlobalSettingsRow(result);

                _instance.GlobalSettings.AcceptChanges();

                return(result);
            }
            else
            {
                GlobalSettingsRow settings = this.GlobalSettings.Rows[0] as TDSettings.GlobalSettingsRow;

                try{
                    if (settings.MainFormLeft == Int32.MaxValue)
                    {
                    }
                }
                catch {
                    settings.MainFormLeft = (screenSize.Width - settings.MainFormWidth) / 2;
                }
                try
                {
                    if (settings.MainFormTop == Int32.MaxValue)
                    {
                    }
                }
                catch
                {
                    settings.MainFormTop = (screenSize.Height - settings.MainFormHeight) / 2;
                }
                try
                {
                    if (settings.MainFormMaximized)
                    {
                    }
                }
                catch
                {
                    settings.MainFormMaximized = false;
                }

                try
                {
                    if (String.IsNullOrEmpty(settings.ReportFilesPath))
                    {
                    }
                }
                catch
                {
                    settings.ReportFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                }
                settings.AcceptChanges();

                return(settings);
            }
        }