Пример #1
0
        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);
        }
Пример #2
0
 /// <summary>Helper method that moves the focus to the supplied FileStatusList</summary>
 private bool FocusFileList(FileStatusList fileStatusList)
 {
     fileStatusList.Focus();
     return true;
 }
Пример #3
0
 /// <summary>Helper method that moves the focus to the supplied FileStatusList</summary>
 private void FocusFileList(FileStatusList fileStatusList)
 {
     fileStatusList.Focus();
 }
Пример #4
0
        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;
        }
Пример #5
0
        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);
                }
            }
        }
Пример #6
0
        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);
                }
            }
        }
Пример #7
0
 /// <summary>Helper method that moves the focus to the supplied FileStatusList</summary>
 private bool FocusFileList(FileStatusList fileStatusList)
 {
     fileStatusList.Focus();
     return(true);
 }
Пример #8
0
 /// <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;
 }
Пример #9
0
        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;
        }