当前位置: 首页>>代码示例>>C#>>正文


C# FileStatusList类代码示例

本文整理汇总了C#中FileStatusList的典型用法代码示例。如果您正苦于以下问题:C# FileStatusList类的具体用法?C# FileStatusList怎么用?C# FileStatusList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileStatusList类属于命名空间,在下文中一共展示了FileStatusList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SenderToFileStatusList

        private bool SenderToFileStatusList(object sender, out FileStatusList list)
        {
            list = null;
            ToolStripMenuItem item = sender as ToolStripMenuItem;
            if (item == null)
                return false;

            ContextMenuStrip menu = item.Owner as ContextMenuStrip;
            if (menu == null)
                return false;

            ListView lv = menu.SourceControl as ListView;
            if (lv == null)
                return false;

            list = lv.Parent as FileStatusList;
            return (list != null);
        }
开发者ID:pcworld,项目名称:gitextensions,代码行数:18,代码来源:FormCommit.cs

示例2: FocusFileList

 /// <summary>Helper method that moves the focus to the supplied FileStatusList</summary>
 private void FocusFileList(FileStatusList fileStatusList)
 {
     fileStatusList.Focus();
 }
开发者ID:pcworld,项目名称:gitextensions,代码行数:5,代码来源:FormCommit.cs

示例3: OpenContainingFolder

        private void OpenContainingFolder(FileStatusList list)
        {
            foreach (var item in list.SelectedItems)
            {
                var fileNames = new StringBuilder();
                fileNames.Append((Path.Combine(Module.WorkingDir, item.Name)).Replace(Settings.PathSeparatorWrong, Settings.PathSeparator));

                string filePath = fileNames.ToString();
                if (File.Exists(filePath))
                {
                    OsShellUtil.SelectPathInFileExplorer(filePath);
                }
            }
        }
开发者ID:pcworld,项目名称:gitextensions,代码行数:14,代码来源:FormCommit.cs

示例4: OpenContainingFolder

        public static void OpenContainingFolder(FileStatusList diffFiles, GitModule module)
        {
            if (!diffFiles.SelectedItems.Any())
                return;

            foreach (var item in diffFiles.SelectedItems)
            {
                string filePath = FormBrowseUtil.GetFullPathFromGitItemStatus(module, item);
                FormBrowseUtil.ShowFileOrParentFolderInFileExplorer(filePath);
            }
        }
开发者ID:werwolfby,项目名称:gitextensions,代码行数:11,代码来源:FormBrowse.cs

示例5: CopyFullPathToClipboard

        public static void CopyFullPathToClipboard(FileStatusList diffFiles, GitModule module)
        {
            if (!diffFiles.SelectedItems.Any())
                return;

            var fileNames = new StringBuilder();
            foreach (var item in diffFiles.SelectedItems)
            {
                //Only use append line when multiple items are selected.
                //This to make it easier to use the text from clipboard when 1 file is selected.
                if (fileNames.Length > 0)
                    fileNames.AppendLine();

                fileNames.Append(Path.Combine(module.WorkingDir, item.Name).ToNativePath());
            }
            Clipboard.SetText(fileNames.ToString());
        }
开发者ID:werwolfby,项目名称:gitextensions,代码行数:17,代码来源:FormBrowse.cs

示例6: SenderToFileStatusList

        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;
        }
开发者ID:kunigaku,项目名称:gitextensions,代码行数:23,代码来源:FormCommit.cs

示例7: Unstaged_Enter

 private void Unstaged_Enter(object sender, EventArgs e)
 {
     if (_currentFilesList != Unstaged)
     {
         _currentFilesList = Unstaged;
         _skipUpdate = false;
         UnstagedSelectionChanged(Unstaged, null);
     }
 }
开发者ID:Basewq,项目名称:gitextensions,代码行数:9,代码来源:FormCommit.cs

