private DropDownMenu GetSliceOptionsMenuDropList()
        {
            DropDownMenu sliceOptionsMenuDropList;

            sliceOptionsMenuDropList = new DropDownMenu("Profile".Localize() + "... ")
            {
                HoverColor        = new RGBA_Bytes(0, 0, 0, 50),
                NormalColor       = new RGBA_Bytes(0, 0, 0, 0),
                BorderColor       = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100),
                BackgroundColor   = new RGBA_Bytes(0, 0, 0, 0),
                BorderWidth       = 1,
                MenuAsWideAsItems = false,
                AlignToRightEdge  = true,
            };
            sliceOptionsMenuDropList.Name     = "Slice Settings Options Menu";
            sliceOptionsMenuDropList.VAnchor |= VAnchor.ParentCenter;

            sliceOptionsMenuDropList.AddItem("Import".Localize()).Selected += (s, e) => { ImportSettingsMenu_Click(); };
            sliceOptionsMenuDropList.AddItem("Export".Localize()).Selected += (s, e) => { WizardWindow.Show <ExportSettingsPage>("ExportSettingsPage", "Export Settings"); };

            MenuItem settingsHistory = sliceOptionsMenuDropList.AddItem("Settings History".Localize());

            settingsHistory.Selected += (s, e) => { WizardWindow.Show <PrinterProfileHistoryPage>("PrinterProfileHistory", "Settings History"); };

            settingsHistory.Enabled = !string.IsNullOrEmpty(AuthenticationData.Instance.ActiveSessionUsername);

            sliceOptionsMenuDropList.AddItem("Reset to defaults".Localize()).Selected += (s, e) => { UiThread.RunOnIdle(ResetToDefaults); };

            return(sliceOptionsMenuDropList);
        }
Exemplo n.º 2
0
        private DropDownMenu GetSliceOptionsMenuDropList()
        {
            if (sliceOptionsMenuDropList == null)
            {
                sliceOptionsMenuDropList = new DropDownMenu("Options".Localize() + "... ")
                {
                    HoverColor        = new RGBA_Bytes(0, 0, 0, 50),
                    NormalColor       = new RGBA_Bytes(0, 0, 0, 0),
                    BorderColor       = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100),
                    BackgroundColor   = new RGBA_Bytes(0, 0, 0, 0),
                    BorderWidth       = 1,
                    MenuAsWideAsItems = false,
                    AlignToRightEdge  = true,
                };
                sliceOptionsMenuDropList.VAnchor          |= VAnchor.ParentCenter;
                sliceOptionsMenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged);

                //Set the name and callback function of the menu items
                slicerOptionsMenuItems = new TupleList <string, Func <bool> >
                {
                    { "Import".Localize(), ImportSettingsMenu_Click },
                    { "Export".Localize(), () => { WizardWindow.Show <ExportSettingsPage>("ExportSettingsPage", "Export Settings"); return(true); } },
                    { "Settings History".Localize(), () => { WizardWindow.Show <PrinterProfileHistoryPage>("PrinterProfileHistory", "Profile History"); return(true); } },
                    { "Reset to defaults".Localize(), () => { UiThread.RunOnIdle(ResetToDefaults); return(true); } },
                };

                //Add the menu items to the menu itself
                foreach (Tuple <string, Func <bool> > item in slicerOptionsMenuItems)
                {
                    sliceOptionsMenuDropList.AddItem(item.Item1);
                }
            }

            return(sliceOptionsMenuDropList);
        }
Exemplo n.º 3
0
        private void onConnectButton_Click(object sender, EventArgs mouseEvent)
        {
            if (ActiveSliceSettings.Instance == null)
            {
#if __ANDROID__
                WizardWindow.Show();
#else
                PrinterActionRow.OpenConnectionWindow(true);
#endif
            }
            else
            {
#if __ANDROID__
                if (!FrostedSerialPort.HasPermissionToDevice())
                {
                    // Opens the USB device permissions dialog which will call back into our UsbDevice broadcast receiver to connect
                    FrostedSerialPort.RequestPermissionToDevice();
                }
                else
#endif
                {
                    ConnectToActivePrinter();
                }
            }
        }
Exemplo n.º 4
0
        public static void OpenConnectionWindow(bool connectAfterSelection = false)
        {
            if (connectAfterSelection)
            {
                ActiveSliceSettings.ActivePrinterChanged.RegisterEvent(ConnectToActivePrinter, ref staticUnregisterEvents);
            }

            WizardWindow.Show();
        }
