/// <summary>
 /// Starts the serial port detector.
 /// </summary>
 public void Start()
 {
     SingleInstanceApplication.Current.Exit += OnApplicationExit;
     _dispatcher     = OSDispatcher.Current;
     _ports          = new ObservableCollection <string>();
     _availablePorts = new ReadOnlyObservableCollection <string>(_ports);
     _detectorThread = new Thread(new ThreadStart(this.Detect));
     _detectorThread.Start();
 }
            public void Invoke(OSDispatcher dispatcher, System.Action action, bool waitUntilDone)
            {
                DebugOutput("^^^^^^^^^^^^^^^ PERFORM from thread: " + NSThread.Current.Handle + ", MAIN: " + NSThread.MainThread.Handle + ", DISPATCHER: " + dispatcher.NativeDispatcher.Handle);
                var currentThread = NSThread.Current;

                if ((dispatcher.NativeDispatcher == currentThread) && waitUntilDone)
                {
                    action();
                }
                else
                {
                    DispatcherObject.PerformSelector(new Selector(OSDispatcher.ActionSelectorName), dispatcher.NativeDispatcher, new SelectorArgument(action), waitUntilDone);
                }
            }
 private void Initialize(ISettings settings)
 {
     AppDomain.CurrentDomain.UnhandledException += OnDomainUnhandledException;
     PluginsLocation = GetPluginsDirectory();
     OSInitialize();
     _mainDispatcher = OSDispatcher.Current;
     this.DoImport();
     if (settings != null)
     {
         _settings.Add(settings);
     }
     AddStartupAction("FileMemoPrimer", FileMemoPrimer.Start, StartupTaskPriority.HighestSyncTaskPriority);
     if (INTV.Shared.Properties.Settings.Default.CheckForAppUpdatesAtLaunch)
     {
         AddStartupAction(CheckForUpdatesStartupActionName, () => ApplicationCommandGroup.CheckForUpdatesCommand.Execute(true), StartupTaskPriority.LowestAsyncTaskPriority);
     }
 }