Beispiel #1
0
        public int Exec(IntPtr pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
//            log("BHO.IOleCommandTarget", "Exec", "Params : " + pguidCmdGroup + " " + nCmdID + " " + nCmdexecopt + " " + pvaIn + " " + pvaOut);
            if (nCmdID != 0)
            {
                // not called from menu!
//                log("BHO.IOleCommandTarget", "Exec", "Exec was not called from Menu! nCmdID != 0 - was : " + nCmdID);
                return(0);
            }
            log("BHO.IOleCommandTarget", "Exec", "Params : " + pguidCmdGroup + " " + nCmdID + " " + nCmdexecopt + " " + pvaIn + " " + pvaOut);

            log("BHO.IOleCommandTarget", "Exec", "Exec Was called from Menu! nCmdID == 0");

            ToolsForm toolsForm = new ToolsForm();

            var res = toolsForm.ShowDialog();

            if (res != System.Windows.Forms.DialogResult.OK)
            {
                // pin not entered
                log("BHO.IOleCommandTarget", "Exec", " - user canceled..." + res);
            }
            else
            {
                int tag = int.Parse("" + toolsForm.tag);

/*
 *              MessageBox.Show("Tool selected : " + tag,
 *  "Tool selected",
 *  MessageBoxButtons.OK,
 *  MessageBoxIcon.Exclamation,
 *  MessageBoxDefaultButton.Button1);
 */

                log("BHO.IOleCommandTarget", "Exec", " - user selected : " + toolsForm.tag + " : " + toolsForm.sender + " - select button/tag : " + tag);
                switch (tag)
                {
                case 1:
                    // Manager credentials
                    UserServiceCalls.ManageCredentials();
                    break;

                case 2:
                    // Backup Smartcard
                    UserServiceCalls.BackupSmartcard();
                    break;

                case 3:
                    // Restore Smartcard
                    UserServiceCalls.RestoreSmartcard();
                    break;

                case 4:
                    // Change Pin
                    UserServiceCalls.ChangePin();
                    break;

                case 5:
                    // Unlock Smartcard
                    UserServiceCalls.UnlockCard();
                    break;

                case 6:
                    // Debug Info
                    UserServiceCalls.ShowDebugInfo();
                    break;

                case 7:
                    // Debug Info
                    UserServiceCalls.CheckRevocationStatus();
                    break;

                default:
                    MessageBox.Show("Select User Selected - event args : " + toolsForm.e + " - sender : " + toolsForm.sender + " - tag " + toolsForm.tag);
                    break;
                }
            }

            log("BHO.IOleCommandTarget", "Exec", " - exec DONE!! " + res);
            return(0);
        }
        public int Exec(IntPtr pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
//            log("BHO.IOleCommandTarget", "Exec", "Params : " + pguidCmdGroup + " " + nCmdID + " " + nCmdexecopt + " " + pvaIn + " " + pvaOut);
            if(nCmdID != 0) 
            {
                // not called from menu!
//                log("BHO.IOleCommandTarget", "Exec", "Exec was not called from Menu! nCmdID != 0 - was : " + nCmdID);
                return 0;
            }
            log("BHO.IOleCommandTarget", "Exec", "Params : " + pguidCmdGroup + " " + nCmdID + " " + nCmdexecopt + " " + pvaIn + " " + pvaOut);

            log("BHO.IOleCommandTarget", "Exec", "Exec Was called from Menu! nCmdID == 0");

            ToolsForm toolsForm = new ToolsForm();

            var res = toolsForm.ShowDialog();
            if (res != System.Windows.Forms.DialogResult.OK)
            {
                // pin not entered
                log("BHO.IOleCommandTarget", "Exec", " - user canceled..." + res);
            }
            else
            {
                int tag = int.Parse("" + toolsForm.tag);
/*
                MessageBox.Show("Tool selected : " + tag,
    "Tool selected",
    MessageBoxButtons.OK,
    MessageBoxIcon.Exclamation,
    MessageBoxDefaultButton.Button1);
*/

                log("BHO.IOleCommandTarget", "Exec", " - user selected : " + toolsForm.tag + " : " + toolsForm.sender + " - select button/tag : " + tag);
                switch (tag)
                {
                    case 1 :
                        // Manager credentials
                        UserServiceCalls.ManageCredentials();
                        break;

                    case 2:
                        // Backup Smartcard
                        UserServiceCalls.BackupSmartcard();
                        break;
                    case 3:
                        // Restore Smartcard
                        UserServiceCalls.RestoreSmartcard();
                        break;
                    case 4:
                        // Change Pin
                        UserServiceCalls.ChangePin();
                        break;
                    case 5:
                        // Unlock Smartcard
                        UserServiceCalls.UnlockCard();
                        break;
                    case 6:
                        // Debug Info
                        UserServiceCalls.ShowDebugInfo();
                        break;
                    case 7:
                        // Debug Info
                        UserServiceCalls.CheckRevocationStatus();
                        break;
                    default:
                        MessageBox.Show("Select User Selected - event args : " + toolsForm.e + " - sender : " + toolsForm.sender + " - tag " + toolsForm.tag);
                        break;

                }
            }

            log("BHO.IOleCommandTarget", "Exec", " - exec DONE!! " + res);
            return 0;
        }