Exemplo n.º 5
0
        private DropDownMenu GetSliceOptionsMenuDropList()
        {
            DropDownMenu sliceOptionsMenuDropList;

            sliceOptionsMenuDropList = new DropDownMenu("Options".Localize() + "... ")
            {
                HoverColor        = new RGBA_Bytes(0, 0, 0, 50),
                NormalColor       = new RGBA_Bytes(0, 0, 0, 0),
                BorderColor       = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100),
                BackgroundColor   = new RGBA_Bytes(0, 0, 0, 0),
                BorderWidth       = 1,
                MenuAsWideAsItems = false,
                AlignToRightEdge  = true,
            };
            sliceOptionsMenuDropList.Name     = "Slice Settings Options Menu";
            sliceOptionsMenuDropList.VAnchor |= VAnchor.ParentCenter;


            showHelpBox = new CheckBox("Show Help".Localize());

            if (primarySettingsView)
            {
                // only turn on the help if in the main view and it is set to on
                showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true";
            }

            showHelpBox.CheckedStateChanged += (s, e) =>
            {
                if (primarySettingsView)
                {
                    // only save the help settings if in the main view
                    UserSettings.Instance.set(SliceSettingsShowHelpEntry, showHelpBox.Checked.ToString().ToLower());
                }
                ShowHelpChanged?.Invoke(this, null);
            };

            MenuItem showHelp = new MenuItem(showHelpBox, "Show Help Checkbox")
            {
                Padding = sliceOptionsMenuDropList.MenuItemsPadding,
            };

            sliceOptionsMenuDropList.MenuItems.Add(showHelp);
            sliceOptionsMenuDropList.AddHorizontalLine();

            sliceOptionsMenuDropList.AddItem("Import".Localize()).Selected += (s, e) => { ImportSettingsMenu_Click(); };
            sliceOptionsMenuDropList.AddItem("Export".Localize()).Selected += (s, e) => { WizardWindow.Show <ExportSettingsPage>("ExportSettingsPage", "Export Settings"); };

            MenuItem settingsHistory = sliceOptionsMenuDropList.AddItem("Restore Settings".Localize());

            settingsHistory.Selected += (s, e) => { WizardWindow.Show <PrinterProfileHistoryPage>("PrinterProfileHistory", "Restore Settings"); };

            settingsHistory.Enabled = !string.IsNullOrEmpty(AuthenticationData.Instance.ActiveSessionUsername);

            sliceOptionsMenuDropList.AddItem("Reset to Defaults".Localize()).Selected += (s, e) => { UiThread.RunOnIdle(ResetToDefaults); };

            return(sliceOptionsMenuDropList);
        }
Exemplo n.º 6
0
 void icon_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         icon.ContextMenuStrip.Show();
     }
     else
     {
         MainWindow = new WizardWindow();
         MainWindow.Show();
         MainWindow.Focus();
     }
 }
Exemplo n.º 7
0
        private void AddChildElements()
        {
            FlowLayoutWidget tempWidgets = new FlowLayoutWidget();

            tempWidgets.VAnchor = VAnchor.ParentBottomTop;

            tempWidgets.Width = 120;

            extruderTemperatureWidget = new TemperatureWidgetExtruder();
            //extruderTemperatureWidget.Margin = new BorderDouble(right: 6);
            extruderTemperatureWidget.VAnchor = VAnchor.ParentTop;

            bedTemperatureWidget         = new TemperatureWidgetBed();
            bedTemperatureWidget.VAnchor = VAnchor.ParentTop;

            tempWidgets.AddChild(extruderTemperatureWidget);
            tempWidgets.AddChild(new GuiWidget(6, 6));
            if (ActiveSliceSettings.Instance.GetValue <bool>(SettingsKey.has_heated_bed))
            {
                tempWidgets.AddChild(bedTemperatureWidget);
            }
            tempWidgets.AddChild(new GuiWidget(6, 6));

            FlowLayoutWidget printStatusContainer = CreateActivePrinterInfoWidget();

            PrintActionRow printActionRow = new PrintActionRow(queueDataView);

            printActionRow.VAnchor = VAnchor.ParentTop;

            ImageButtonFactory factory = new ImageButtonFactory();

            factory.InvertImageColor = false;

            setupButton         = factory.Generate(StaticData.Instance.LoadIcon("icon_gear_dot.png").InvertLightness(), null);
            setupButton.Margin  = new BorderDouble(left: 6);
            setupButton.VAnchor = VAnchor.ParentCenter;
            setupButton.Click  += (sender, e) =>
            {
                WizardWindow.Show <SetupOptionsPage>("/SetupOptions", "Setup Wizard");
                //WizardWindow.Show(true);
            };

            this.AddChild(printStatusContainer);
            this.AddChild(printActionRow);
            this.AddChild(tempWidgets);
            this.AddChild(setupButton);
            this.Height = 80;

            UpdatePrintStatus();
            UpdatePrintItemName();
        }
