本文整理汇总了C#中MonoDevelop.Projects.Workspace.GetConfigurations方法的典型用法代码示例。如果您正苦于以下问题:C# Workspace.GetConfigurations方法的具体用法?C# Workspace.GetConfigurations怎么用?C# Workspace.GetConfigurations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Projects.Workspace
的用法示例。
在下文中一共展示了Workspace.GetConfigurations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configurations
public void Configurations ()
{
int configChangedEvs = 0;
int configChangedEvsSub = 0;
Workspace ws = new Workspace ();
ws.ConfigurationsChanged += delegate { configChangedEvs++; };
Workspace cws1 = new Workspace ();
cws1.ConfigurationsChanged += delegate { configChangedEvsSub++; };
ws.Items.Add (cws1);
Solution sol = new Solution ();
cws1.Items.Add (sol);
ReadOnlyCollection<string> configs = ws.GetConfigurations ();
Assert.AreEqual (0, configs.Count);
configs = cws1.GetConfigurations ();
Assert.AreEqual (0, configs.Count);
// Add configurations
configChangedEvs = configChangedEvsSub = 0;
sol.AddConfiguration ("c1", false);
Assert.AreEqual (1, configChangedEvs);
Assert.AreEqual (1, configChangedEvsSub);
configs = ws.GetConfigurations ();
Assert.AreEqual (1, configs.Count);
Assert.AreEqual ("c1", configs[0]);
configs = cws1.GetConfigurations ();
Assert.AreEqual (1, configs.Count);
Assert.AreEqual ("c1", configs[0]);
configChangedEvs = configChangedEvsSub = 0;
sol.AddConfiguration ("c2", false);
Assert.AreEqual (1, configChangedEvs);
Assert.AreEqual (1, configChangedEvsSub);
configs = ws.GetConfigurations ();
Assert.AreEqual (2, configs.Count);
Assert.AreEqual ("c1", configs[0]);
Assert.AreEqual ("c2", configs[1]);
configs = cws1.GetConfigurations ();
Assert.AreEqual (2, configs.Count);
Assert.AreEqual ("c1", configs[0]);
Assert.AreEqual ("c2", configs[1]);
// Add another solution
Solution sol2 = new Solution ();
sol2.AddConfiguration ("c3", false);
sol2.AddConfiguration ("c4", false);
configChangedEvs = configChangedEvsSub = 0;
cws1.Items.Add (sol2);
Assert.AreEqual (1, configChangedEvs);
Assert.AreEqual (1, configChangedEvsSub);
configs = ws.GetConfigurations ();
Assert.AreEqual (4, configs.Count);
Assert.AreEqual ("c1", configs[0]);
Assert.AreEqual ("c2", configs[1]);
Assert.AreEqual ("c3", configs[2]);
Assert.AreEqual ("c4", configs[3]);
configs = cws1.GetConfigurations ();
Assert.AreEqual (4, configs.Count);
Assert.AreEqual ("c1", configs[0]);
Assert.AreEqual ("c2", configs[1]);
Assert.AreEqual ("c3", configs[2]);
Assert.AreEqual ("c4", configs[3]);
// Remove solution
configChangedEvs = configChangedEvsSub = 0;
cws1.Items.Remove (sol2);
Assert.AreEqual (1, configChangedEvs);
Assert.AreEqual (1, configChangedEvsSub);
configs = ws.GetConfigurations ();
Assert.AreEqual (2, configs.Count);
Assert.AreEqual ("c1", configs[0]);
Assert.AreEqual ("c2", configs[1]);
configs = cws1.GetConfigurations ();
Assert.AreEqual (2, configs.Count);
Assert.AreEqual ("c1", configs[0]);
Assert.AreEqual ("c2", configs[1]);
// Remove configuration
configChangedEvs = configChangedEvsSub = 0;
sol.Configurations.RemoveAt (1);
Assert.AreEqual (1, configChangedEvs);
Assert.AreEqual (1, configChangedEvsSub);
configs = ws.GetConfigurations ();
Assert.AreEqual (1, configs.Count);
Assert.AreEqual ("c1", configs[0]);
configs = cws1.GetConfigurations ();
Assert.AreEqual (1, configs.Count);
//.........这里部分代码省略.........