本文整理汇总了C#中MonoDevelop.Projects.ProjectFileEventArgs.GroupBy方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectFileEventArgs.GroupBy方法的具体用法?C# ProjectFileEventArgs.GroupBy怎么用?C# ProjectFileEventArgs.GroupBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Projects.ProjectFileEventArgs
的用法示例。
在下文中一共展示了ProjectFileEventArgs.GroupBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnFileAdded
//static void OnFileChanged (object s, ProjectFileEventArgs args)
//{
// Repository repo = GetRepository (args.Project);
// if (repo != null)
// NotifyFileStatusChanged (repo, args.ProjectFile.FilePath, false);
//}
static void OnFileAdded (object s, ProjectFileEventArgs e)
{
FileUpdateEventArgs vargs = new FileUpdateEventArgs ();
IProgressMonitor monitor = null;
try {
foreach (var repoFiles in e.GroupBy (i => i.Project)) {
Repository repo = GetRepository (repoFiles.Key);
if (repo == null)
continue;
var versionInfos = repo.GetVersionInfo (repoFiles.Select (f => f.ProjectFile.FilePath));
FilePath[] paths = versionInfos.Where (i => i.CanAdd).Select (i => i.LocalPath).ToArray ();
if (paths.Length > 0) {
if (monitor == null)
monitor = GetStatusMonitor ();
repo.Add (paths, false, monitor);
}
vargs.AddRange (repoFiles.Select (i => new FileUpdateEventInfo (repo, i.ProjectFile.FilePath, i.ProjectFile.Subtype == Subtype.Directory)));
}
}
finally {
if (monitor != null)
monitor.Dispose ();
}
if (vargs.Count > 0)
NotifyFileStatusChanged (vargs);
}