Beispiel #1
0
        private void ApplicationStartup(object sender, StartupEventArgs e)
        {
            DoHandleUnexpectedExceptions = true;
            try
            {
                //#if DEBUG
                //#else
                AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
                //#endif

                FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

                CommonUserSettings.InitializeCommonSettings(ELLO.Properties.Settings.Default);
                // setup the JumpList features before testing for single application as otherwise the JumpList can be reset
                JumpList jumpList = JumpList.GetJumpList(Current);

                JumpTask jt = new JumpTask
                {
                    Title            = "Edit application settings",
                    ApplicationPath  = SettingPath(ApplicationName + ".Config", App.ApplicationName),
                    IconResourcePath = @"c:\windows\notepad.exe",
                    Description      = "Edit the application configuration file to customise settings",
                    CustomCategory   = "Customise"
                };
                jumpList.JumpItems.Add(jt);

                jt = new JumpTask
                {
                    Arguments        = LogPath(ApplicationName + ".Log"),
                    Title            = "Open MotionControlManager log",
                    ApplicationPath  = @"c:\windows\notepad.exe",
                    IconResourcePath = @"c:\windows\notepad.exe",
                    Description      = "Open the diagnostics log",
                    CustomCategory   = "Logging"
                };
                jumpList.JumpItems.Add(jt);

                jumpList.Apply();

                // Create the View Model for the Main Window
                _mainWindowViewModel = new MainWindowViewModel(e.Args);

                // Set it as the DataContext for Binding and Commanding
                _mainWindow = new MainWindow(_mainWindowViewModel);

                _mainWindow.Show();
                Thread.Sleep(500);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Caught exception: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #2
0
 /// <summary> Default constructor. </summary>
 public ELLDevicesViewModel()
 {
     MaxSearchLimit   = 'F';
     MinSearchLimit   = '0';
     SelectedPort     = CommonUserSettings.ReadUserSetting("DevicePort", "Com1");
     ShowTxLoggedCmds = CommonUserSettings.ReadUserSetting("ShowTxOutput", true);
     ShowRxLoggedCmds = CommonUserSettings.ReadUserSetting("ShowRxOutput", true);
     ValidAddress     = _ellDevice.ValidAddress;
     AvailablePorts   = SerialPort.GetPortNames().ToList();
     if (!AvailablePorts.Contains(SelectedPort))
     {
         SelectedPort = AvailablePorts.Count > 0 ? AvailablePorts[0] : "";
     }
     IsConnected             = false;
     _commsLogStore          = new List <OutputItem>();
     CommsLog                = new ObservableCollection <OutputItem>(_commsLogStore);
     BackgroundThreadManager = new BackgroundThreadManager();
     _ellDevice.MessageUpdates.OutputUpdate    += OutputUpdate;
     _ellDevice.MessageUpdates.ParameterUpdate += ParameterUpdate;
     _sequenceViewModel = new ELLSequenceViewModel(this, _ellDevice);
     UpdateUI();
 }