Exemplo n.º 8
0
        public App()
        {
            var config = new NLog.Config.LoggingConfiguration();

            // Setup loggers.
            var logfile = new NLog.Targets.FileTarget("logfile")
            {
                FileName = "file.txt"
            };
            var logconsole = new NLog.Targets.ConsoleTarget("logconsole");

            // Rules for mapping loggers.
            config.AddRule(LogLevel.Debug, LogLevel.Fatal, logconsole);
            config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);

            // Apply configuration to logger.
            LogManager.Configuration = config;

            // Initialize MessageBus Using Dispatcher
            Action <Action> uiThreadMarshaller =
                action => Dispatcher.Invoke(DispatcherPriority.Normal, action);

            Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            // Configure the tray icon.
            Assembly a  = Assembly.GetExecutingAssembly();
            Stream   st = a.GetManifestResourceStream("Brizbee.Integration.Utility.Images.favicon.ico");

            icon.Icon    = new Icon(st);
            icon.Visible = true;
            icon.ShowBalloonTip(2000, "BRIZBEE Integration Utility", "Started", ToolTipIcon.Info);
            icon.MouseClick += icon_MouseClick;

            var strip = new ContextMenuStrip();

            strip.Items.Add("Open...");
            strip.Items.Add("-");
            strip.Items.Add("Send Log Files...");
            strip.Items.Add("-");
            strip.Items.Add("Exit");

            strip.ItemClicked += contexMenuStrip_ItemClicked;

            icon.ContextMenuStrip = strip;

            // Show the main window on first startup.
            MainWindow = new WizardWindow();
            MainWindow.Show();
            MainWindow.Focus();
        }
Exemplo n.º 9
0
        void contexMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            var item = e.ClickedItem;

            if (item.Text == "Open...")
            {
                MainWindow = new WizardWindow();
                MainWindow.Show();
            }
            else if (item.Text == "Send Log Files...")
            {
                var sendLogWindow = new SendLogWindow();
                sendLogWindow.Show();
            }
            else if (item.Text == "Exit")
            {
                Current.Shutdown();
            }
        }
Exemplo n.º 10
0
 private bool ImportSettingsMenu_Click()
 {
     UiThread.RunOnIdle(() => WizardWindow.Show <ImportSettingsPage>("ImportSettingsPage", "Import Settings Page"));
     return(true);
 }
