Ejemplo n.º 1
0
        public static void GoToPrinterSettings(string widgetNameToHighlight)
        {
            if (PrinterConnectionAndCommunication.Instance?.ActivePrinter?.ID != null)
            {
                Task.Run(() =>
                {
                    UiThread.RunOnIdle(() =>
                    {
                        WizardWindow.Show <EditPrinterSettingsPage>("EditSettings", "Edit Printer Settings");

                        EventHandler unregisterEvents = null;
                        ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s, e) =>
                        {
                            WizardWindow openWindowInternal = WizardWindow.GetSystemWindow("EditSettings");
                            if (openWindowInternal != null)
                            {
                                UiThread.RunOnIdle(() => openWindowInternal.Close());
                            }
                        }, ref unregisterEvents);

                        WizardWindow openWindow = WizardWindow.GetSystemWindow("EditSettings");
                        openWindow.Closed      += (s2, e2) =>
                        {
                            UiThread.RunOnIdle(() => unregisterEvents?.Invoke(s2, null));
                        };
                    });
                });
            }
        }