コード例 #1
0
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            if (m_bModified)
            {
                DialogResult dr = MessageService.Ask(KPRes.SaveBeforeCloseQuestion,
                                                     PwDefs.ShortProductName, MessageBoxButtons.YesNoCancel);

                if (dr == DialogResult.Yes)
                {
                    OnFileSave(sender, EventArgs.Empty);
                }
                else if (dr == DialogResult.No)
                {
                }
                else
                {
                    e.Cancel = true;
                    return;
                }
            }

            if (m_bURtfWithHighChar && (m_pbEditedData != null) &&
                !MemUtil.ArraysEqual(m_pbEditedData, m_pbData))
            {
                string strUrl = AppHelp.GetOnlineUrl(AppDefs.HelpTopics.KbFaq,
                                                     AppDefs.HelpTopics.KbFaqURtf);
                string strLink = VistaTaskDialog.CreateLink(strUrl, strUrl);
                string strMsg  = KPRes.URtfProblem + MessageService.NewParagraph +
                                 KPRes.URtfCheck + MessageService.NewParagraph +
                                 KPRes.URtfSuggestion + MessageService.NewParagraph +
                                 KPRes.MoreInfo + ":" + MessageService.NewLine;

                VistaTaskDialog dlg = new VistaTaskDialog();
                dlg.AddButton((int)DialogResult.Cancel, KPRes.Ok, null);
                dlg.CommandLinks     = false;
                dlg.Content          = strMsg + strLink;
                dlg.DefaultButtonID  = (int)DialogResult.Cancel;
                dlg.EnableHyperlinks = true;
                dlg.SetIcon(VtdIcon.Warning);
                dlg.WindowTitle = PwDefs.ShortProductName;

                if (!dlg.ShowDialog())
                {
                    MessageService.ShowWarning(strMsg + strUrl);
                }
            }

            Debug.Assert(m_uBlockEvents == 0);

            string strRect = UIUtil.GetWindowScreenRect(this);

            if (strRect != m_strInitialFormRect)            // Don't overwrite ""
            {
                Program.Config.UI.DataEditorRect = strRect;
            }

            m_ctxText.Detach();
            GlobalWindowManager.RemoveWindow(this);
        }
コード例 #2
0
        internal void CheckTriggers()
        {
            bool bUIStateUpd = false;

            foreach (EcasTrigger t in m_vTriggers)
            {
                foreach (EcasEvent e in t.EventCollection)
                {
                    if (e.Type.Equals(EcasEventIDs.UpdatedUIState))
                    {
                        bUIStateUpd = true;
                    }
                }
            }

            if (bUIStateUpd)
            {
                string str = KPRes.Event + ": '" + KPRes.UpdatedUIState + "'." +
                             MessageService.NewParagraph + KPRes.TriggerEventTypeUnknown +
                             MessageService.NewParagraph + KPRes.MoreInfo + ":" +
                             MessageService.NewLine;
                string strUrl = AppHelp.GetOnlineUrl(AppDefs.HelpTopics.TriggerUIStateUpd, null);

                string strVtd = str + VistaTaskDialog.CreateLink(strUrl, strUrl);

                VistaTaskDialog vtd = new VistaTaskDialog();
                vtd.AddButton((int)DialogResult.Cancel, KPRes.Ok, null);
                vtd.Content          = strVtd;
                vtd.DefaultButtonID  = (int)DialogResult.Cancel;
                vtd.EnableHyperlinks = true;
                vtd.SetIcon(VtdIcon.Warning);
                vtd.WindowTitle = PwDefs.ShortProductName;

                if (!vtd.ShowDialog())
                {
                    MessageService.ShowWarning(str + strUrl);
                }
            }
        }