示例8: UnstageAllToolStripMenuItemClick

        private void UnstageAllToolStripMenuItemClick(object sender, EventArgs e)
        {
            var lastSelection = new List<GitItemStatus>();
            if (_currentFilesList != null)
                lastSelection = _currentSelection;

            Action stageAreaLoaded = null;
            stageAreaLoaded = () =>
            {
                _currentFilesList = Unstaged;
                RestoreSelectedFiles(Unstaged.GitItemStatuses, Staged.GitItemStatuses, lastSelection);
                Unstaged.Focus();

                OnStageAreaLoaded -= stageAreaLoaded;
            };

            OnStageAreaLoaded += stageAreaLoaded;

            Module.ResetMixed("HEAD");
            Initialize();
        }
开发者ID:Basewq,项目名称:gitextensions,代码行数:21,代码来源:FormCommit.cs

示例9: Unstaged_DoubleClick

 void Unstaged_DoubleClick(object sender, EventArgs e)
 {
     _currentFilesList = Unstaged;
     Stage(Unstaged.SelectedItems.ToList());
     if (Unstaged.IsEmpty)
         Staged.Focus();
 }
开发者ID:Basewq,项目名称:gitextensions,代码行数:7,代码来源:FormCommit.cs

示例10: Staged_DoubleClick

 void Staged_DoubleClick(object sender, EventArgs e)
 {
     _currentFilesList = Staged;
     Unstage();
 }
开发者ID:Basewq,项目名称:gitextensions,代码行数:5,代码来源:FormCommit.cs

