当前位置: 首页>>代码示例>>C#>>正文


C# KeyValuePair.Value方法代码示例

本文整理汇总了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;
        }
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:18,代码来源:Window1.xaml.cs

示例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);
 }
开发者ID:Gnomodia,项目名称:Gnomodia,代码行数:6,代码来源:ModRightClickMenu.cs

示例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;
        }
开发者ID:speceasy,项目名称:speceasy,代码行数:81,代码来源:Spec.TestCaseGeneration.cs

示例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);
 }
开发者ID:rvdginste,项目名称:openwrap-shell,代码行数:13,代码来源:BootstrapRunner.cs

示例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);
 }
开发者ID:Rychard,项目名称:Faark.Gnomoria.Modding,代码行数:9,代码来源:ModRightClickMenu.cs


注:本文中的KeyValuePair.Value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。