Exemplo n.º 11
0
        protected override void AddChildElements()
        {
            actionBarButtonFactory.invertImageLocation = false;
            actionBarButtonFactory.borderWidth         = 1;
            if (ActiveTheme.Instance.IsDarkTheme)
            {
                actionBarButtonFactory.normalBorderColor = new RGBA_Bytes(77, 77, 77);
            }
            else
            {
                actionBarButtonFactory.normalBorderColor = new RGBA_Bytes(190, 190, 190);
            }
            actionBarButtonFactory.hoverBorderColor = new RGBA_Bytes(128, 128, 128);

            string connectString = "Connect".Localize().ToUpper();

            connectPrinterButton             = actionBarButtonFactory.Generate(connectString, "icon_power_32x32.png");
            connectPrinterButton.ToolTipText = "Connect to the currently selected printer".Localize();
            if (ApplicationController.Instance.WidescreenMode)
            {
                connectPrinterButton.Margin = new BorderDouble(0, 0, 3, 3);
            }
            else
            {
                connectPrinterButton.Margin = new BorderDouble(6, 0, 3, 3);
            }
            connectPrinterButton.VAnchor = VAnchor.ParentTop;
            connectPrinterButton.Cursor  = Cursors.Hand;

            string disconnectString = "Disconnect".Localize().ToUpper();

            disconnectPrinterButton             = actionBarButtonFactory.Generate(disconnectString, "icon_power_32x32.png");
            disconnectPrinterButton.ToolTipText = "Disconnect from current printer".Localize();
            if (ApplicationController.Instance.WidescreenMode)
            {
                disconnectPrinterButton.Margin = new BorderDouble(0, 0, 3, 3);
            }
            else
            {
                disconnectPrinterButton.Margin = new BorderDouble(6, 0, 3, 3);
            }
            disconnectPrinterButton.VAnchor = VAnchor.ParentTop;
            disconnectPrinterButton.Cursor  = Cursors.Hand;

            string resetConnectionText = "Reset\nConnection".Localize().ToUpper();

            resetConnectionButton = actionBarButtonFactory.Generate(resetConnectionText, "e_stop4.png");
            if (ApplicationController.Instance.WidescreenMode)
            {
                resetConnectionButton.Margin = new BorderDouble(0, 0, 3, 3);
            }
            else
            {
                resetConnectionButton.Margin = new BorderDouble(6, 0, 3, 3);
            }

            // Bind connect button states to active printer state
            this.SetConnectionButtonVisibleState();

            actionBarButtonFactory.invertImageLocation = true;

            this.AddChild(connectPrinterButton);
            this.AddChild(disconnectPrinterButton);

            FlowLayoutWidget printerSelectorAndEditButton = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.ParentLeftRight,
            };

            int rightMarginForWideScreenMode = ApplicationController.Instance.WidescreenMode ? 6 : 0;

            printerSelector = new PrinterSelector()
            {
                HAnchor = HAnchor.ParentLeftRight,
                Cursor  = Cursors.Hand,
                Margin  = new BorderDouble(0, 6, rightMarginForWideScreenMode, 3)
            };
            printerSelector.AddPrinter += (s, e) => WizardWindow.Show();
            printerSelector.MinimumSize = new Vector2(printerSelector.MinimumSize.x, connectPrinterButton.MinimumSize.y);
            printerSelectorAndEditButton.AddChild(printerSelector);

            Button editButton = TextImageButtonFactory.GetThemedEditButton();

            editButton.VAnchor = VAnchor.ParentCenter;
            editButton.Click  += UiNavigation.GoToEditPrinter_Click;
            printerSelectorAndEditButton.AddChild(editButton);
            this.AddChild(printerSelectorAndEditButton);

            this.AddChild(resetConnectionButton);
        }
