예제 #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
        // 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
 public override void WrapUp(UserDialogForm userDialogForm)
 {
     userDialogForm.buttonContinueProfile.Enabled = true;
     if (userDialogForm._isBotStopAllowed)
     {
         userDialogForm.buttonStopBot.Enabled = true;
     }
 }
예제 #4
0
 public override void WrapUp(UserDialogForm userDialogForm)
 {
     userDialogForm._completionToken.PopdownResponse = PopdownReason.ContinueViaExpiry;
     userDialogForm.Close();
 }
예제 #5
0
 public override void Initialize(UserDialogForm userDialogForm)
 {
     userDialogForm.buttonContinueProfile.Enabled = true;
     userDialogForm.buttonStopBot.Enabled         = true;
 }
예제 #6
0
 public abstract void WrapUp(UserDialogForm userDialogForm);
예제 #7
0
 public abstract void Initialize(UserDialogForm userDialogForm);