Esempio n. 1
0
        private async void RequestTypes()
        {
            if (Property == null)
            {
                return;
            }

            if (Editors.Count == 0)
            {
                SuggestedTypes  = new ObservableCollectionEx <ITypeInfo> ();
                AssignableTypes = new AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > (
                    Task.FromResult <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > (
                        new Dictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > ()));
                SelectedType = null;
                return;
            }

            var types = Editors.GetCommonAssignableTypes(Property, childTypes: true);
            var assignableTypesTask = types.ContinueWith(t => t.Result.GetTypeTree(), TaskScheduler.Default);

            AssignableTypes = new AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > (assignableTypesTask);

            var results   = await types;
            var suggested = new ObservableCollectionEx <ITypeInfo> (results.SuggestedTypes);

            if (results.AssignableTypes.Count > suggested.Count)
            {
                suggested.Add(OtherType);
            }

            SuggestedTypes = suggested;
            SelectedType   = (results.SuggestedTypes.Count > 0) ? results.SuggestedTypes[0] : null;
        }
        public ObjectTreeElement(IEditorProvider provider, IObjectEditor editor)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }
            if (editor == null)
            {
                throw new ArgumentNullException(nameof(editor));
            }

            Editor   = editor;
            Children = new AsyncValue <IReadOnlyList <ObjectTreeElement> > (QueryChildrenAsync(provider));

            string typeName = $"[{Editor.TargetType.Name}]";

            Task <string>   nameTask;
            INameableObject nameable = Editor as INameableObject;

            if (nameable != null)
            {
                nameTask = nameable.GetNameAsync().ContinueWith(t =>
                                                                (!String.IsNullOrWhiteSpace(t.Result)) ? $"{typeName} \"{t.Result}\"" : typeName, TaskScheduler.Default);
            }
            else
            {
                nameTask = Task.FromResult(typeName);
            }

            Name = new AsyncValue <string> (nameTask, typeName);
        }