Exemplo n.º 12
0
        protected void AddChildElements()
        {
            addButton             = textImageButtonFactory.GenerateTooltipButton("Add".Localize(), StaticData.Instance.LoadIcon("icon_circle_plus.png", 32, 32).InvertLightness());
            addButton.ToolTipText = "Add a file to be printed".Localize();
            addButton.Margin      = new BorderDouble(6, 6, 6, 3);

            startButton             = textImageButtonFactory.GenerateTooltipButton("Print".Localize(), StaticData.Instance.LoadIcon("icon_play_32x32.png", 32, 32).InvertLightness());
            startButton.Name        = "Start Print Button";
            startButton.ToolTipText = "Begin printing the selected item.".Localize();
            startButton.Margin      = new BorderDouble(6, 6, 6, 3);
            startButton.Click      += onStartButton_Click;

            configureButton             = textImageButtonFactory.GenerateTooltipButton("Finish Setup...".Localize());
            configureButton.Name        = "Finish Setup Button";
            configureButton.ToolTipText = "Run setup configuration for printer.".Localize();
            configureButton.Margin      = new BorderDouble(6, 6, 6, 3);
            configureButton.Click      += onStartButton_Click;

            connectButton             = textImageButtonFactory.GenerateTooltipButton("Connect".Localize(), StaticData.Instance.LoadIcon("icon_power_32x32.png", 32, 32).InvertLightness());
            connectButton.ToolTipText = "Connect to the printer".Localize();
            connectButton.Margin      = new BorderDouble(6, 6, 6, 3);
            connectButton.Click      += (s, e) =>
            {
                if (ActiveSliceSettings.Instance.PrinterSelected)
                {
#if __ANDROID__
                    if (!FrostedSerialPort.HasPermissionToDevice())
                    {
                        // Opens the USB device permissions dialog which will call back into our UsbDevice broadcast receiver to connect
                        FrostedSerialPort.RequestPermissionToDevice(RunTroubleShooting);
                    }
                    else
#endif
                    {
                        PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
                        PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter(true);
                    }
                }
            };

            addPrinterButton             = textImageButtonFactory.GenerateTooltipButton("Add Printer".Localize());
            addPrinterButton.ToolTipText = "Select and add a new printer.".Localize();
            addPrinterButton.Margin      = new BorderDouble(6, 6, 6, 3);
            addPrinterButton.Click      += (s, e) =>
            {
                UiThread.RunOnIdle(() => WizardWindow.ShowPrinterSetup(true));
            };

            selectPrinterButton             = textImageButtonFactory.GenerateTooltipButton("Select Printer".Localize());
            selectPrinterButton.ToolTipText = "Select an existing printer.".Localize();
            selectPrinterButton.Margin      = new BorderDouble(6, 6, 6, 3);
            selectPrinterButton.Click      += (s, e) =>
            {
                WizardWindow.Show <SetupOptionsPage>("/SetupOptions", "Setup Wizard");
            };

            string resetConnectionButtontText   = "Reset".Localize();
            string resetConnectionButtonMessage = "Reboots the firmware on the controller".Localize();
            resetConnectionButton             = textImageButtonFactory.GenerateTooltipButton(resetConnectionButtontText, StaticData.Instance.LoadIcon("e_stop4.png", 32, 32).InvertLightness());
            resetConnectionButton.ToolTipText = resetConnectionButtonMessage;
            resetConnectionButton.ToolTipText = resetConnectionButtonMessage;
            resetConnectionButton.Margin      = new BorderDouble(6, 6, 6, 3);

            string skipButtonText    = "Skip".Localize();
            string skipButtonMessage = "Skip the current item and move to the next in queue".Localize();
            skipButton = makeButton(skipButtonText, skipButtonMessage);

            string removeButtonText    = "Remove".Localize();
            string removeButtonMessage = "Remove current item from queue".Localize();
            removeButton        = makeButton(removeButtonText, removeButtonMessage);
            removeButton.Click += onRemoveButton_Click;

            string pauseButtonText    = "Pause".Localize();
            string pauseButtonMessage = "Pause the current print".Localize();
            pauseButton        = makeButton(pauseButtonText, pauseButtonMessage);
            pauseButton.Click += (s, e) =>
            {
                PrinterConnectionAndCommunication.Instance.RequestPause();
                pauseButton.Enabled = false;
            };
            this.AddChild(pauseButton);
            allPrintButtons.Add(pauseButton);

            string cancelCancelButtonText     = "Cancel Connect".Localize();
            string cancelConnectButtonMessage = "Stop trying to connect to the printer.".Localize();
            cancelConnectButton = makeButton(cancelCancelButtonText, cancelConnectButtonMessage);

            string cancelButtonText    = "Cancel".Localize();
            string cancelButtonMessage = "Stop the current print".Localize();
            cancelButton      = makeButton(cancelButtonText, cancelButtonMessage);
            cancelButton.Name = "Cancel Print Button";

            string resumeButtonText    = "Resume".Localize();
            string resumeButtonMessage = "Resume the current print".Localize();
            resumeButton        = makeButton(resumeButtonText, resumeButtonMessage);
            resumeButton.Name   = "Resume Button";
            resumeButton.Click += (s, e) =>
            {
                if (PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
                {
                    PrinterConnectionAndCommunication.Instance.Resume();
                }
                pauseButton.Enabled = true;
            };

            this.AddChild(resumeButton);
            allPrintButtons.Add(resumeButton);

            string reprintButtonText    = "Print Again".Localize();
            string reprintButtonMessage = "Print current item again".Localize();
            reprintButton      = makeButton(reprintButtonText, reprintButtonMessage);
            reprintButton.Name = "Print Again Button";

            string doneCurrentPartButtonText    = "Done".Localize();
            string doenCurrentPartButtonMessage = "Move to next print in queue".Localize();
            doneWithCurrentPartButton      = makeButton(doneCurrentPartButtonText, doenCurrentPartButtonMessage);
            doneWithCurrentPartButton.Name = "Done Button";

            this.Margin  = new BorderDouble(0, 0, 10, 0);
            this.HAnchor = HAnchor.FitToChildren;

            this.AddChild(connectButton);
            allPrintButtons.Add(connectButton);

            this.AddChild(addPrinterButton);
            allPrintButtons.Add(addPrinterButton);

            this.AddChild(selectPrinterButton);
            allPrintButtons.Add(selectPrinterButton);

            this.AddChild(addButton);
            allPrintButtons.Add(addButton);

            this.AddChild(startButton);
            allPrintButtons.Add(startButton);

            this.AddChild(configureButton);
            allPrintButtons.Add(configureButton);

            this.AddChild(doneWithCurrentPartButton);
            allPrintButtons.Add(doneWithCurrentPartButton);

            this.AddChild(skipButton);
            allPrintButtons.Add(skipButton);

            this.AddChild(cancelButton);
            allPrintButtons.Add(cancelButton);

            this.AddChild(cancelConnectButton);
            allPrintButtons.Add(cancelConnectButton);

            this.AddChild(reprintButton);
            allPrintButtons.Add(reprintButton);

            this.AddChild(removeButton);
            allPrintButtons.Add(removeButton);

            this.AddChild(resetConnectionButton);
            allPrintButtons.Add(resetConnectionButton);

            SetButtonStates();
        }
Exemplo n.º 13
0
 void RunTroubleShooting()
 {
     WizardWindow.Show <SetupWizardTroubleshooting>("TroubleShooting", "Trouble Shooting");
 }
Exemplo n.º 14
0
        protected override void Run()
        {
            // On an English system, the user can change the language to Japanese, so
            // detect the user language, and not the system.
            var code        = int.Parse(this.Engine.FormatString("[UserUILanguageID]"));
            var cultureInfo = CultureInfo.GetCultureInfo(code);

            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;
            Localisation.Culture = cultureInfo;

            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
                                                                   XmlLanguage.GetLanguage(cultureInfo.IetfLanguageTag)));
            try
            {
                this.Engine.CloseSplashScreen();

                InitializeP4Variables();

                FormatVersionForPage();

                var rebootPending = this.Engine.StringVariables["RebootPending"];
                if (!string.IsNullOrEmpty(rebootPending) && rebootPending != "0")
                {
                    if (this.Command.Display == Display.Full)
                    {
                        MessageBox.Show(
                            string.Format(Localisation.WixBootstrapper_RestartPendingDialogBody, this.BundleName),
                            string.Format(Localisation.WixBootstrapper_RestartPendingDialogTitle, this.BundleName),
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);
                    }
                    this.Engine.Quit(3010);
                }

                this.Engine.Log(LogLevel.Verbose, "Launching Burn frontend");
                BootstrapperDispatcher = Dispatcher.CurrentDispatcher;
                AppDomain.CurrentDomain.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.ExceptionObject}");
                };
                BootstrapperDispatcher.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.Exception}");
                };

                RootView         = new WizardWindow(this);
                RootView.Closed += (sender, args) => BootstrapperDispatcher.InvokeShutdown();

                this.Engine.Detect();

                //System.Diagnostics.Debugger.Launch();
                if (this.Command.Display == Display.Passive || this.Command.Display == Display.Full)
                {
                    RootView.Show();
                    Dispatcher.Run();
                }

                this.Engine.Quit(RootView.ViewModel.Status);
            }
            catch (Exception e)
            {
                this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {e}");
                throw e;
            }
        }
