예제 #1
0
 /// <inheritdoc />
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     // current dispatcher is the UI thread for the App
     WpfDispatcher.Initialize(Dispatcher.CurrentDispatcher);
     Globals.Dispatcher = new WpfDispatcher();
 }
        private static void Show(Action action)
        {
            var dispatcher = WpfDispatcher.Create();

            dispatcher !.Invoke(action);
            dispatcher.InvokeShutdown();
            _ = dispatcher.Thread.Join(1000);
        }
예제 #3
0
        /// <summary>
        /// Creates the specified dispatcher.
        /// </summary>
        /// <param name="dispatcher">The dispatcher.</param>
        /// <returns>The correct IDispatcher.</returns>
        public static IDispatcher Create(Dispatcher dispatcher)
        {
            IDispatcher result = null;
            if (dispatcher != null)
            {
#if SILVERLIGHT
                result = new SilverlightDispatcher(dispatcher);
#else
                result = new WpfDispatcher(dispatcher);
#endif
            }
            return result;
        }
        public static void Show(Bitmap?expected, Bitmap actual)
        {
            if (actual is null)
            {
                throw new System.ArgumentNullException(nameof(actual));
            }

            var dispatcher = WpfDispatcher.Create();

            dispatcher !.Invoke(() =>
            {
                var window = new ImageDiffWindow(expected, actual);
                _          = window.ShowDialog();
            });

            dispatcher.InvokeShutdown();
            _ = dispatcher.Thread.Join(1000);
        }
예제 #5
0
// properties *are* initialized within the constructor. However by a method call, which is not correctly recognized by the code analyzer yet.
#pragma warning disable CS8618 // warning about uninitialized non-nullable properties
        public MainViewModel(IViewProvider viewProvider)
#pragma warning restore CS8618
        {
            var pathResolver = new PathResolver();

            _fileWatch = new FileWatchDistributedNotificationReceiver(pathResolver);
            _trayIcon  = new TrayIconHandle();
            _trayIcon.ExitRequested       += TrayIconOnExitRequested;
            _trayIcon.ShowWindowRequested += TrayIconOnShowWindowRequested;
            var dispatcher = new WpfDispatcher();

            _coreSetup = new CoreSetup(pathResolver, _fileWatch, dispatcher);
            _coreSetup.PipelineUpdated += CoreSetup_PipelineUpdated;
            _coreSetup.DistributedNotificationReceived += CoreSetup_DistributedNotificationReceived;
            _configurationApplication = new ConfigurationApplication(_coreSetup.Configuration);
            _configurationApplication.ApplyChanges();
            GlobalErrorLogTarget.ErrorOccured += GlobalErrorLog_ErrorOccurred;
            _popupService   = new PopupService(this, viewProvider);
            _windowSettings = new WindowSettings(pathResolver.WindowSettingsFilePath);
            _updateUrls     = new UpdateUrls();
            Initialize();
        }