private async void TabbedAnythingForm_VisibleChanged(object sender, EventArgs e)
        {
            LOG.DebugFormat("Visible Changed - Visible: {0}", this.Visible);
            if (this.Visible)
            {
                DateTime lastUpdatePromptTime = Settings.Default.LastUpdatePromptTime;
                DateTime now        = DateTime.Now;
                TimeSpan difference = now - lastUpdatePromptTime;
                var      inject     = new {
                    lastUpdatePromptTime = lastUpdatePromptTime,
                    now        = now,
                    difference = difference
                };
                LOG.DebugInject("Visible Changed - Last Update Prompt Time: {lastUpdatePromptTime} - Now: {now} - Difference: {difference}", inject);
                if (difference >= TimeSpan.FromDays(1))
                {
                    Version newestVersion = await TabbedAnythingUtil.IsUpToDate();

                    if (newestVersion != null)
                    {
                        LOG.DebugFormat("Newest Version: {0}", newestVersion);

                        if (DialogResult.Yes == MessageBox.Show("A new version of Tabbed Anything is available. Update now?\n\nNote: This will exit Tabbed Anything.", "New Update", MessageBoxButtons.YesNo))
                        {
                            LOG.Debug("Update Prompt: Yes");
                            Settings.Default.LastUpdatePromptTime = DateTime.MinValue;
                            Settings.Default.Save();

                            if (await TabbedAnythingUtil.UpdateApplication(newestVersion))
                            {
                                LOG.Debug("Update - Exiting Application");
                                Application.Exit();
                            }
                            else
                            {
                                LOG.Debug("Update - Error occurred");
                                MessageBox.Show("There was an error updating Tabbed Anything. Try again later.");
                            }
                        }
                        else
                        {
                            LOG.Debug("Update Prompt: No");
                            Settings.Default.LastUpdatePromptTime = now;
                            Settings.Default.Save();

                            MessageBox.Show("To update Tabbed Anything at a later date, go to Options->About and click Update.", "New Update", MessageBoxButtons.OK);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private async void AboutBox_Load(object sender, EventArgs e)
        {
            _newestVersion = await TabbedAnythingUtil.IsUpToDate();

            if (_newestVersion != null)
            {
                LOG.DebugFormat("Newer Version Available - New: {0} - Current: {1}", _newestVersion, AssemblyVersion);

                UpdateCheckLabel.Text = "Version {0} is available.".XFormat(_newestVersion.ToString(3));
                UpdateButton.Enabled  = true;
            }
            else
            {
                UpdateCheckLabel.Text = AssemblyTitle + " is up to date.";
                LOG.DebugFormat("Update to Date - Version: {0}", AssemblyVersion);
            }
        }
Ejemplo n.º 3
0
 private async void UpdateButton_Click(object sender, EventArgs e)
 {
     LOG.DebugFormat("Update Click - Newest Version: {0}", _newestVersion.ToString(3));
     if (DialogResult.Yes == MessageBox.Show("This will exit Tabbed Anything. Continue?", "New Update", MessageBoxButtons.YesNo))
     {
         LOG.Debug("Update Prompt - OK");
         if (await TabbedAnythingUtil.UpdateApplication(_newestVersion))
         {
             LOG.Debug("Update - Exiting Application");
             Application.Exit();
         }
         else
         {
             LOG.Debug("Update - Error occurred");
             MessageBox.Show("There was an error updating Tabbed Anything. Try again later.");
         }
     }
 }
Ejemplo n.º 4
0
        static void Main(String[] args)
        {
            LOG.DebugFormat("Application Startup - Args: {0}", String.Join(", ", args));
            LOG.DebugFormat("Version: {0}", Assembly.GetExecutingAssembly().GetName().Version);

            Application.ThreadException += Application_ThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            if (!TabbedAnythingUtil.VerifyAssemblyVersions())
            {
                return;
            }

            Arguments a = new Arguments();

            if (CommandLine.Parser.Default.ParseArguments(args, a))
            {
                Mutex mutex = new Mutex(true, "{3a39a5c1-fac2-4059-81d4-5018abfa5142}+" + a.ProcessName);

                if (mutex.WaitOne(TimeSpan.Zero, true))
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    LOG.Debug("Starting Tabbed Anything");
                    Application.Run(ProgramForm.Create(a.Startup, a.ProcessName));
                    mutex.ReleaseMutex();
                }
                else
                {
                    LOG.Debug("Tabbed Anything instance already exists");
                    ProgramForm.ShowMe(a.ProcessName);
                }
            }

            LOG.Debug("Application End");
        }