Exemple #1
0
        /// <summary>Brings up a dialog that says it requires Bloom Enterprise and provides a button to the settings</summary>
        /// <param name="windowOwner">The WinForms control that owns the resulting dialog</param>
        /// <param name="title">The title of the new window. Optional - the title isn't very discoverable at all</param>
        /// <param name="width">The width of the dialog, in pixels. Optional - defaults to 280px</param>
        /// <param name="height">The height of the dialog in pixels. Optional - defaults to 235px, which allows twice as many lines as needed for the English version of the dialog</param>
        internal static void ShowRequiresEnterpriseNotice(IWin32Window windowOwner, string title = null, int width = 280, int height = 235)
        {
            using (var dlg = new ReactDialog("requiresBloomEnterpriseBundle", null, title))
            {
                dlg.Width  = width;
                dlg.Height = height;

                dlg.ShowDialog(windowOwner);
            }
        }
Exemple #2
0
        /// <summary>
        /// Use this to create any ReactDialog from within an API handler which has requiresSync == true (the default).
        /// Otherwise, our server is still locked, and all kinds of things the dialog wants to do through the server won't work.
        /// Instead, we arrange for it to be launched when the system is idle (and the server is no longer locked).
        /// </summary>
        /// <param name="reactComponent">passed to ReactDialog constructor</param>
        /// <param name="props">passed to ReactDialog constructor</param>
        /// <param name="width">used to set the WinForms dialog Width property</param>
        /// <param name="height">used to set the WinForms dialog Height property</param>
        /// <param name="initialize">an optional action done after width and height are set but before ShowDialog is called</param>
        /// <param name="handleResult">an optional action done after the dialog is closed; takes a DialogResult</param>
        /// <param name="taskBarTitle">Label to show in the task bar for this form</param>
        public static void ShowOnIdle(string reactComponentName, object props, int width, int height,
                                      Action initialize = null, Action <DialogResult> handleResult = null, string taskBarTitle = "Bloom")
        {
            DoOnceOnIdle(() =>
            {
                using (var dlg = new ReactDialog(reactComponentName, props, taskBarTitle))
                {
                    dlg.Width  = width;
                    dlg.Height = height;

                    initialize?.Invoke();

                    var result = dlg.ShowDialog();

                    handleResult?.Invoke(result);
                }
            });
        }
 public static string Show(IWin32Window owner, string messageHtml, MessageBoxButton[] rightButtons, MessageBoxIcon icon = MessageBoxIcon.None)
 {
     using (var dlg = new ReactDialog("messageBoxBundle", new
     {
         messageHtml,
         rightButtonDefinitions = rightButtons,
         icon = icon.ToString().ToLowerInvariant(),
         closeWithAPICall = true
     }))
     {
         dlg.Width  = 500;
         dlg.Height = 200;
         // This dialog is neater without a task bar. We don't need to be able to
         // drag it around. There's nothing left to give it one if we don't set a title
         // and remove the control box.
         dlg.ControlBox = false;
         dlg.ShowDialog(owner);
         return(dlg.CloseSource);
     }
 }