Exemplo n.º 15
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            switch (ActionType)
            {
            case "ExpandAndCollapse":
                if (dgInvItem.ItemsSource == null)
                {
                    return;
                }
                setExpandAndCollapse(dgInvItem.IsMasterRowExpanded(0));
                break;

            case "HierarichalInvBOMReport":

                if (dgInvItem.SelectedItem != null)
                {
                    var selectedInvItem = dgInvItem.SelectedItem as InvItemClient;
                    AddDockItem(TabControls.InventoryHierarchicalBOMStatement, selectedInvItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("HierarchicalBOM"), selectedInvItem._Item));
                }
                else if (childDgInvBom.SelectedItem != null)
                {
                    var selectedInvBomClient = childDgInvBom.SelectedItem as InvBOMClient;
                    AddDockItem(TabControls.InventoryHierarchicalBOMStatement, selectedInvBomClient.InvItemPart, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("HierarchicalBOM"), selectedInvBomClient.InvItemPart._Item));
                }
                break;

            case "AddNestedProperty":
                if (dgInvItem.SelectedItem != null)
                {
                    gridRibbon_BaseActions(ActionType);
                    return;
                }

                var          selectedItem     = childDgInvBom.SelectedItem as InvBOMClient;
                WizardWindow nestedPropDialog = new WizardWindow(new SelectNestedPropWizardView(childDgInvBom.TableTypeUser, api.CompanyEntity, selectedItem), Uniconta.ClientTools.Localization.lookup("AddNestedProperty"),
                                                                 setHeight: false);
