public bool StartPullDialog(bool pullOnShow) { if (!RequiresValidWorkingDir()) { return(false); } if (!InvokeEvent(PrePull)) { return(true); } FormPull formPull = new FormPull(); if (pullOnShow) { formPull.PullAndShowDialogWhenFailed(); } else { formPull.ShowDialog(); } InvokeEvent(PostPull); return(true); }
/// <summary> /// Starts pull dialog /// </summary> /// <param name="owner">An implementation of IWin32Window that will own the modal dialog box.</param> /// <param name="pullOnShow"></param> /// <param name="pullCompleted">true if pull completed with no errors</param> /// <returns>if revision grid should be refreshed</returns> public bool StartPullDialog(IWin32Window owner, bool pullOnShow, out bool pullCompleted) { pullCompleted = false; if (!RequiresValidWorkingDir()) { return(false); } if (!InvokeEvent(PrePull)) { return(true); } FormPull formPull = new FormPull(); DialogResult dlgResult; if (pullOnShow) { dlgResult = formPull.PullAndShowDialogWhenFailed(owner); } else { dlgResult = formPull.ShowDialog(owner); } if (dlgResult == DialogResult.OK) { InvokeEvent(PostPull); pullCompleted = !formPull.ErrorOccurred; } return(true);//maybe InvokeEvent should have 'needRefresh' out parameter? }
/// <summary> /// Starts pull dialog /// </summary> /// <param name="owner">An implementation of IWin32Window that will own the modal dialog box.</param> /// <param name="pullOnShow"></param> /// <param name="pullCompleted">true if pull completed with no errors</param> /// <returns>if revision grid should be refreshed</returns> public bool StartPullDialog(IWin32Window owner, bool pullOnShow, string remoteBranch, out bool pullCompleted, ConfigureFormPull configProc) { pullCompleted = false; if (!RequiresValidWorkingDir(owner)) return false; if (!InvokeEvent(owner, PrePull)) return true; using (FormPull formPull = new FormPull(this, remoteBranch)) { if (configProc != null) configProc(formPull); DialogResult dlgResult; if (pullOnShow) dlgResult = formPull.PullAndShowDialogWhenFailed(owner); else dlgResult = formPull.ShowDialog(owner); if (dlgResult == DialogResult.OK) { InvokeEvent(owner, PostPull); pullCompleted = !formPull.ErrorOccurred; } } return true;//maybe InvokeEvent should have 'needRefresh' out parameter? }
/// <summary> /// Starts pull dialog /// </summary> /// <param name="owner">An implementation of IWin32Window that will own the modal dialog box.</param> /// <param name="pullOnShow"></param> /// <param name="pullCompleted">true if pull completed with no errors</param> /// <returns>if revision grid should be refreshed</returns> public bool StartPullDialog(IWin32Window owner, bool pullOnShow, out bool pullCompleted) { pullCompleted = false; if (!RequiresValidWorkingDir()) return false; if (!InvokeEvent(owner, PrePull)) return true; FormPull formPull = new FormPull(); DialogResult dlgResult; if (pullOnShow) dlgResult = formPull.PullAndShowDialogWhenFailed(owner); else dlgResult = formPull.ShowDialog(owner); if (dlgResult == DialogResult.OK) { InvokeEvent(owner, PostPull); pullCompleted = !formPull.ErrorOccurred; } return true;//maybe InvokeEvent should have 'needRefresh' out parameter? }
/// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary> /// <param term='commandName'>The name of the command to execute.</param> /// <param term='executeOption'>Describes how the command should be run.</param> /// <param term='varIn'>Parameters passed from the caller to the command handler.</param> /// <param term='varOut'>Parameters passed from the command handler to the caller.</param> /// <param term='handled'>Informs the caller if the command was handled or not.</param> /// <seealso class='Exec' /> public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled) { try { //Settings.WorkingDir = handled = false; string fileName = _applicationObject.Solution.FileName; Settings.WorkingDir = @"f:\Dev";//fileName.Substring(0, fileName.LastIndexOf('\\')); if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault) { if (commandName == "GitPlugin.Connect.AddFiles") { FormAddFiles form = new FormAddFiles(); form.ShowDialog(); handled = true; return; } if (commandName == "GitPlugin.Connect.Branch") { FormBranch form = new FormBranch(); form.ShowDialog(); handled = true; return; } if (commandName == "GitPlugin.Connect.Browse") { FormBrowse form = new FormBrowse(); form.ShowDialog(); handled = true; return; } if (commandName == "GitPlugin.Connect.Checkout") { FormCheckout form = new FormCheckout(); form.ShowDialog(); handled = true; return; } if (commandName == "GitPlugin.Connect.Clone") { FormClone form = new FormClone(); form.ShowDialog(); ; handled = true; return; } if (commandName == "GitPlugin.Connect.Commit") { FormCommit formCommit = new FormCommit(); formCommit.ShowDialog(); handled = true; return; } if (commandName == "GitPlugin.Connect.Diff") { FormDiff formDiff = new FormDiff(); formDiff.ShowDialog(); handled = true; return; } if (commandName == "GitPlugin.Connect.Init") { InitDto dto = new InitDto(); Init init = new Init(dto); init.Execute(); MessageBox.Show(dto.Result); handled = true; return; } if (commandName == "GitPlugin.Connect.Patch") { MergePatch form = new MergePatch(); form.ShowDialog(); handled = true; return; } if (commandName == "GitPlugin.Connect.Pull") { FormPull form = new FormPull(); form.ShowDialog(); handled = true; return; } if (commandName == "GitPlugin.Connect.Push") { FormPull form = new FormPull(); form.ShowDialog(); handled = true; return; } } } catch { MessageBox.Show("ERROR!"); } }
void IContextMenu.InvokeCommand(IntPtr pici) { if (fileNames.Count == 1) if (Directory.Exists(fileNames[0])) GitCommands.Settings.WorkingDir = fileNames[0]; if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir) && fileNames.Count > 0) GitCommands.Settings.WorkingDir = fileNames[0].Substring(0, fileNames[0].LastIndexOf('\\')); if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir)) GitCommands.Settings.WorkingDir = Directory.GetCurrentDirectory(); try { Type typINVOKECOMMANDINFO = Type.GetType("ShellExt.INVOKECOMMANDINFO"); INVOKECOMMANDINFO ici = (INVOKECOMMANDINFO)Marshal.PtrToStructure(pici, typINVOKECOMMANDINFO); switch (ici.verb-1) { case 0://Add file { FormAddFiles form = new FormAddFiles(); form.Show(); break; } case 1://Branch { FormBranch form = new FormBranch(); form.Show(); break; } case 2://Browse { FormBrowse form = new FormBrowse(); form.Show(); break; } case 3://Checkout { FormCheckout form = new FormCheckout(); form.Show(); break; } case 4://Clone { FormClone form = new FormClone(); form.Show(); break; } case 5://Commit { FormCommit form = new FormCommit(); form.Show(); break; } case 6://Diff { FormDiff form = new FormDiff(); form.Show(); break; } case 7://Init { GitCommands.Init cmd = new GitCommands.Init(new GitCommands.InitDto()); cmd.Execute(); MessageBox.Show(cmd.Dto.Result); break; } case 8://File history { if (fileNames.Count > 0) { FormFileHistory form = new FormFileHistory(fileNames[0]); form.Show(); } break; } case 9://ViewPatch { ViewPatch patchapply = new ViewPatch(); patchapply.Show(); break; } case 10://MergePatch { MergePatch form = new MergePatch(); form.Show(); break; } case 11://Push { FormPush form = new FormPush(); form.Show(); break; } case 12://Pull { FormPull form = new FormPull(); form.Show(); break; } case 13://Bash { GitCommands.GitCommands.RunBash(); break; } case 14://Gui { GitCommands.GitCommands.RunGui(); break; } default: break; } } catch(Exception exe) { EventLog.WriteEntry("FileHashShell", exe.ToString()); } //fileNames }
public bool StartPullDialog(bool pullOnShow) { if (!RequiresValidWorkingDir()) return false; if (!InvokeEvent(PrePull)) return false; FormPull formPull = new FormPull(); DialogResult dlgResult; if (pullOnShow) dlgResult = formPull.PullAndShowDialogWhenFailed(); else dlgResult = formPull.ShowDialog(); bool result = dlgResult == DialogResult.OK; if (result) InvokeEvent(PostPull); return result; }
public bool StartPullDialog(bool pullOnShow) { if (!RequiresValidWorkingDir()) return false; if (!InvokeEvent(PrePull)) return true; FormPull formPull = new FormPull(); if (pullOnShow) formPull.PullAndShowDialogWhenFailed(); else formPull.ShowDialog(); InvokeEvent(PostPull); return true; }