コード例 #1
0
        // We know this is clumsy, but its a .NET-ism --
        // Form widgets can *only* be controlled by the thread that creates them.
        // Thus, we make this guarantee by wrapping all creation & processing actions
        // in a method called by just one thread.  <sigh>
        private static void PopupDialogViaDelegate(AsyncCompletionToken completionToken,
                                                   string toonName,
                                                   string dialogTitle,
                                                   string dialogMessage,
                                                   string expiryActionName,
                                                   int expiryRemainingInSeconds,
                                                   bool isBotStopAllowed,
                                                   bool isStopOnContinue,
                                                   SystemSound soundCue,
                                                   int soundPeriodInSeconds)
        {
            UserDialogForm dialogForm = new UserDialogForm(completionToken,
                                                           toonName,
                                                           dialogTitle,
                                                           dialogMessage,
                                                           expiryActionName,
                                                           expiryRemainingInSeconds,
                                                           isBotStopAllowed,
                                                           isStopOnContinue,
                                                           soundCue,
                                                           soundPeriodInSeconds);

            // Making the main Honorbuddy window the popup's parent--
            // This will bring the popup window to the front any time Honorbuddy is brought to the front.
            Form windowParent = (Form)Control.FromHandle(Process.GetCurrentProcess().MainWindowHandle);

            // Popup the window
            dialogForm.Activate();
            dialogForm.ShowDialog(windowParent);
        }
コード例 #2
0
ファイル: UserDialog.cs プロジェクト: ywjb/Honorbuddy-434
        // We know this is clumsy, but its a .NET-ism --
        // Form widgets can *only* be controlled by the thread that creates them.
        // Thus, we make this guarantee by wrapping all creation & processing actions
        // in a method called by just one thread.  <sigh>
        private static void PopupDialogViaDelegate(AsyncCompletionToken completionToken,
                                                   string toonName,
                                                   string dialogTitle,
                                                   string dialogMessage,
                                                   string expiryActionName,
                                                   int expiryRemainingInSeconds,
                                                   bool isBotStopAllowed,
                                                   bool isStopOnContinue,
                                                   SystemSound soundCue,
                                                   int soundPeriodInSeconds)
        {
            UserDialogForm dialogForm = new UserDialogForm(completionToken,
                                                           toonName,
                                                           dialogTitle,
                                                           dialogMessage,
                                                           expiryActionName,
                                                           expiryRemainingInSeconds,
                                                           isBotStopAllowed,
                                                           isStopOnContinue,
                                                           soundCue,
                                                           soundPeriodInSeconds);

            // Popup the window--
            // We'd *really* like to make this dialog a child of the main Honorbuddy window.
            // By doing such, the dialog would be 'brought to the front' any time te Honorbuddy main
            // window was.
            // Alas, C#/WindowsForms disallows this because the main HB GUI and this dialog are
            // on separate threads.
            dialogForm.TopMost = true;
            dialogForm.Activate();
            dialogForm.ShowDialog();
        }
コード例 #3
0
ファイル: UserDialog.cs プロジェクト: ywjb/Honorbuddy-434
 public override void WrapUp(UserDialogForm userDialogForm)
 {
     userDialogForm.buttonContinueProfile.Enabled = true;
     if (userDialogForm._isBotStopAllowed)
     {
         userDialogForm.buttonStopBot.Enabled = true;
     }
 }
コード例 #4
0
ファイル: UserDialog.cs プロジェクト: ywjb/Honorbuddy-434
 public override void WrapUp(UserDialogForm userDialogForm)
 {
     userDialogForm._completionToken.PopdownResponse = PopdownReason.ContinueViaExpiry;
     userDialogForm.Close();
 }
コード例 #5
0
ファイル: UserDialog.cs プロジェクト: ywjb/Honorbuddy-434
 public override void Initialize(UserDialogForm userDialogForm)
 {
     userDialogForm.buttonContinueProfile.Enabled = true;
     userDialogForm.buttonStopBot.Enabled         = true;
 }
コード例 #6
0
ファイル: UserDialog.cs プロジェクト: ywjb/Honorbuddy-434
 public abstract void WrapUp(UserDialogForm userDialogForm);
コード例 #7
0
ファイル: UserDialog.cs プロジェクト: ywjb/Honorbuddy-434
 public abstract void Initialize(UserDialogForm userDialogForm);