#if WPF
                nestedPropDialog.Width  = System.Convert.ToDouble(System.Windows.SystemParameters.PrimaryScreenWidth) * 0.35;
                nestedPropDialog.Height = System.Convert.ToDouble(System.Windows.SystemParameters.PrimaryScreenHeight) * 0.45;
#else
                if (Application.Current.IsRunningOutOfBrowser)
                {
                    nestedPropDialog.Width  = Application.Current.Host.Content.ActualWidth * 0.35;
                    nestedPropDialog.Height = Application.Current.Host.Content.ActualHeight * 0.45;
                }
                else
                {
                    nestedPropDialog.Width  = System.Convert.ToDouble(System.Windows.Browser.HtmlPage.Window.Eval("screen.width")) * 0.35;
                    nestedPropDialog.Height = System.Convert.ToDouble(System.Windows.Browser.HtmlPage.Window.Eval("screen.height")) * 0.45;
                }
#endif
                nestedPropDialog.MinHeight = 450.0d;
                nestedPropDialog.MinWidth  = 620.0d;

                nestedPropDialog.Closed += delegate
                {
                    if (nestedPropDialog.DialogResult == true)
                    {
                        var selectedProperties = nestedPropDialog.WizardData as IList <NestedPropertyObject>;
                        if (selectedProperties?.Count > 0)
                        {
                            foreach (var prop in selectedProperties)
                            {
                                NestedColumn.CreatePropertyOnGrid(childDgInvBom, prop.PropertyName, prop.PropertyType, prop.DisplayName);
                            }
                        }
                    }
                };
                nestedPropDialog.Show();
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
Exemplo n.º 16
0
        protected override void Run()
        {
            var code        = int.Parse(this.Engine.FormatString("[SystemLanguageID]"));
            var cultureInfo = CultureInfo.GetCultureInfo(code);

            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;
            Localisation.Culture = cultureInfo;

            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
                                                                   XmlLanguage.GetLanguage(cultureInfo.IetfLanguageTag)));
            try
            {
                this.Engine.CloseSplashScreen();

                var rebootPending = this.Engine.StringVariables["RebootPending"];
                if (!string.IsNullOrEmpty(rebootPending) && rebootPending != "0")
                {
                    if (this.Command.Display == Display.Full)
                    {
                        MessageBox.Show(
                            string.Format(Localisation.WixBootstrapper_RestartPendingDialogBody, this.BundleName),
                            string.Format(Localisation.WixBootstrapper_RestartPendingDialogTitle, this.BundleName),
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);
                    }
                    this.Engine.Quit(3010);
                }

                this.Engine.Log(LogLevel.Verbose, "Launching Burn frontend");
                BootstrapperDispatcher = Dispatcher.CurrentDispatcher;
                AppDomain.CurrentDomain.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.ExceptionObject}");
                };
                BootstrapperDispatcher.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.Exception}");
                };

                RootView         = new WizardWindow(this);
                RootView.Closed += (sender, args) => BootstrapperDispatcher.InvokeShutdown();

                this.Engine.Detect();

                foreach (var commandLineArg in this.Command.GetCommandLineArgs())
                {
                    if (commandLineArg.StartsWith("InstallationType=", StringComparison.InvariantCultureIgnoreCase))
                    {
                        var param = commandLineArg.Split(new[] { '=' }, 2);
                        RootView.ViewModel.PackageCombinationConfiguration.InstallationType =
                            (InstallationType)Enum.Parse(typeof(InstallationType), param[1]);
                    }
                }
                if (this.Command.Display == Display.Passive || this.Command.Display == Display.Full)
                {
                    RootView.Show();
                    Dispatcher.Run();
                }

                this.Engine.Quit(RootView.ViewModel.Status);
            }
            catch (Exception e)
            {
                this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {e}");
                throw e;
            }
        }
