Exemple #1
0
            private CompositeKey OTPDB_RequestPasswordSecure(bool bSetNewPassword, out bool bCancel)
            {
                var kpfParams = Create_OdKpfConstructParams(OTPDB.IOConnectionInfo, false, true);

                DialogResult dr;
                var          kpfResult = Create_OdKpfResult();

                ProtectedDialog dlg = new ProtectedDialog(OdKpfConstruct, OdKpfBuildResult);
                object          objResult;

                dr      = dlg.ShowDialog(out objResult, kpfParams);
                bCancel = dr == DialogResult.None || dr == DialogResult.Cancel;
                var fi = objResult.GetType().GetField("ShowHelpAfterClose");

                if (fi != null && (bool)fi.GetValue(objResult))
                {
                    bCancel = true;
                    AppHelp.ShowHelp(AppDefs.HelpTopics.KeySources, null);
                }
                if (bCancel)
                {
                    return(new CompositeKey());
                }
                fi = objResult.GetType().GetField("Key");
                return(fi.GetValue(objResult) as CompositeKey);
            }
Exemple #2
0
        private void OnBtnHelp(object sender, EventArgs e)
        {
            GAction f = delegate() { AppHelp.ShowHelp(AppDefs.HelpTopics.KeySources, null); };

            ProtectedDialog.ContinueOnNormalDesktop(f, this, ref m_fInvokeAfterClose,
                                                    m_bSecureDesktop);
        }
Exemple #3
0
        private void ShowHelpEx(string strTopic, string strSection)
        {
            GAction f = delegate() { AppHelp.ShowHelp(strTopic, strSection); };

            ProtectedDialog.ContinueOnNormalDesktop(f, this, ref m_fInvokeAfterClose,
                                                    m_bSecureDesktop);
        }
Exemple #4
0
        internal static DialogResult ShowDialog(IOConnectionInfo ioInfo,
                                                bool bCreatingNew, out KeyCreationFormResult r)
        {
            bool bSecDesk = (Program.Config.Security.MasterKeyOnSecureDesktop &&
                             ProtectedDialog.IsSupported);

            GFunc <KeyCreationForm> fConstruct = delegate()
            {
                KeyCreationForm f = new KeyCreationForm();
                f.InitEx(ioInfo, bCreatingNew);
                f.SecureDesktopMode = bSecDesk;
                return(f);
            };

            GFunc <KeyCreationForm, KeyCreationFormResult> fResultBuilder = delegate(
                KeyCreationForm f)
            {
                KeyCreationFormResult rEx = new KeyCreationFormResult();
                rEx.CompositeKey     = f.CompositeKey;
                rEx.InvokeAfterClose = f.InvokeAfterClose;
                return(rEx);
            };

            DialogResult dr = ProtectedDialog.ShowDialog <KeyCreationForm,
                                                          KeyCreationFormResult>(bSecDesk, fConstruct, fResultBuilder, out r);

            GAction fIac = ((r != null) ? r.InvokeAfterClose : null);

            if (fIac != null)
            {
                fIac();
            }

            return(dr);
        }
Exemple #5
0
        private void OnClickKeyFileCreate(object sender, EventArgs e)
        {
            IOConnectionInfo ioc      = m_ioInfo;
            bool             bSecDesk = m_bSecureDesktop;

            GAction f = delegate()
            {
                KeyFileCreationForm dlg = new KeyFileCreationForm();
                dlg.InitEx(ioc);

                DialogResult dr = dlg.ShowDialog();
                if ((dr == DialogResult.OK) && !bSecDesk)
                {
                    string strFile = dlg.ResultFile;
                    if (!string.IsNullOrEmpty(strFile))
                    {
                        m_cmbKeyFile.Items.Add(strFile);
                        m_cmbKeyFile.SelectedIndex = m_cmbKeyFile.Items.Count - 1;

                        UpdateUIState();
                    }
                    else
                    {
                        Debug.Assert(false);
                    }
                }

                UIUtil.DestroyForm(dlg);
            };

            ProtectedDialog.ContinueOnNormalDesktop(f, this, ref m_fInvokeAfterClose,
                                                    bSecDesk);
        }