Esempio n. 1
0
        static void ShowVoiceOverNotice()
        {
            var alert = new NSAlert();

            alert.MessageText     = GettextCatalog.GetString("Assistive Technology Detected");
            alert.InformativeText = GettextCatalog.GetString("{0} has detected an assistive technology (such as VoiceOver) is running. Do you want to restart {0} and enable the accessibility features?", BrandingService.ApplicationName);
            alert.AddButton(GettextCatalog.GetString("Restart and enable"));
            alert.AddButton(GettextCatalog.GetString("No"));

            var result = alert.RunModal();

            switch (result)
            {
            case 1000:
                NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults;
                defaults.SetBool(true, EnabledKey);
                defaults.Synchronize();

                IdeApp.Restart();
                break;

            default:
                break;
            }
        }
        void RestartButtonClicked(object sender, EventArgs e)
        {
            ApplyChanges();

            IdeApp.Restart(true).Ignore();

            // The following does not work. The dialog is always null.
            var dialog = (widget?.Toplevel as Gtk.Dialog);

            dialog?.Respond(Gtk.ResponseType.Ok);
        }
Esempio n. 3
0
        public SdkLocationWidget(SdkLocationPanel panel) : base(false, 12)
        {
            this.panel = panel;

            this.PackStart(new Label()
            {
                Markup = "<b>" + GLib.Markup.EscapeText(panel.Label) + "</b>",
                Xalign = 0f,
            });
            var alignment = new Alignment(0f, 0f, 1f, 1f)
            {
                LeftPadding = 24
            };

            this.PackStart(alignment);
            var vbox        = new VBox(false, 6);
            var locationBox = new HBox(false, 6);
            var messageBox  = new HBox(false, 6);

            alignment.Add(vbox);
            vbox.PackStart(messageBox, false, false, 0);
            vbox.PackStart(locationBox, false, false, 0);
            locationBox.PackStart(new Label(GettextCatalog.GetString("Location:")), false, false, 0);
            locationBox.PackStart(locationEntry, true, true, 0);
            messageBox.PackStart(messageIcon, false, false, 0);
            messageBox.PackStart(messageLabel, true, true, 0);
            messageLabel.Xalign = 0f;

            string location = panel.LoadSdkLocationSetting();

            locationEntry.Path = location ?? "";

            locationEntry.PathChanged += delegate {
                Validate();
            };
            Validate();

            if (panel.RequiresRestart)
            {
                PackStart(new HSeparator(), false, false, 0);

                var tableRestart = new RestartPanel();
                tableRestart.RestartRequested += (sender, e) => {
                    ApplyChanges();
                    IdeApp.Restart(true).Ignore();
                };

                PackStart(tableRestart, false, false, 0);
            }

            ShowAll();
        }
Esempio n. 4
0
            public override void HandleException(string message, Exception e)
            {
                base.HandleException(message, e);

                if (e is IOException)
                {
                    return;
                }

                if (!IdeApp.IsInitialized)
                {
                    Console.WriteLine(e);
                    return;
                }

                var text          = GettextCatalog.GetString("There was a problem loading one or more extensions and {0} needs to be restarted.", BrandingService.ApplicationName);
                var quitButton    = new AlertButton(Strings.Quit);
                var restartButton = new AlertButton(Strings.Restart);

                var result = MessageService.GenericAlert(
                    IdeServices.DesktopService.GetFocusedTopLevelWindow(),
                    Gui.Stock.Error,
                    text,
                    secondaryText: null,
                    defaultButton: 1,
                    quitButton,
                    restartButton
                    );

                if (result == restartButton)
                {
                    IdeApp.Restart(false).Ignore();
                }
                else
                {
                    IdeApp.Exit().Ignore();
                }
            }
 void RestartClicked(object sender, System.EventArgs e)
 {
     Store();
     IdeApp.Restart(true);
 }
Esempio n. 6
0
        public SdkLocationWidget(SdkLocationPanel panel) : base(false, 12)
        {
            this.panel = panel;

            this.PackStart(new Label()
            {
                Markup = "<b>" + GLib.Markup.EscapeText(panel.Label) + "</b>",
                Xalign = 0f,
            });
            var alignment = new Alignment(0f, 0f, 1f, 1f)
            {
                LeftPadding = 24
            };

            this.PackStart(alignment);
            var vbox        = new VBox(false, 6);
            var locationBox = new HBox(false, 6);
            var messageBox  = new HBox(false, 6);

            alignment.Add(vbox);
            vbox.PackStart(messageBox, false, false, 0);
            vbox.PackStart(locationBox, false, false, 0);
            locationBox.PackStart(new Label(GettextCatalog.GetString("Location:")), false, false, 0);
            locationBox.PackStart(locationEntry, true, true, 0);
            messageBox.PackStart(messageIcon, false, false, 0);
            messageBox.PackStart(messageLabel, true, true, 0);
            messageLabel.Xalign = 0f;

            string location = panel.LoadSdkLocationSetting();

            locationEntry.Path = location ?? "";

            locationEntry.PathChanged += delegate {
                Validate();
            };
            Validate();

            if (panel.RequiresRestart)
            {
                PackStart(new HSeparator(), false, false, 0);

                var tableRestart = new Table(2, 3, false)
                {
                    RowSpacing = 6, ColumnSpacing = 6
                };

                var btnRestart = new Button()
                {
                    Label    = GettextCatalog.GetString("Restart {0}", BrandingService.ApplicationName),
                    CanFocus = true, UseUnderline = true
                };
                tableRestart.Attach(btnRestart, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

                var imageRestart = new ImageView("md-information", IconSize.Menu);
                tableRestart.Attach(imageRestart, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

                var labelRestart = new Label(GettextCatalog.GetString("These preferences will take effect next time you start {0}", BrandingService.ApplicationName));
                tableRestart.Attach(labelRestart, 1, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

                PackStart(tableRestart, false, false, 0);

                btnRestart.Clicked += (sender, e) => {
                    ApplyChanges();
                    IdeApp.Restart(true);
                };
            }

            ShowAll();
        }
 void RestartButtonClicked(object sender, EventArgs e)
 {
     IdeApp.Restart(true).Ignore();
 }
 void RestartClicked(object sender, System.EventArgs e)
 {
     Store();
     IdeApp.Restart(true).Ignore();
     (Toplevel as Gtk.Dialog)?.Respond(Gtk.ResponseType.Ok);
 }