public void InitializeRepository() { isBusy = true; progress.UpdateProgress(0, 100, "Initializing..."); var thread = new Thread(() => { var success = true; try { var targetPath = NPath.CurrentDirectory; var gitignore = targetPath.Combine(".gitignore"); var gitAttrs = targetPath.Combine(".gitattributes"); var assetsGitignore = targetPath.Combine("Assets", ".gitignore"); var filesForInitialCommit = new List <string> { gitignore, gitAttrs, assetsGitignore }; GitClient.Init().RunWithReturn(true); progress.UpdateProgress(10, 100, "Initializing..."); ConfigureMergeSettings(); progress.UpdateProgress(20, 100, "Initializing..."); GitClient.LfsInstall().RunWithReturn(true); progress.UpdateProgress(30, 100, "Initializing..."); AssemblyResources.ToFile(ResourceType.Generic, ".gitignore", targetPath, Environment); AssemblyResources.ToFile(ResourceType.Generic, ".gitattributes", targetPath, Environment); assetsGitignore.CreateFile(); GitClient.Add(filesForInitialCommit).RunWithReturn(true); progress.UpdateProgress(60, 100, "Initializing..."); GitClient.Commit("Initial commit", null).RunWithReturn(true); progress.UpdateProgress(70, 100, "Initializing..."); Environment.InitializeRepository(); UsageTracker.IncrementProjectsInitialized(); } catch (Exception ex) { Logger.Error(ex, "A problem ocurred initializing the repository"); progress.UpdateProgress(90, 100, "Failed to initialize repository"); success = false; } if (success) { progress.UpdateProgress(90, 100, "Initializing..."); RestartRepository(); TaskManager.RunInUI(InitializeUI); progress.UpdateProgress(100, 100, "Initialized"); } isBusy = false; }); thread.Start(); }
private void OnOAuthCallback(string state, string code) { TaskManager.RunInUI(() => { if (state.Equals(oAuthState)) { isBusy = true; authenticationService.LoginWithOAuthCode(code, (b, s) => TaskManager.RunInUI(() => DoOAuthCodeResult(b, s))); } }); }
private void ConnectionsChanged() { if (!ThreadingHelper.InUIThread) { TaskManager.RunInUI(Redraw); } else { Redraw(); } }
public override void UpdateProgress(IProgress progress) { lock (lck) { repositoryProgress = progress; if (repositoryProgress != null && progress != null) { repositoryProgress.UpdateProgress(progress.Value, progress.Total, progress.Message); } repositoryProgressHasUpdate = true; } if (!ThreadingHelper.InUIThread) { TaskManager.RunInUI(Redraw); } else { Redraw(); } }