本文整理匯總了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);
//.........這裏部分代碼省略.........