コード例 #1
0
        private void BackgroundFasterFetch_Click(object?sender, EventArgs e)
        {
            TabControllerTag?controller = this.LogTabs.SelectedTab?.Controller();

            if (controller != null)
            {
                if (controller.BackgroundFasterFetchDialog?.Completed == true)
                {
                    controller.BackgroundFasterFetchDialog.Close();
                    controller.BackgroundFasterFetchDialog = null;
                }

                if (controller.BackgroundFasterFetchDialog != null)
                {
                    return;
                }

                String repo = Git.GetBaseRepoDirectoryOrError(controller.RepoItem);

                ProgressDialog dialog = FastFetchDialog.PrepareBackgroundFasterFetch(repo);
                controller.BackgroundFasterFetchDialog = dialog;

                dialog.ProgressCompleted += delegate(object?sender2, EventArgs e2)
                {
                    if (!controller.Process.HasExited)
                    {
                        Native.SendKeyDown(controller.Process.MainWindowHandle, Keys.F5);
                    }

                    if (!dialog.Visible)
                    {
                        dialog.Close();
                    }
                };

                dialog.FormClosed += delegate(object?sender2, FormClosedEventArgs e2)
                {
                    controller.BackgroundFasterFetchDialog = null;

                    UpdateToolStripFasterFetch();
                };

                dialog.ProgressChanged   += BackgroundFasterFetchDialog_ProgressChanged;
                dialog.ProgressCompleted += BackgroundFasterFetchDialog_ProgressChanged;

                dialog.DoProgress();

                UpdateToolStripFasterFetch();
            }
        }