本文整理匯總了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);
}