Exemplo n.º 17
0
        private void FrmRibbon_OnItemClicked(string ActionType)
        {
            editrow._smtpPassword = txtSmptPwd.Text;
            switch (ActionType)
            {
            case "TestMail":
                CWCommentsDialogBox dialog = new CWCommentsDialogBox(Uniconta.ClientTools.Localization.lookup("VerifyPOP3"), Uniconta.ClientTools.Localization.lookup("Email"));
#if !SILVERLIGHT
                dialog.DialogTableId = 2000000043;
#endif
                dialog.Closing += async delegate
                {
                    if (dialog.DialogResult == true)
                    {
                        if (!string.IsNullOrEmpty(dialog.Comments) && Utilities.Utility.EmailValidation(dialog.Comments))
                        {
                            InvoiceAPI invapi = new InvoiceAPI(api);
                            busyIndicator.IsBusy = true;
                            var err = await invapi.TestSMTP(editrow, dialog.Comments);

                            if (err == ErrorCodes.Succes)
                            {
                                UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("SendEmailMsgOBJ"), Uniconta.ClientTools.Localization.lookup("Email")),
                                                        Uniconta.ClientTools.Localization.lookup("Message"));
                                isSMTPValidated            = true;
                                itemHost.IsEnabled         = false;
                                itemPort.IsEnabled         = false;
                                itemSmtpUser.IsEnabled     = false;
                                itemSmtpPassword.IsEnabled = false;
                                itemUseSSL.IsEnabled       = false;
                            }
                            else
                            {
                                ShowErrorMsg(err, editrow._host);
                            }
                            busyIndicator.IsBusy = false;
                        }
                        else
                        {
                            UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("InvalidValue"), Uniconta.ClientTools.Localization.lookup("Email"), dialog.Comments), Uniconta.ClientTools.Localization.lookup("Error"));
                        }
                    }
                };
                dialog.Show();
                break;

            case "SetUpEMail":
                var objWizardWindow = new WizardWindow(new UnicontaClient.Pages.EmailSetupWizard(), string.Format(Uniconta.ClientTools.Localization.lookup("CreateOBJ"),
                                                                                                                  Uniconta.ClientTools.Localization.lookup("EmailSetup")));
#if !SILVERLIGHT
                objWizardWindow.Width  = System.Convert.ToDouble(System.Windows.SystemParameters.PrimaryScreenWidth) * 0.14;
                objWizardWindow.Height = System.Convert.ToDouble(System.Windows.SystemParameters.PrimaryScreenHeight) * 0.20;
#else
                objWizardWindow.Width  = System.Convert.ToDouble(System.Windows.Browser.HtmlPage.Window.Eval("screen.width")) * 0.18;
                objWizardWindow.Height = System.Convert.ToDouble(System.Windows.Browser.HtmlPage.Window.Eval("screen.height")) * 0.16;
#endif
                objWizardWindow.MinHeight = 120.0d;
                objWizardWindow.MinWidth  = 350.0d;

                objWizardWindow.Closed += delegate
                {
                    if (objWizardWindow.DialogResult == true)
                    {
                        var emailSetup = objWizardWindow.WizardData as ServerInformation;
                        if (!string.IsNullOrEmpty(emailSetup?.User) && Utilities.Utility.EmailValidation(emailSetup?.User))
                        {
                            editrow.Host          = emailSetup.Host;
                            editrow.SmtpUser      = emailSetup.User;
                            editrow._smtpPassword = txtSmptPwd.Text = emailSetup.Password;
                            editrow.Port          = emailSetup.Port;
                            editrow.UseSSL        = emailSetup.SSL;
                        }
                        else
                        {
                            UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("InvalidValue"), Uniconta.ClientTools.Localization.lookup("Email"), emailSetup.User),
                                                    Uniconta.ClientTools.Localization.lookup("Warning"));
                        }
                    }
                };
                objWizardWindow.Show();
                break;

            case "Save":
                if (ValidateSMTP())
                {
                    //if (editrow.Html)
                    //{
                    //    if (!ContainsHTML(editrow.Body))
                    //        editrow.Html = false;
                    //}
                    frmRibbon_BaseActions(ActionType);
                }
                break;

            default:
                frmRibbon_BaseActions(ActionType);
                break;
            }
        }
Exemplo n.º 18
0
 public static void Show(MacroCommandData macroData)
 {
     WizardWindow.Show("Macro", "Running Macro", new RunningMacroPage(macroData));
 }