Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            _databaseInteractions = new DatabaseInteractions();

            _positionManager = new WindowPositionHandler(this, "Main");

#if (!DEBUG)
            Task.Factory.StartNew(() =>
            {
                AppUpdateManager.Current.CheckForUpdates(false).ConfigureAwait(false);
            });
#endif

            AppUpdateManager.Current.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(AppUpdateManager.UpdateActionText) && AppUpdateManager.Current.UpdateActionText == "Restart")
                {
                    DropNewUpdatePanel.IsPopupOpen = true;
                }
            };

            DockSearch.Visibility = Visibility.Collapsed;

            Initialize();
        }
        public MainWindow()
        {
            InitializeComponent();
            positionManager = new WindowPositionHandler(this, "Main");

            Task.Factory.StartNew(() =>
            {
                Thread.Sleep(2000);
                var update = new Update();

                try
                {
                    if (update.IsUpdateAvailable)
                    {
                        update.DownloadUpdate();

                        if (MessageBox.Show("New update found, install now?", "Update found", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            update.InstallUpdate();
                        }
                    }
                }
                catch (Exception exc)
                {
                    logger.Error(exc, "Failed to process update.");
                }
            });

            DockSearch.Visibility = Visibility.Collapsed;
        }
 public static void AttachPositionHandler(this Window window, string windowName)
 {
     var handler = new WindowPositionHandler(window, windowName, true);
 }