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


C# IDispatcher.Foreground方法代码示例

本文整理汇总了C#中IDispatcher.Foreground方法的典型用法代码示例。如果您正苦于以下问题:C# IDispatcher.Foreground方法的具体用法?C# IDispatcher.Foreground怎么用?C# IDispatcher.Foreground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDispatcher的用法示例。


在下文中一共展示了IDispatcher.Foreground方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResolveOperationViewModel

        public ResolveOperationViewModel(
            string resolveOperationId,
            IHistoricalItemStore<ResolveOperation> historicalItemStore,
            IDispatcher dispatcher)
        {
            if (resolveOperationId == null) throw new ArgumentNullException("resolveOperationId");
            if (historicalItemStore == null) throw new ArgumentNullException("historicalItemStore");

            dispatcher.Background(() =>
            {
                ResolveOperation resolveOperation;
                if (historicalItemStore.TryGetItem(resolveOperationId, out resolveOperation))
                {
                    var subOperations = Traverse.PreOrder(resolveOperation, r => r.SubOperations)
                        .Select(o => new SubResolveOperationViewModel(o))
                        .ToList();
                    
                    dispatcher.Foreground(() =>
                    {
                        foreach (var subResolveOperationViewModel in subOperations)
                            _subOperations.Add(subResolveOperationViewModel);
                    });
                }
            });
        }
开发者ID:mustafatig,项目名称:whitebox,代码行数:25,代码来源:ResolveOperationViewModel.cs

示例2: ComponentDetailViewModel

        public ComponentDetailViewModel(string componentId, IDispatcher dispatcher, IActiveItemRepository<Component> components)
        {
            dispatcher.Background(() =>
            {
                Component component;
                if (!components.TryGetItem(componentId, out component))
                    throw new ArgumentException("Unknown component.");

                var description = component.Description;
                var services = component.DescribeServices();
                var metadata = component.Metadata;
                var sharing = component.Sharing;
                var lifetime = component.Lifetime;
                var activator = component.Activator;
                var ownership = component.Ownership;
                var target = component.TargetComponentId;
                var id = component.Id;

                dispatcher.Foreground(() =>
                {
                    Description = description;
                    Metadata = metadata;
                    Services = services;
                    Sharing = sharing.ToString();
                    Lifetime = lifetime.ToString();
                    Activator = activator.ToString();
                    Ownership = ownership.ToString();
                    Target = target;
                    Id = id;
                });
            });
        }
开发者ID:mustafatig,项目名称:whitebox,代码行数:32,代码来源:ComponentDetailViewModel.cs


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