Ejemplo n.º 1
0
        public static async Task <bool> FasterFetch(String repo)
        {
            if (Settings.Default.ConfirmFasterFetch)
            {
                using ConfirmationDialog dialog = new ConfirmationDialog("Faster Fetch", "Faster Fetch uses settings previously configured in the Fast Fetch dialog.\n\nDo you want to continue?");
                if (dialog.ShowDialog() == DialogResult.Yes)
                {
                    if (dialog.DoNotAskAgain)
                    {
                        Settings.Default.ConfirmFasterFetch = false;
                        Settings.Default.Save();
                    }
                }
                else
                {
                    return(false);
                }
            }

            bool tags         = Settings.Default.FastFetchTagsChecked;
            bool prune        = Settings.Default.FastFetchPruneChecked;
            bool progress     = Settings.Default.FastFetchShowProgress;
            int  maxProcesses = Settings.Default.FastFetchMaxProcesses;

            await FastFetchDialog.Fetch(repo + " - " + "Faster Fetch", "Faster Fetch Completed", repo, tags, prune, progress, maxProcesses);

            return(true);
        }
 private bool ConfirmClose()
 {
     if (!this.Visible)
     {
         return(true);
     }
     else if (_tags.Count == 0)
     {
         return(true);
     }
     else if (Settings.Default.ConfirmOnClose)
     {
         using ConfirmationDialog dialog = new ConfirmationDialog(Text, "Are you sure you want to exit?");
         if (dialog.ShowDialog() == DialogResult.Yes)
         {
             if (dialog.DoNotAskAgain)
             {
                 Settings.Default.ConfirmOnClose = false;
                 Settings.Default.Save();
             }
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 3
0
        private async void TabbedTortoiseGitForm_Shown(object?sender, EventArgs e)
        {
            LOG.Debug($"{nameof( TabbedTortoiseGitForm_Shown )}");

            if (!_skipUpdateCheck)
            {
                DateTime lastUpdatePromptTime = Settings.Default.LastUpdatePromptTime;
                DateTime now        = DateTime.Now;
                TimeSpan difference = now - lastUpdatePromptTime;
                LOG.Debug($"{nameof( TabbedTortoiseGitForm_Shown )} - Last Update Prompt Time: {lastUpdatePromptTime} - Now: {now} - Difference: {difference}");
                if (difference >= TimeSpan.FromDays(1))
                {
                    Version?newestVersion = await TTG.IsUpToDate();

                    if (newestVersion != null)
                    {
                        LOG.Debug($"Newest Version: {newestVersion}");

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

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

                            MessageBox.Show("To update Tabbed TortoiseGit at a later date, go to Options->About and click Update.", "New Update", MessageBoxButtons.OK);
                        }
                    }
                }
            }

            if (Settings.Default.CheckTortoiseGitOnPath)
            {
                if (!(await GitAction.CanAccessTortoiseGit()))
                {
                    using ConfirmationDialog dialog = new ConfirmationDialog("Cannot access TortoiseGit", "TortoiseGit does not appear to be on PATH (this will prevent Tabbed TortoiseGit from being able to open logs). Update PATH environment variable to include directory for TortoiseGitProc.exe.");
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        if (dialog.DoNotAskAgain)
                        {
                            Settings.Default.CheckTortoiseGitOnPath = false;
                            Settings.Default.Save();
                        }
                    }
                }
            }

            if (_showStartUpRepos)
            {
                await OpenStartupRepos();
            }

            if (Settings.Default.ShouldShowChangelog)
            {
                Settings.Default.ShouldShowChangelog = false;

                if (Settings.Default.ShowChangelogOnUpdate)
                {
                    ChangelogDialog.ShowChangelog();
                }
            }
        }