本文整理汇总了C#中KeyValuePair.Value方法的典型用法代码示例。如果您正苦于以下问题:C# KeyValuePair.Value方法的具体用法?C# KeyValuePair.Value怎么用?C# KeyValuePair.Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValuePair
的用法示例。
在下文中一共展示了KeyValuePair.Value方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRadioButton
private UIElement CreateRadioButton(KeyValuePair<string, Func<Map>> sample)
{
var radioButton = new RadioButton
{
FontSize = 16,
Content = sample.Key,
Margin = new Thickness(4)
};
radioButton.Click += (s, a) =>
{
MapControl.Map.Layers.Clear();
MapControl.Map = sample.Value();
LayerList.Initialize(MapControl.Map.Layers);
MapControl.Refresh();
};
return radioButton;
}
示例2: AddMenuItem
private static void AddMenuItem(KeyValuePair<string, ModMenuItemClickedCallback> modMenuItem, MenuItem modsGroup)
{
var item = new MenuItem(modMenuItem.Key);
item.Click += (sender, args) => modMenuItem.Value();
modsGroup.Items.Add(item);
}
示例3: BuildTestCasesForThens
private IList<TestCaseData> BuildTestCasesForThens(IList<Context> parentContexts)
{
var testCases = new List<TestCaseData>();
if (!thens.Any()) return testCases;
var setupText = new StringBuilder();
setupText.AppendLine(parentContexts.First().Description + ":"); // start with the spec method's name
var first = true;
foreach (var context in parentContexts.Skip(1).Where(c => c.IsNamedContext))
{
setupText.AppendLine(context.Conjunction(first) + context.Description);
first = false;
}
setupText.AppendLine("when " + when.Key);
const string thenText = "then ";
foreach (var spec in thens)
{
var parentContextsCapture = new List<Context>(parentContexts);
var whenCapture = new KeyValuePair<string, Func<Task>>(when.Key, when.Value);
Func<Task> executeTest = async () =>
{
BeforeIfNotAlreadyRun();
try
{
var exceptionThrownAndAsserted = false;
await InitializeContext(parentContextsCapture).ConfigureAwait(false);
try
{
thrownException = null;
await whenCapture.Value().ConfigureAwait(false);
}
catch (Exception ex)
{
thrownException = ex;
}
try
{
exceptionAsserted = false;
await spec.Value().ConfigureAwait(false);
}
catch (Exception)
{
if (thrownException == null || exceptionAsserted)
throw;
}
if (thrownException != null)
{
throw thrownException;
}
exceptionThrownAndAsserted = true;
if (!exceptionThrownAndAsserted)
{
await spec.Value().ConfigureAwait(false);
}
}
finally
{
After();
}
};
var description = setupText + thenText + spec.Key + Environment.NewLine;
testCases.Add(new TestCaseData(executeTest).SetName(description));
}
return testCases;
}
示例4: ExecuteEntrypoint
BootstrapResult ExecuteEntrypoint(KeyValuePair<Type, Func<IDictionary<string, object>, int>> entryPoint, IEnumerable<Assembly> assemblies, IEnumerable<string> consumedArgs)
{
var info = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
{
{ "openwrap.syspath", _systemRootPath },
{ "openwrap.cd", Environment.CurrentDirectory },
{ "openwrap.shell.commandline", GetCommandLine() },
{ "openwrap.shell.assemblies", assemblies.Select(x=>x.Location).ToList() },
{ "openwrap.shell.version", _shellVersion},
{ "openwrap.shell.args", consumedArgs.ToList() }
};
return (BootstrapResult)entryPoint.Value(info);
}
示例5: addMenuItem
private static void addMenuItem(KeyValuePair<string, ModMenuItemClickedCallback> mod_kvp, Game.GUI.Controls.MenuItem modsGroup)
{
var item = new Game.GUI.Controls.MenuItem(mod_kvp.Key);
item.Click += new Game.GUI.Controls.EventHandler((sender, args) =>
{
mod_kvp.Value();
});
modsGroup.Items.Add(item);
}