public void FormCommit_Form1() { app = new ApplicationContext(); var currentDir = Directory.GetCurrentDirectory(); string[] args = new string[] { "", "", currentDir }; // GitExtensionsTest\bin\Debug if (args[2].EndsWith(@"bin\Debug")) args[2] = Path.GetFullPath(currentDir + @"\..\..\.."); var dir = RevisionGridTest.GetWorkingDir(args); Directory.SetCurrentDirectory(dir); GitUICommands uCommands = new GitUICommands(dir); Form = new FormCommitTest(uCommands); Unstaged = Form.ListUnstaged; Staged = Form.ListStaged; app.MainForm = Form; var browseForm = TestStatic.StartBrowseForm(uCommands, Form); Form.LoadModule(browseForm.Module); this.Unstaged.Subscribe(); this.Staged.Subscribe(); Form.Shown += Form_Shown; Form.Show(); Application.Run(app); }
/// <summary>Helper method that moves the focus to the supplied FileStatusList</summary> private bool FocusFileList(FileStatusList fileStatusList) { fileStatusList.Focus(); return true; }
/// <summary>Helper method that moves the focus to the supplied FileStatusList</summary> private void FocusFileList(FileStatusList fileStatusList) { fileStatusList.Focus(); }
private bool SenderToFileStatusList(object sender, out FileStatusList list) { if (sender is ToolStripMenuItem) { ToolStripMenuItem item = sender as ToolStripMenuItem; if (item.Owner is ContextMenuStrip) { ContextMenuStrip menu = item.Owner as ContextMenuStrip; if (menu.SourceControl is ListBox) { ListBox lb = menu.SourceControl as ListBox; if (lb.Parent is FileStatusList) { list = lb.Parent as FileStatusList; return true; } } } } list = null; return false; }
private void openContainingFolder(FileStatusList list) { foreach (var item in list.SelectedItems) { var fileNames = new StringBuilder(); fileNames.Append((Settings.WorkingDir + item.Name).Replace(Settings.PathSeparatorWrong, Settings.PathSeparator)); string filePath = fileNames.ToString(); if (File.Exists(filePath)) { Process.Start("explorer.exe", "/select, " + filePath); } } }
private void openContainingFolder(FileStatusList list) { foreach (var item in list.SelectedItems) { var fileNames = new StringBuilder(); fileNames.Append((Module.WorkingDir + item.Name).Replace(Settings.PathSeparatorWrong, Settings.PathSeparator)); string filePath = fileNames.ToString(); if (File.Exists(filePath)) { OsShellUtil.SelectPathInFileExplorer(filePath); } } }
/// <summary>Helper method that moves the focus to the supplied FileStatusList</summary> private bool FocusFileList(FileStatusList fileStatusList) { fileStatusList.Focus(); return(true); }
/// <summary>Helper method that moves the focus to the supplied FileStatusList</summary> private void FocusFileList(FileStatusList fileStatusList) { fileStatusList.Focus(); fileStatusList.SelectedItem = fileStatusList.GitItemStatuses.Count > 0 ? fileStatusList.GitItemStatuses[0] : null; }
public static IDisposable Subscribe(FileStatusList obj, Action<EventHandler> addHandler, Action<EventHandler> removeHandler) { IObservable<EventPattern<object>> observe = Observable.FromEventPattern( addHandler, removeHandler: removeHandler) //h => FileStatusListView.SelectedIndexChanged += h, //h => FileStatusListView.SelectedIndexChanged -= h) .Throttle(FileStatusList.SelectedIndexChangeThrottleDuration) .ObserveOn(SynchronizationContext.Current); IDisposable selectedIndexChangeSubscription = observe.Subscribe(x => obj.FileStatusListView_SelectedIndexChanged()); //IDisposable Subscribe(IObserver<T> observer); // GenericArguments[1], 'TEventArgs', on 'System.Reactive.IEventPattern`2[TSender,TEventArgs]' violates the constraint of type parameter 'TEventArgs'. // IDisposable Subscribe<T>(this IObservable<T> source, Action<T> onNext); return selectedIndexChangeSubscription; }