Exemplo n.º 1
0
        private void MIHardwareChangeBtn_Click(object sender, RoutedEventArgs e)
        {
            DataSafe         ds  = new DataSafe(Paths.SettingsPath, "MainWindow");
            HardwareSelector hws = new HardwareSelector(ds);

            if (hws.ShowDialog() == true)
            {
                MessageBox.Show("LaserControl will exit now. \nPlease open it again to apply the hardware change!", "Hardware changed exit", MessageBoxButton.OK, MessageBoxImage.Information);
                Environment.Exit(0);
            }
        }
Exemplo n.º 2
0
        public void StartupInit()
        {
            DataSafe ds = new DataSafe(Paths.SettingsPath, "MainWindow");

            if (!ds.containsKey("SelectedHardware") || ds.Ints["SelectedHardware"] < 0)
            {
                HardwareSelector hws = new HardwareSelector(ds);
                if (hws.ShowDialog() != true)
                {
                    Environment.Exit(0);
                }
            }
            LoadingWindow lw = new LoadingWindow(ds);

            lw.Load();

            this.WindowState = ds.Bools["Maximized", false] ? System.Windows.WindowState.Maximized : System.Windows.WindowState.Normal;
            this.HWC         = lw.HWC;
            CameraClickAndMove.SetHWC(this.HWC);

            //Init 1 CloseableTabItem
            Data.TabItems_Add(new CloseableTabItem("new"));

            // Init UI Elemente
            AxesControl.SetHardwareControllerAndInitGUI(HWC);
            IOControl.SetHardwareControllerAndInitGUI(HWC);

            //Verbinde EventHandler
            ScriptHandler.OnState1Changed += this.OnScriptHandlerStateChange_1;
            ScriptHandler.OnState2Changed += this.OnScriptHandlerStateChange_2;

            //Data.CodeTextFieldItems = new List<string>();
            //Load last X Commands
            List <string> s = new List <string>();
            int           x = ds.Ints["CodeTextFieldItemsCount", 0];

            for (int i = 0; i < x; ++i)
            {
                s.Add(ds.Strings["CTFI-" + i, ""]);
            }
            Data.CodeTextFieldItems = s;

#if TEST
            Tests.TestClass.RunTest(this, HWC);
#endif
        }