本文整理汇总了C#中GitCommands.Repository.RecentRepoSplitter.SplitRecentRepos方法的典型用法代码示例。如果您正苦于以下问题:C# RecentRepoSplitter.SplitRecentRepos方法的具体用法?C# RecentRepoSplitter.SplitRecentRepos怎么用?C# RecentRepoSplitter.SplitRecentRepos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitCommands.Repository.RecentRepoSplitter
的用法示例。
在下文中一共展示了RecentRepoSplitter.SplitRecentRepos方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RefreshRepos
private void RefreshRepos()
{
MostRecentLB.Items.Clear();
LessRecentLB.Items.Clear();
List<RecentRepoInfo> mostRecentRepos = new List<RecentRepoInfo>();
List<RecentRepoInfo> lessRecentRepos = new List<RecentRepoInfo>();
RecentRepoSplitter splitter = new RecentRepoSplitter();
splitter.MaxRecentRepositories = (int)_NO_TRANSLATE_maxRecentRepositories.Value;
splitter.ShorteningStrategy = GetShorteningStrategy();
splitter.SortLessRecentRepos = sortLessRecentRepos.Checked;
splitter.SortMostRecentRepos = sortMostRecentRepos.Checked;
splitter.RecentReposComboMinWidth = (int)comboMinWidthEdit.Value;
splitter.measureFont = MostRecentLB.Font;
splitter.graphics = MostRecentLB.CreateGraphics();
try
{
splitter.SplitRecentRepos(Repositories.RepositoryHistory.Repositories, mostRecentRepos, lessRecentRepos);
}
finally
{
splitter.graphics.Dispose();
}
foreach (RecentRepoInfo repo in mostRecentRepos)
MostRecentLB.Items.Add(repo);
foreach (RecentRepoInfo repo in lessRecentRepos)
LessRecentLB.Items.Add(repo);
}
示例2: WorkingdirDropDownOpening
private void WorkingdirDropDownOpening(object sender, EventArgs e)
{
_NO_TRANSLATE_Workingdir.DropDownItems.Clear();
List<RecentRepoInfo> mostRecentRepos = new List<RecentRepoInfo>();
List<RecentRepoInfo> lessRecentRepos = new List<RecentRepoInfo>();
using (var graphics = CreateGraphics())
{
var splitter = new RecentRepoSplitter
{
measureFont = _NO_TRANSLATE_Workingdir.Font,
graphics = graphics
};
splitter.SplitRecentRepos(Repositories.RepositoryHistory.Repositories, mostRecentRepos, lessRecentRepos);
}
foreach (RecentRepoInfo repo in mostRecentRepos)
AddWorkingdirDropDownItem(repo.Repo, repo.Caption);
if (lessRecentRepos.Count > 0)
{
if (mostRecentRepos.Count > 0 && (Settings.SortMostRecentRepos || Settings.SortLessRecentRepos))
_NO_TRANSLATE_Workingdir.DropDownItems.Add(new ToolStripSeparator());
foreach (RecentRepoInfo repo in lessRecentRepos)
AddWorkingdirDropDownItem(repo.Repo, repo.Caption);
}
_NO_TRANSLATE_Workingdir.DropDownItems.Add(new ToolStripSeparator());
ToolStripMenuItem toolStripItem = new ToolStripMenuItem(openToolStripMenuItem.Text);
toolStripItem.ShortcutKeys = openToolStripMenuItem.ShortcutKeys;
_NO_TRANSLATE_Workingdir.DropDownItems.Add(toolStripItem);
toolStripItem.Click += (hs, he) => OpenToolStripMenuItemClick(hs, he);
toolStripItem = new ToolStripMenuItem(_configureWorkingDirMenu.Text);
_NO_TRANSLATE_Workingdir.DropDownItems.Add(toolStripItem);
toolStripItem.Click += (hs, he) =>
{
using (var frm = new FormRecentReposSettings()) frm.ShowDialog(this);
RefreshWorkingDirCombo();
};
}
示例3: RefreshWorkingDirCombo
private void RefreshWorkingDirCombo()
{
Repository r = null;
if (Repositories.RepositoryHistory.Repositories.Count > 0)
r = Repositories.RepositoryHistory.Repositories[0];
List<RecentRepoInfo> mostRecentRepos = new List<RecentRepoInfo>();
if (r == null || !r.Path.Equals(Module.WorkingDir, StringComparison.InvariantCultureIgnoreCase))
Repositories.AddMostRecentRepository(Module.WorkingDir);
using (var graphics = CreateGraphics())
{
var splitter = new RecentRepoSplitter
{
measureFont = _NO_TRANSLATE_Workingdir.Font,
graphics = graphics
};
splitter.SplitRecentRepos(Repositories.RepositoryHistory.Repositories, mostRecentRepos, mostRecentRepos);
RecentRepoInfo ri = mostRecentRepos.Find((e) => e.Repo.Path.Equals(Module.WorkingDir, StringComparison.InvariantCultureIgnoreCase));
if (ri == null)
_NO_TRANSLATE_Workingdir.Text = Module.WorkingDir;
else
_NO_TRANSLATE_Workingdir.Text = ri.Caption;
if (Settings.RecentReposComboMinWidth > 0)
{
_NO_TRANSLATE_Workingdir.AutoSize = false;
var captionWidth = graphics.MeasureString(_NO_TRANSLATE_Workingdir.Text, _NO_TRANSLATE_Workingdir.Font).Width;
captionWidth = captionWidth + _NO_TRANSLATE_Workingdir.DropDownButtonWidth + 5;
_NO_TRANSLATE_Workingdir.Width = Math.Max(Settings.RecentReposComboMinWidth, (int)captionWidth);
}
else
_NO_TRANSLATE_Workingdir.AutoSize = true;
}
}
示例4: RefreshWorkingDirCombo
private void RefreshWorkingDirCombo()
{
if (Settings.RecentReposComboMinWidth > 0)
{
_NO_TRANSLATE_Workingdir.AutoSize = false;
_NO_TRANSLATE_Workingdir.Width = Settings.RecentReposComboMinWidth;
}
else
_NO_TRANSLATE_Workingdir.AutoSize = true;
Repository r = null;
if (Repositories.RepositoryHistory.Repositories.Count > 0)
r = Repositories.RepositoryHistory.Repositories[0];
List<RecentRepoInfo> mostRecentRepos = new List<RecentRepoInfo>();
if (r == null || !r.Path.Equals(GitModule.CurrentWorkingDir, StringComparison.InvariantCultureIgnoreCase))
Repositories.AddMostRecentRepository(GitModule.CurrentWorkingDir);
using (var graphics = CreateGraphics())
{
var splitter = new RecentRepoSplitter
{
measureFont = _NO_TRANSLATE_Workingdir.Font,
graphics = graphics
};
splitter.SplitRecentRepos(Repositories.RepositoryHistory.Repositories, mostRecentRepos, mostRecentRepos);
}
RecentRepoInfo ri = mostRecentRepos.Find((e) => e.Repo.Path.Equals(GitModule.CurrentWorkingDir, StringComparison.InvariantCultureIgnoreCase));
if (ri == null)
_NO_TRANSLATE_Workingdir.Text = GitModule.CurrentWorkingDir;
else
_NO_TRANSLATE_Workingdir.Text = ri.Caption;
}
示例5: WorkingdirDropDownOpening
private void WorkingdirDropDownOpening(object sender, EventArgs e)
{
_NO_TRANSLATE_Workingdir.DropDownItems.Clear();
List<RecentRepoInfo> mostRecentRepos = new List<RecentRepoInfo>();
List<RecentRepoInfo> lessRecentRepos = new List<RecentRepoInfo>();
RecentRepoSplitter splitter = new RecentRepoSplitter();
splitter.measureFont = _NO_TRANSLATE_Workingdir.Font;
splitter.graphics = this.CreateGraphics();
try
{
splitter.SplitRecentRepos(Repositories.RepositoryHistory.Repositories, mostRecentRepos, lessRecentRepos);
}
finally
{
splitter.graphics.Dispose();
}
foreach(RecentRepoInfo repo in mostRecentRepos)
AddWorkingdirDropDownItem(repo.Repo, repo.Caption);
if (lessRecentRepos.Count > 0)
{
if (mostRecentRepos.Count > 0 && (Settings.SortMostRecentRepos || Settings.SortLessRecentRepos))
_NO_TRANSLATE_Workingdir.DropDownItems.Add(new ToolStripSeparator());
foreach (RecentRepoInfo repo in lessRecentRepos)
AddWorkingdirDropDownItem(repo.Repo, repo.Caption);
}
_NO_TRANSLATE_Workingdir.DropDownItems.Add(new ToolStripSeparator());
ToolStripMenuItem toolStripItem = new ToolStripMenuItem("Configure this menu");
_NO_TRANSLATE_Workingdir.DropDownItems.Add(toolStripItem);
toolStripItem.Click += (object hs, EventArgs he) =>
{
new FormRecentReposSettings().ShowDialog(this);
RefreshWorkingDirCombo();
};
}
示例6: RefreshWorkingDirCombo
private void RefreshWorkingDirCombo()
{
if (Settings.RecentReposComboMinWidth > 0)
{
_NO_TRANSLATE_Workingdir.AutoSize = false;
_NO_TRANSLATE_Workingdir.Width = Settings.RecentReposComboMinWidth;
}
else
_NO_TRANSLATE_Workingdir.AutoSize = true;
Repository r = null;
if (Repositories.RepositoryHistory.Repositories.Count > 0)
r = Repositories.RepositoryHistory.Repositories[0];
if (r == null || !r.Path.Equals(Settings.WorkingDir, StringComparison.InvariantCultureIgnoreCase))
Repositories.AddMostRecentRepository(Settings.WorkingDir);
List<RecentRepoInfo> mostRecentRepos = new List<RecentRepoInfo>();
List<Repository> repo = new List<Repository>();
repo.Add(Repositories.RepositoryHistory.Repositories[0]);
RecentRepoSplitter splitter = new RecentRepoSplitter();
splitter.measureFont = _NO_TRANSLATE_Workingdir.Font;
splitter.graphics = this.CreateGraphics();
try
{
splitter.SplitRecentRepos(repo, mostRecentRepos, mostRecentRepos);
}
finally
{
splitter.graphics.Dispose();
}
_NO_TRANSLATE_Workingdir.Text = mostRecentRepos[0].Caption;
}