示例#1
0
        /// <summary>
        ///     Raises the <see cref="E:System.Windows.Application.Exit" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.Windows.ExitEventArgs" /> that contains the event data.</param>
        protected override void OnExit(ExitEventArgs e)
        {
            try
            {
                if (UpdatePresent)
                {
                    UpdateHelper.StartUpgrade(RestartReadiMonAfterUpdate);
                }
            }
            catch (Exception exc)
            {
                Trace.WriteLine(exc);
            }

            base.OnExit(e);
        }
示例#2
0
        /// <summary>
        /// Checks for update.
        /// </summary>
        /// <returns></returns>
        public bool?CheckForUpdate( )
        {
            if (UpdateHelper.DoesUpdateExist( ))
            {
                Application.App.UpdatePresent = true;

                var result = MessageBox.Show("ReadiMon Update available.\nDo you wish to update now?", "Update Available", MessageBoxButton.YesNo);

                if (result == MessageBoxResult.Yes)
                {
                    Application.App.RestartReadiMonAfterUpdate = true;

                    System.Windows.Application.Current.Shutdown( );

                    return(true);
                }
                return(null);
            }

            return(false);
        }
示例#3
0
        /// <summary>
        ///     Raises the <see cref="E:System.Windows.Application.Startup" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs" /> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Current.Exit += Application_Exit;

            if (e.Args.Length > 0)
            {
                RunConsoleVersion(e.Args);
            }
            else
            {
                if (Settings.Default.AutoUpdate)
                {
                    ThreadPool.QueueUserWorkItem(s =>
                    {
                        UpdatePresent = UpdateHelper.DoesUpdateExist( );
                    });
                }

                RunGuiVersion( );
            }
        }