示例11: Unstage

        private void Unstage()
        {
            if (Staged.GitItemStatuses.Count() > 10 && Staged.SelectedItems.Count() == Staged.GitItemStatuses.Count())
            {
                UnstageAllToolStripMenuItemClick(null, null);
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            EnableStageButtons(false);
            try
            {
                var lastSelection = new List<GitItemStatus>();
                if (_currentFilesList != null)
                    lastSelection = _currentSelection;

                    toolStripProgressBar1.Visible = true;
                    toolStripProgressBar1.Maximum = Staged.SelectedItems.Count() * 2;
                    toolStripProgressBar1.Value = 0;
                    Staged.StoreNextIndexToSelect();

                    var files = new List<GitItemStatus>();
                    var allFiles = new List<GitItemStatus>();

                    foreach (var item in Staged.SelectedItems)
                    {
                        toolStripProgressBar1.Value = Math.Min(toolStripProgressBar1.Maximum - 1, toolStripProgressBar1.Value + 1);
                        if (!item.IsNew)
                        {
                            toolStripProgressBar1.Value = Math.Min(toolStripProgressBar1.Maximum - 1, toolStripProgressBar1.Value + 1);
                            Module.UnstageFileToRemove(item.Name);

                            if (item.IsRenamed)
                                Module.UnstageFileToRemove(item.OldName);
                        }
                        else
                        {
                            files.Add(item);
                        }
                        allFiles.Add(item);
                    }

                    Module.UnstageFiles(files);

                    _skipUpdate = true;
                    InitializedStaged();
                    var stagedFiles = Staged.GitItemStatuses.ToList();
                    var unStagedFiles = Unstaged.GitItemStatuses.ToList();
                    foreach (var item in allFiles)
                    {
                        var item1 = item;
                        if (stagedFiles.Exists(i => i.Name == item1.Name))
                            continue;

                        var item2 = item;
                        if (unStagedFiles.Exists(i => i.Name == item2.Name))
                            continue;

                        if (item.IsNew && !item.IsChanged && !item.IsDeleted)
                            item.IsTracked = false;
                        else
                            item.IsTracked = true;

                        if (item.IsRenamed)
                        {
                            var clone = new GitItemStatus
                            {
                                Name = item.OldName,
                                IsDeleted = true,
                                IsTracked = true,
                                IsStaged = false
                            };
                            unStagedFiles.Add(clone);

                            item.IsRenamed = false;
                            item.IsNew = true;
                            item.IsTracked = false;
                            item.OldName = string.Empty;
                        }

                        item.IsStaged = false;
                        unStagedFiles.Add(item);
                    }
                    Staged.GitItemStatuses = stagedFiles;
                    Unstaged.GitItemStatuses = unStagedFiles;
                    _skipUpdate = false;
                    Staged.SelectStoredNextIndex();

                    toolStripProgressBar1.Value = toolStripProgressBar1.Maximum;

                toolStripProgressBar1.Visible = false;

                if (Staged.IsEmpty)
                {
                    _currentFilesList = Unstaged;
                    RestoreSelectedFiles(Unstaged.GitItemStatuses, Staged.GitItemStatuses, lastSelection);
                    Unstaged.Focus();
                }
            }
            catch (Exception ex)
//.........这里部分代码省略.........
开发者ID:Basewq,项目名称:gitextensions,代码行数:101,代码来源:FormCommit.cs

示例12: LoadUnstagedOutput

        /// <summary>
        ///   Loads the unstaged output.
        ///   This method is passed in to the SetTextCallBack delegate
        ///   to set the Text property of textBox1.
        /// </summary>
        private void LoadUnstagedOutput(IList<GitItemStatus> allChangedFiles)
        {
            var lastSelection = new List<GitItemStatus>();
            if (_currentFilesList != null)
                lastSelection = _currentSelection;

            var unStagedFiles = new List<GitItemStatus>();
            var stagedFiles = new List<GitItemStatus>();

            foreach (var fileStatus in allChangedFiles)
            {
                if (fileStatus.IsStaged)
                    stagedFiles.Add(fileStatus);
                else
                    unStagedFiles.Add(fileStatus);
            }
            Unstaged.GitItemStatuses = unStagedFiles;
            Staged.GitItemStatuses = stagedFiles;

            Loading.Visible = false;
            LoadingStaged.Visible = false;
            Commit.Enabled = true;
            CommitAndPush.Enabled = true;
            Amend.Enabled = true;
            Reset.Enabled = DoChangesExist();

            EnableStageButtons(true);
            workingToolStripMenuItem.Enabled = true;

            var inTheMiddleOfConflictedMerge = Module.InTheMiddleOfConflictedMerge();
            SolveMergeconflicts.Visible = inTheMiddleOfConflictedMerge;

            if (Staged.IsEmpty)
            {
                _currentFilesList = Unstaged;
                if (Staged.ContainsFocus)
                    Unstaged.Focus();
            }
            else if (Unstaged.IsEmpty)
            {
                _currentFilesList = Staged;
                if (Unstaged.ContainsFocus)
                    Staged.Focus();
            }

            RestoreSelectedFiles(unStagedFiles, stagedFiles, lastSelection);

            if (OnStageAreaLoaded != null)
                OnStageAreaLoaded();

            if (_loadUnstagedOutputFirstTime)
            {
                var fc = this.FindFocusedControl();

                if (fc == this.Ok)
                {
                    if (Unstaged.GitItemStatuses.Any())
                        Unstaged.Focus();
                    else if (Staged.GitItemStatuses.Any())
                        Message.Focus();
                    else
                        Amend.Focus();
                }

                _loadUnstagedOutputFirstTime = false;
            }
        }
开发者ID:Basewq,项目名称:gitextensions,代码行数:72,代码来源:FormCommit.cs

示例13: Stage

        private void Stage(IList<GitItemStatus> gitItemStatusses)
        {
            EnableStageButtons(false);
            try
            {
                var lastSelection = new List<GitItemStatus>();
                if (_currentFilesList != null)
                    lastSelection = _currentSelection;

                Cursor.Current = Cursors.WaitCursor;
                Unstaged.StoreNextIndexToSelect();
                toolStripProgressBar1.Visible = true;
                toolStripProgressBar1.Maximum = gitItemStatusses.Count() * 2;
                toolStripProgressBar1.Value = 0;

                var files = new List<GitItemStatus>();

                foreach (var gitItemStatus in gitItemStatusses)
                {
                    toolStripProgressBar1.Value = Math.Min(toolStripProgressBar1.Maximum - 1, toolStripProgressBar1.Value + 1);
                    if (gitItemStatus.Name.EndsWith("/"))
                        gitItemStatus.Name = gitItemStatus.Name.TrimEnd('/');
                    files.Add(gitItemStatus);
                }

                bool wereErrors = false;
                if (AppSettings.ShowErrorsWhenStagingFiles)
                {
                    FormStatus.ProcessStart processStart =
                        form =>
                        {
                            form.AppendMessageCrossThread(string.Format(_stageFiles.Text + "\n",
                                                         files.Count));
                            var output = Module.StageFiles(files, out wereErrors);
                            form.AppendMessageCrossThread(output);
                            form.Done(string.IsNullOrEmpty(output));
                        };
                    using (var process = new FormStatus(processStart, null) { Text = _stageDetails.Text })
                        process.ShowDialogOnError(this);
                }
                else
                {
                    Module.StageFiles(files, out wereErrors);
                }
                if (wereErrors)
                    RescanChanges();
                else
                {
                    InitializedStaged();
                    var unStagedFiles = Unstaged.GitItemStatuses.ToList();
                    _skipUpdate = true;
                    var names = new HashSet<string>();
                    foreach (var item in files)
                    {
                        names.Add(item.Name);
                        names.Add(item.OldName);
                    }
                    var unstagedItems = new HashSet<GitItemStatus>();
                    foreach (var item in unStagedFiles)
                    {
                        if (names.Contains(item.Name))
                            unstagedItems.Add(item);
                    }
                    unStagedFiles.RemoveAll(item => !item.IsSubmodule && unstagedItems.Contains(item));
                    unStagedFiles.RemoveAll(item => item.IsSubmodule && item.SubmoduleStatus.IsCompleted &&
                        !item.SubmoduleStatus.Result.IsDirty && unstagedItems.Contains(item));
                    foreach (var item in unstagedItems.Where(item => item.IsSubmodule &&
                        item.SubmoduleStatus.IsCompleted && item.SubmoduleStatus.Result.IsDirty))
                    {
                        item.SubmoduleStatus.Result.Status = SubmoduleStatus.Unknown;
                    }
                    Unstaged.GitItemStatuses = unStagedFiles;
                    Unstaged.ClearSelected();
                    _skipUpdate = false;
                    Unstaged.SelectStoredNextIndex();
                }

                toolStripProgressBar1.Value = toolStripProgressBar1.Maximum;

                toolStripProgressBar1.Visible = false;

                if (Unstaged.IsEmpty)
                {
                    _currentFilesList = Staged;
                    RestoreSelectedFiles(Unstaged.GitItemStatuses, Staged.GitItemStatuses, lastSelection);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }

            EnableStageButtons(true);

            Commit.Enabled = true;
            Amend.Enabled = true;
            AcceptButton = Commit;
            Cursor.Current = Cursors.Default;

            if (AppSettings.RevisionGraphShowWorkingDirChanges)
//.........这里部分代码省略.........
开发者ID:Basewq,项目名称:gitextensions,代码行数:101,代码来源:FormCommit.cs

示例14: Staged_Enter

 private void Staged_Enter(object sender, EventArgs e)
 {
     if (_currentFilesList != Staged)
     {
         _currentFilesList = Staged;
         StagedSelectionChanged(Staged, null);
     }
 }
开发者ID:peppy,项目名称:gitextensions,代码行数:8,代码来源:FormCommit.cs

示例15: Staged_DoubleClick

 void Staged_DoubleClick(object sender, EventArgs e)
 {
     Unstage();
     if (!Staged.IsEmpty)
         _currentFilesList = Staged;
     else
         Unstaged.Focus();
 }
开发者ID:peppy,项目名称:gitextensions,代码行数:8,代码来源:FormCommit.cs


注:本文中的FileStatusList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。