コード例 #1
0
        static internal string ShowCreateKeyPairFileDialog()
        {
            string fileName = "";

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.DefaultExt      = "*.key";
            sfd.CheckPathExists = true;
            sfd.Filter          = Properties.Resources.FileDialogFilterKeys;
            sfd.FilterIndex     = 0;
            sfd.AddExtension    = true;
            sfd.OverwritePrompt = true;
            sfd.Title           = Properties.Resources.SaveKeyTitle;

            if (DialogResult.OK == sfd.ShowDialog())
            {
                fileName = sfd.FileName;

                MFKeyConfig keyTool = new MFKeyConfig();

                KeyPair keyPair = keyTool.CreateKeyPair();
                keyTool.SaveKeyPair(keyPair, fileName);
            }

            return(fileName);
        }
コード例 #2
0
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
                sfd.DefaultExt      = "*.key";
                sfd.CheckPathExists = true;
                sfd.Filter          = "Key File (*.key)|*.key|All Files (*.*)|*.*";
                sfd.FilterIndex     = 0;
                sfd.AddExtension    = true;
                sfd.OverwritePrompt = true;
                sfd.Title           = "Create Empty Key";

                if (System.Windows.Forms.DialogResult.OK == sfd.ShowDialog())
                {
                    MFKeyConfig cfg      = new MFKeyConfig();
                    KeyPair     emptyKey = cfg.CreateEmptyKeyPair();
                    cfg.SaveKeyPair(emptyKey, sfd.FileName);
                }
            }