Esempio n. 3
0
        public void SyncException()
        {
            var asyncValue = new AsyncValue <int>(SyncErrorInput);

            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            var loadHappened = false;

            asyncValue.ValueLoaded += (sender, args) =>
            {
                loadHappened = true;
            };

            var errorHappened = false;

            asyncValue.LoadError += (sender, args) =>
            {
                errorHappened = true;
            };

            asyncValue.Load();
            Assert.IsFalse(loadHappened);
            Assert.IsTrue(errorHappened);
        }
        public CreateBindingViewModel(TargetPlatform platform, IObjectEditor targetEditor, IPropertyInfo property, PropertyVariation variations = null)
            : base(platform)
        {
            if (platform == null)
            {
                throw new ArgumentNullException(nameof(platform));
            }
            if (targetEditor == null)
            {
                throw new ArgumentNullException(nameof(targetEditor));
            }
            if (platform.BindingProvider == null)
            {
                throw new ArgumentException("Null BindingProvider on TargetPlatform", nameof(platform));
            }
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            this.editorProvider = platform.EditorProvider;
            this.targetEditor   = targetEditor;
            this.property       = property;
            this.provider       = platform.BindingProvider;
            this.variations     = variations;

            PropertyDisplay = String.Format(Resources.CreateDataBindingTitle, $"[{this.targetEditor.TargetType.Name}].{property.Name}");
            RequestNamedDisplay();

            BindingSources = new AsyncValue <IReadOnlyList <BindingSource> > (
                platform.BindingProvider.GetBindingSourcesAsync(targetEditor.Target, property));

            RequestBindingObject();
        }
        public void AsyncValueException()
        {
            var tcs        = new TaskCompletionSource <bool> ();
            var asyncValue = new AsyncValue <bool> (tcs.Task, defaultValue: true, scheduler: new SyncScheduler());

            Assume.That(asyncValue.Value, Is.True);

            bool valueChanged = false, runningChanged = false;

            asyncValue.PropertyChanged += (sender, args) => {
                if (args.PropertyName == nameof(AsyncValue <string> .Value))
                {
                    valueChanged = true;
                }
                else if (args.PropertyName == nameof(AsyncValue <string> .IsRunning))
                {
                    runningChanged = true;
                }
            };

            tcs.SetException(new Exception());

            Assert.That(asyncValue.Value, Is.True);
            Assert.That(valueChanged, Is.False, "Value should not signal change when there's an exception");
            Assert.That(asyncValue.IsRunning, Is.False);
            Assert.That(runningChanged, Is.True);
        }
        public TypeSelectorViewModel(AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes)
        {
            if (assignableTypes == null)
            {
                throw new ArgumentNullException(nameof(assignableTypes));
            }

            assignableTypes.Task.ContinueWith(t => {
                this.typeOptions = new SimpleCollectionViewOptions {
                    DisplaySelector = (o) => ((ITypeInfo)o).Name
                };

                this.assemblyView = new SimpleCollectionView(t.Result, this.assemblyOptions = new SimpleCollectionViewOptions {
                    Filter           = AssemblyFilter,
                    DisplaySelector  = (o) => ((KeyValuePair <IAssemblyInfo, ILookup <string, ITypeInfo> >)o).Key.Name,
                    ChildrenSelector = (o) => ((KeyValuePair <IAssemblyInfo, ILookup <string, ITypeInfo> >)o).Value,
                    ChildOptions     = new SimpleCollectionViewOptions {
                        DisplaySelector  = (o) => ((IGrouping <string, ITypeInfo>)o).Key,
                        ChildrenSelector = (o) => ((IGrouping <string, ITypeInfo>)o),
                        ChildOptions     = this.typeOptions
                    }
                });
                OnPropertyChanged(nameof(Types));
                IsLoading = false;
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
        public void IsRunning()
        {
            var tcs        = new TaskCompletionSource <string> ();
            var asyncValue = new AsyncValue <string> (tcs.Task, scheduler: new SyncScheduler());

            Assume.That(asyncValue.Value, Is.Null);
            Assert.That(asyncValue.IsRunning, Is.True);

            bool changed = false;

            asyncValue.PropertyChanged += (sender, args) => {
                if (args.PropertyName == nameof(AsyncValue <string> .IsRunning))
                {
                    changed = true;
                }
            };

            const string value = "value";

            tcs.SetResult(value);

            Assume.That(asyncValue.Value, Is.EqualTo(value));
            Assert.That(asyncValue.IsRunning, Is.False, "IsRunning did not flip to false");
            Assert.That(changed, Is.True, "PropertyChanged did not fire for IsRunning");
        }
        public void DefaultValue()
        {
            var tcs   = new TaskCompletionSource <bool> ();
            var value = new AsyncValue <bool> (tcs.Task, defaultValue: true, scheduler: new SyncScheduler());

            Assert.That(value.Value, Is.True);
        }
Esempio n. 9
0
        private void RunSearch(string value)
        {
            if (String.IsNullOrWhiteSpace(value))
            {
                return;
            }

            SearchResults = new AsyncValue <IEnumerable <Person> > (this.client.SearchAsync(value), Enumerable.Empty <Person>());
        }
Esempio n. 10
0
        public void BasicAsync()
        {
            var asyncValue = new AsyncValue<int>(AsyncTestInput);
            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            asyncValue.ValueLoaded += (sender, args) => asyncValue_handleLoad(asyncValue);
            asyncValue.Load();
            Assert.AreEqual(LoadState.Loading, asyncValue.State);
        }
Esempio n. 11
0
        public AddBuddyViewModel(SocialClient client)
        {
            if (client == null)
                throw new ArgumentNullException ("client");

            this.client = client;
            this.addBuddy = new RelayCommand<Person> (OnAddBuddy, CanAddBuddy);
            this.searchResults = new AsyncValue<IEnumerable<Person>> (
                Task.FromResult (Enumerable.Empty<Person>()), Enumerable.Empty<Person>());
        }
        public void ValueReplacesDefaultValue(bool value)
        {
            var tcs        = new TaskCompletionSource <bool> ();
            var asyncValue = new AsyncValue <bool> (tcs.Task, defaultValue: !value, scheduler: new SyncScheduler());

            Assume.That(asyncValue.Value, Is.EqualTo(!value));

            tcs.SetResult(value);

            Assert.That(asyncValue.Value, Is.EqualTo(value));
        }
Esempio n. 13
0
        public void BasicAsync()
        {
            var asyncValue = new AsyncValue <int>(AsyncTestInput);

            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            asyncValue.ValueLoaded += (sender, args) => asyncValue_handleLoad(asyncValue);
            asyncValue.Load();
            Assert.AreEqual(LoadState.Loading, asyncValue.State);
        }
        public static ITypeInfo RequestType(AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes)
        {
            var w = new TypeSelectorWindow(new TypeSelectorViewModel(assignableTypes));

            var result = (NSModalResponse)(int)NSApplication.SharedApplication.RunModalForWindow(w);

            if (result != NSModalResponse.OK)
            {
                return(null);
            }

            return(w.selector.ViewModel.SelectedType);
        }
Esempio n. 15
0
        public void BasicSynchronous()
        {
            var asyncValue = new AsyncValue<int>(SyncTestInput);
            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            var loadHappened = false;
            asyncValue.ValueLoaded += (sender, args) =>
            {
                loadHappened = true;
            };
            asyncValue.Load();
            Assert.IsTrue(loadHappened);
        }
Esempio n. 16
0
		public MainWindowViewModel ([NotNull] GablarskiSocialClient client)
		{
			if (client == null)
				throw new ArgumentNullException ("client");

			this.client = client;
			this.buddyListViewModel = new BuddyListViewModel (client);
			this.onlineFilter = new ObservableFilter<Person, WatchList> (this.client.WatchList, p => p.Status != Status.Offline);

			Servers = new AsyncValue<IEnumerable<ServerEntry>> (ClientData.GetServersAsync(), Enumerable.Empty<ServerEntry>());

			AddBuddy = new RelayCommand (() => Messenger.Send (new AddBuddyMessage()));
			StartChat = new RelayCommand<Person> (OnStartChat);
		}
Esempio n. 17
0
        public void BasicSynchronous()
        {
            var asyncValue = new AsyncValue <int>(SyncTestInput);

            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            var loadHappened = false;

            asyncValue.ValueLoaded += (sender, args) =>
            {
                loadHappened = true;
            };
            asyncValue.Load();
            Assert.IsTrue(loadHappened);
        }
Esempio n. 18
0
        public MainWindowViewModel([NotNull] GablarskiSocialClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            this.client             = client;
            this.buddyListViewModel = new BuddyListViewModel(client);
            this.onlineFilter       = new ObservableFilter <Person, WatchList> (this.client.WatchList, p => p.Status != Status.Offline);

            Servers = new AsyncValue <IEnumerable <ServerEntry> > (ClientData.GetServersAsync(), Enumerable.Empty <ServerEntry>());

            AddBuddy  = new RelayCommand(() => Messenger.Send(new AddBuddyMessage()));
            StartChat = new RelayCommand <Person> (OnStartChat);
        }
Esempio n. 19
0
        internal static ITypeInfo RequestType(FrameworkElement owner, AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes)
        {
            Window hostWindow = Window.GetWindow(owner);

            var w = new TypeSelectorWindow(owner.Resources.MergedDictionaries, assignableTypes)
            {
                Owner = hostWindow,
            };

            if (!w.ShowDialog() ?? false)
            {
                return(null);
            }

            return(((TypeSelectorViewModel)w.DataContext).SelectedType);
        }
        public AddValueConverterViewModel(TargetPlatform platform, object target, AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes)
            : base(assignableTypes)
        {
            if (platform == null)
            {
                throw new ArgumentNullException(nameof(platform));
            }
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            this.platform = platform;
            this.target   = target;
            this.source   = GetDefaultResourceSourceAsync();
        }
        private async void RequestUpdateSources()
        {
            Task task = null;

            switch (SelectedBindingSource.Type)
            {
            case BindingSourceType.SingleObject:
            case BindingSourceType.Object:
                SelectedObjectTreeElement = null;
                ObjectElementRoots        = new AsyncValue <IReadOnlyList <ObjectTreeElement> > (GetRootElementsAsync());
                task = ObjectElementRoots.Task;
                break;

            case BindingSourceType.Type:
                TypeSelector = new TypeSelectorViewModel(new AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > (GetBindingSourceTypesAsync()));
                break;

            case BindingSourceType.Resource:
                SelectedResource = null;
                SourceResources  = new AsyncValue <ILookup <ResourceSource, Resource> > (GetSourceResourcesAsync());
                break;
            }

            if (task != null)
            {
                await task;
            }

            switch (SelectedBindingSource.Type)
            {
            case BindingSourceType.SingleObject:
            case BindingSourceType.Object:
                if (ObjectElementRoots.Value.Count == 1)
                {
                    var root     = ObjectElementRoots.Value[0];
                    var children = await root.Children.Task;
                    if (children.Count == 0)
                    {
                        SelectedObjectTreeElement = root;
                    }
                }
                break;
            }

            UpdateShowProperties();
            OnPropertyChanged(nameof(ShowLongDescription));
        }
        public void When_the_same_message_is_handled_by_multiple_consequenters_it_is_delivered_to_each_only_once()
        {
            var aggregateId            = Any.Guid();
            var consequenter1WasCalled = new AsyncValue <bool>();
            var consequenter2WasCalled = new AsyncValue <bool>();
            var consequenter1CallCount = 0;
            var consequenter2CallCount = 0;
            var consequenter1          = Consequenter.Create <Order.Fulfilled>(e =>
            {
                if (e.AggregateId == aggregateId)
                {
                    Interlocked.Increment(ref consequenter1CallCount);
                    consequenter1WasCalled.Set(true);
                }
            })
                                         .Named(MethodBase.GetCurrentMethod().Name + "-1")
                                         .UseServiceBusForDurability(settings, configuration: configuration);
            var consequenter2 = Consequenter.Create <Order.Fulfilled>(e =>
            {
                if (e.AggregateId == aggregateId)
                {
                    Interlocked.Increment(ref consequenter2CallCount);
                    consequenter2WasCalled.Set(true);
                }
            })
                                .Named(MethodBase.GetCurrentMethod().Name + "-2")
                                .UseServiceBusForDurability(settings, configuration: configuration);

            using (var catchup = CreateReadModelCatchup <CommandSchedulerDbContext>(consequenter1, consequenter2))
            {
                Events.Write(1, i => new Order.Fulfilled {
                    AggregateId = aggregateId
                });

                catchup.Run();

                // give the service bus messages times to be delivered
                Task.WaitAll(new Task[]
                {
                    consequenter1WasCalled,
                    consequenter2WasCalled
                }, DefaultTimeout());

                consequenter1CallCount.Should().Be(1);
                consequenter2CallCount.Should().Be(1);
            }
        }
Esempio n. 23
0
        internal static ITypeInfo RequestType(PropertyEditorPanel owner, AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes)
        {
            Window hostWindow = Window.GetWindow(owner);

            var w = new TypeSelectorWindow(owner.Resources.MergedDictionaries, assignableTypes)
            {
                Owner = hostWindow,
            };

            w.Resources.MergedDictionaries.AddItems(owner.Resources.MergedDictionaries);

            if (!w.ShowDialog() ?? false)
            {
                return(null);
            }

            return(w.tree.SelectedItem as ITypeInfo);
        }
        public async Task Catchup_can_be_used_with_intercepted_consequenters_to_queue_event_messages_on_the_service_bus()
        {
            var onCancelledCalled           = new AsyncValue <bool>();
            var onCreatedCalled             = new AsyncValue <bool>();
            var onDeliveredCalled           = new AsyncValue <bool>();
            var anonymousConsequenterCalled = new AsyncValue <bool>();

            var consequenter1 = new TestConsequenter(
                onCancelled: e => onCancelledCalled.Set(true),
                onCreated: e => onCreatedCalled.Set(true),
                onDelivered: e => onDeliveredCalled.Set(true))
                                .UseServiceBusForDurability(settings, configuration: configuration);

            var name          = MethodBase.GetCurrentMethod().Name;
            var consequenter2 = Consequenter.Create <Order.Fulfilled>(e => anonymousConsequenterCalled.Set(true))
                                .Named(name)
                                .UseServiceBusForDurability(settings, configuration: configuration);

            using (var catchup = CreateReadModelCatchup <CommandSchedulerDbContext>(
                       consequenter1,
                       consequenter2))
            {
                Events.Write(1, i => new Order.Created());
                Events.Write(1, i => new Order.Delivered());
                Events.Write(1, i => new Order.Fulfilled());
                Events.Write(1, i => new Order.Cancelled());

                catchup.Run();

                // give the service bus messages times to be delivered
                Task.WaitAll(new Task[]
                {
                    onCancelledCalled,
                    onCreatedCalled,
                    onDeliveredCalled,
                    anonymousConsequenterCalled
                }, DefaultTimeout());

                onCancelledCalled.Result.Should().Be(true);
                onCreatedCalled.Result.Should().Be(true);
                onDeliveredCalled.Result.Should().Be(true);
                anonymousConsequenterCalled.Result.Should().Be(true);
            }
        }
        protected override void OnAddEditors(IEnumerable <EditorViewModel> editors)
        {
            base.OnAddEditors(editors);
            ValueConverters = new AsyncValue <IReadOnlyList <Resource> > (GetValueConvertersAsync());

            var flags   = new List <EditorViewModel> ();
            var regular = new List <EditorViewModel> ();

            // We do not support grouped properties here
            foreach (EditorViewModel vm in Properties)
            {
                var propvm = vm as PropertyViewModel;
                if (propvm == null)
                {
                    continue;
                }
                if (BindingEditor.KnownProperties.ContainsKey(propvm.Property))
                {
                    continue;
                }

                if (propvm.Property.Type == typeof(bool))
                {
                    flags.Add(vm);
                }
                else
                {
                    regular.Add(vm);
                }
            }

            BindingProperties = regular;
            FlagsProperties   = flags;

            BindingSources.Task.ContinueWith(t => {
                SelectedBindingSource = t.Result.FirstOrDefault();
            }, TaskScheduler.FromCurrentSynchronizationContext());

            OnPropertyChanged(nameof(Path));
            OnPropertyChanged(nameof(SelectedValueConverter));
            OnPropertyChanged(nameof(ShowTypeLevel));
        }
        private void RequestUpdateProperties()
        {
            SelectedPropertyElement = null;

            ITypeInfo type = null;

            switch (SelectedBindingSource.Type)
            {
            case BindingSourceType.Type:
                type = TypeSelector.SelectedType;
                break;

            case BindingSourceType.SingleObject:
            case BindingSourceType.Object:
                type = SelectedObjectTreeElement?.Editor.TargetType;
                break;

            case BindingSourceType.Resource:
                if (SelectedResource != null)
                {
                    type = GetRealType(SelectedResource);
                }
                break;

            default:
                throw new InvalidOperationException();
            }

            if (type == null)
            {
                PropertyRoot = null;
                return;
            }

            Task <PropertyTreeRoot> task = this.editorProvider.GetPropertiesForTypeAsync(type)
                                           .ContinueWith(t => new PropertyTreeRoot(this.editorProvider, type, t.Result), TaskScheduler.Default);

            PropertyRoot = new AsyncValue <PropertyTreeRoot> (task);
        }
Esempio n. 27
0
        public void SyncException()
        {
            var asyncValue = new AsyncValue<int>(SyncErrorInput);
            Assert.AreEqual(LoadState.Unloaded, asyncValue.State);
            Assert.AreEqual(default(int), asyncValue.Value);

            var loadHappened = false;
            asyncValue.ValueLoaded += (sender, args) =>
            {
                loadHappened = true;
            };

            var errorHappened = false;
            asyncValue.LoadError += (sender, args) =>
            {
                errorHappened = true;
            };

            asyncValue.Load();
            Assert.IsFalse(loadHappened);
            Assert.IsTrue(errorHappened);
        }
Esempio n. 28
0
        private void RunSearch(string value)
        {
            if (String.IsNullOrWhiteSpace (value))
                return;

            SearchResults = new AsyncValue<IEnumerable<Person>> (this.client.SearchAsync (value), Enumerable.Empty<Person>());
        }
        public static Task <ITypeInfo> RequestAt(this TypeRequestedEventArgs self, IHostResourceProvider hostResources, NSView source, AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes)
        {
            var tcs = new TaskCompletionSource <ITypeInfo> ();

            var vm       = new TypeSelectorViewModel(assignableTypes);
            var selector = new TypeSelectorControl {
                ViewModel  = vm,
                Appearance = source.EffectiveAppearance
            };

            vm.PropertyChanged += (vms, ve) => {
                if (ve.PropertyName == nameof(TypeSelectorViewModel.SelectedType))
                {
                    tcs.TrySetResult(vm.SelectedType);
                }
            };

            var popover = new NSPopover {
                Behavior = NSPopoverBehavior.Transient,
                Delegate = new PopoverDelegate <ITypeInfo> (tcs),
                ContentViewController = new NSViewController {
                    View = selector,
                    PreferredContentSize = new CoreGraphics.CGSize(360, 335)
                },
            };

            popover.SetAppearance(hostResources.GetVibrantAppearance(source.EffectiveAppearance));

            tcs.Task.ContinueWith(t => {
                popover.PerformClose(popover);
                popover.Dispose();
            }, TaskScheduler.FromCurrentSynchronizationContext());

            popover.Show(source.Frame, source.Superview, NSRectEdge.MinYEdge);
            return(tcs.Task);
        }
Esempio n. 30
0
 internal CreateValueConverterWindow(IEnumerable <ResourceDictionary> mergedResources, TargetPlatform platform, object target, AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes)
 {
     DataContext = new AddValueConverterViewModel(platform, target, assignableTypes);
     InitializeComponent();
     Resources.MergedDictionaries.AddItems(mergedResources);
 }
Esempio n. 31
0
        internal static Tuple <string, ITypeInfo, ResourceSource> RequestConverter(FrameworkElement owner, TargetPlatform platform, object target, AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes)
        {
            Window hostWindow = Window.GetWindow(owner);
            var    w          = new CreateValueConverterWindow(owner.Resources.MergedDictionaries, platform, target, assignableTypes)
            {
                Owner = hostWindow,
            };

            if (!w.ShowDialog() ?? false)
            {
                return(null);
            }

            var vm = (AddValueConverterViewModel)w.DataContext;

            return(new Tuple <string, ITypeInfo, ResourceSource> (w.converterName.Text, vm.SelectedType, vm.Source));
        }
Esempio n. 32
0
 /// <summary>
 /// Resolve the current asynchronous value into an awaitable value.
 /// </summary>
 /// <typeparam name="T">The type of the awaitable value.</typeparam>
 /// <param name="self">The current asynchronous value provider.</param>
 /// <param name="token">A cancellation token.</param>
 /// <returns>An awaitable value of the specified type.</returns>
 public static Task <T> ResolveAsync <T>(this AsyncValue <T> self, CancellationToken token = default(CancellationToken))
 {
     return(self.Invoke(token));
 }
Esempio n. 33
0
 internal TypeSelectorWindow(IEnumerable <ResourceDictionary> mergedResources, AsyncValue <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > assignableTypes)
 {
     DataContext = new TypeSelectorViewModel(assignableTypes);
     InitializeComponent();
     Resources.MergedDictionaries.AddItems(mergedResources);
 }