private void OnPropertyChanged(string name)
 {
     if (PropertyChanged != null)
     {
         UiDispatcher.RunOnUIThread(() =>
         {
             PropertyChanged(this, new PropertyChangedEventArgs(name));
         });
     }
 }
        public MainWindow()
        {
            UiDispatcher.Initialize();
            InitializeComponent();
            TranscriptView.ItemsSource = model.Entries;
            UpdateButtons();
            this.Visibility             = Visibility.Hidden;
            this.model.PropertyChanged += OnModelChanged;
            this.syncPositions          = SyncButton.IsChecked == true;

            Task.Run(async() =>
            {
                this.settings = await Settings.LoadAsync();
                this.settings.PropertyChanged += OnSettingsPropertyChanged;
                UiDispatcher.RunOnUIThread(RestoreSettings);
            });
        }
            private void OnDelayTimerTick(object state)
            {
                int endTime = Environment.TickCount;
                int diff    = startTime - endTime;

                Action a = this.delayedAction;

                StopDelayTimer();

                if (a != null)
                {
                    UiDispatcher.RunOnUIThread(() =>
                    {
                        try
                        {
                            a();
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine("OnDelayTimerTick caught unhandled exception: " + ex.ToString());
                        }
                    });
                }
            }