本文整理汇总了C#中Solution.GetAllItems方法的典型用法代码示例。如果您正苦于以下问题:C# Solution.GetAllItems方法的具体用法?C# Solution.GetAllItems怎么用?C# Solution.GetAllItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solution
的用法示例。
在下文中一共展示了Solution.GetAllItems方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartupOptionsPanelWidget
public StartupOptionsPanelWidget (Solution sol)
{
this.Build();
this.sol = sol;
startupItems = new List<SolutionItem> ();
foreach (SolutionItem it in sol.GetAllItems<SolutionItem> ()) {
// Include in the list if it can run in any of the existing execution modes and configurations
foreach (IExecutionModeSet mset in Runtime.ProcessService.GetExecutionModes ()) {
bool matched = false;
foreach (IExecutionMode mode in mset.ExecutionModes) {
foreach (SolutionConfiguration sc in sol.Configurations) {
if (it.CanExecute (new ExecutionContext (mode, null, IdeApp.Workspace.ActiveExecutionTarget), sc.Selector)) {
startupItems.Add (it);
matched = true;
break;
}
}
if (matched)
break;
}
if (matched)
break;
}
}
listStore = new ListStore (typeof(SolutionFolderItem), typeof(bool), typeof(string));
treeItems.Model = listStore;
treeItems.SearchColumn = -1; // disable the interactive search
CellRendererToggle crt = new CellRendererToggle ();
treeItems.AppendColumn ("", crt, "active", 1);
treeItems.AppendColumn (GettextCatalog.GetString ("Project"), new CellRendererText (), "text", 2);
if (startupItems.Count > 0) {
for (int n=0; n<startupItems.Count; n++) {
SolutionItem it = startupItems [n];
comboItems.AppendText (it.Name);
listStore.AppendValues (it, sol.MultiStartupItems.Contains (it), it.Name);
if (sol.StartupItem == it)
comboItems.Active = n;
}
}
else {
comboItems.AppendText (GettextCatalog.GetString ("The solution does not contain any executable project"));
comboItems.Active = 0;
comboItems.Sensitive = false;
radioMulti.Sensitive = false;
radioSingle.Sensitive = false;
}
radioSingle.Active = sol.SingleStartup;
radioMulti.Active = !sol.SingleStartup;
UpdateButtons ();
crt.Toggled += OnItemToggled;
treeItems.Selection.Changed += OnSelectionChanged;
}
示例2: ConfigurationEquals
bool ConfigurationEquals (Solution sol, SolutionConfiguration s1, SolutionConfiguration s2)
{
foreach (var p in sol.GetAllItems<SolutionItem> ()) {
var c1 = s1.GetEntryForItem (p);
var c2 = s2.GetEntryForItem (p);
if (c1 == null && c2 == null)
continue;
if (c1 == null || c2 == null)
return false;
if (c1.Build != c2.Build || c1.ItemConfiguration != c2.ItemConfiguration)
return false;
}
return true;
}
示例3: WriteFileInternal
internal void WriteFileInternal (SlnFile sln, Solution solution, ProgressMonitor monitor)
{
SolutionFolder c = solution.RootFolder;
// Delete data for projects that have been removed from the solution
var currentProjects = new HashSet<string> (solution.GetAllItems<SolutionFolderItem> ().Select (it => it.ItemId));
var removedProjects = new HashSet<string> ();
if (solution.LoadedProjects != null)
removedProjects.UnionWith (solution.LoadedProjects.Except (currentProjects));
var unknownProjects = new HashSet<string> (sln.Projects.Select (p => p.Id).Except (removedProjects).Except (currentProjects));
foreach (var p in removedProjects) {
var ps = sln.Projects.GetProject (p);
if (ps != null)
sln.Projects.Remove (ps);
var pc = sln.ProjectConfigurationsSection.GetPropertySet (p, true);
if (pc != null)
sln.ProjectConfigurationsSection.Remove (pc);
}
var secNested = sln.Sections.GetSection ("NestedProjects");
if (secNested != null) {
foreach (var np in secNested.Properties.ToArray ()) {
if (removedProjects.Contains (np.Key) || removedProjects.Contains (np.Value))
secNested.Properties.Remove (np.Key);
}
}
solution.LoadedProjects = currentProjects;
//Write the projects
using (monitor.BeginTask (GettextCatalog.GetString ("Saving projects"), 1)) {
monitor.BeginStep ();
WriteProjects (c, sln, monitor, unknownProjects);
}
//FIXME: SolutionConfigurations?
var pset = sln.SolutionConfigurationsSection;
foreach (SolutionConfiguration config in solution.Configurations) {
var cid = ToSlnConfigurationId (config);
pset.SetValue (cid, cid);
}
WriteProjectConfigurations (solution, sln);
//Write Nested Projects
ICollection<SolutionFolder> folders = solution.RootFolder.GetAllItems<SolutionFolder> ().ToList ();
if (folders.Count > 1) {
// If folders ==1, that's the root folder
var sec = sln.Sections.GetOrCreateSection ("NestedProjects", SlnSectionType.PreProcess);
foreach (SolutionFolder folder in folders) {
if (folder.IsRoot)
continue;
WriteNestedProjects (folder, solution.RootFolder, sec);
}
// Remove items which don't have a parent folder
var toRemove = solution.GetAllItems<SolutionFolderItem> ().Where (it => it.ParentFolder == solution.RootFolder);
foreach (var it in toRemove)
sec.Properties.Remove (it.ItemId);
}
// Write custom properties for configurations
foreach (SolutionConfiguration conf in solution.Configurations) {
string secId = "MonoDevelopProperties." + conf.Id;
var sec = sln.Sections.GetOrCreateSection (secId, SlnSectionType.PreProcess);
solution.WriteConfigurationData (monitor, sec.Properties, conf);
if (sec.IsEmpty)
sln.Sections.Remove (sec);
}
}