Пример #1
0
        public void LoadingThread()
        {
            Thread.Sleep(1000);
            //Zuerst alles Laden, danach das geladene wieder Speichern. (Zur Sichertheit)
            int which = MWDS.Ints["SelectedHardware",0];
            if (which == 0)
            {
                HWC = new HardwareAPI.HardwareController();
            }
            else
            {
                try
                {
                    HWC = new AerotechHardware.AerotechHardwareController();
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message+"\n\nPlease restart your PC, check the service or select the correct HardwareController with a restart of LaserControl!", "Connection Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    MWDS.Ints["SelectedHardware"] = -1;
                    Environment.Exit(0);
                }
            }
            HWC.Save();

            Thread.Sleep(1000);
            FunctionLib.Load();

            this.Dispatcher.Invoke(new Action(() =>
            {
                this.Close();
            }));
        }
Пример #2
0
        public void LoadingThread()
        {
            Thread.Sleep(1000);
            //Zuerst alles Laden, danach das geladene wieder Speichern. (Zur Sichertheit)
            int which = MWDS.Ints["SelectedHardware", 0];

            if (which == 0)
            {
                HWC = new HardwareAPI.HardwareController();
            }
            else
            {
                try
                {
                    HWC = new AerotechHardware.AerotechHardwareController();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + "\n\nPlease restart your PC, check the service or select the correct HardwareController with a restart of LaserControl!", "Connection Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    MWDS.Ints["SelectedHardware"] = -1;
                    Environment.Exit(0);
                }
            }
            HWC.Save();


            Thread.Sleep(1000);
            FunctionLib.Load();

            this.Dispatcher.Invoke(new Action(() =>
            {
                this.Close();
            }));
        }