public DllListingModel(IManageComPluginSourceModel updateManager, IFileListing dllListing) { _comUpdateManager = updateManager; if (dllListing != null) { Name = dllListing.Name; FullName = dllListing.FullName; var listing = (dllListing as DllListing); if (listing != null) { Is32Bit = listing.Is32Bit; ClsId = listing.ClsId; } if (dllListing.Children != null && dllListing.Children.Count > 0) { Children = new AsyncObservableCollection <IDllListingModel>( dllListing.Children.Select(input => new DllListingModel(_comUpdateManager, input))); } IsDirectory = dllListing.IsDirectory; IsExpanderVisible = IsDirectory; IsVisible = true; _dllListing = dllListing; ExpandingCommand = new DelegateCommand(Expanding); } _isCom = true; }
/// <exception cref="Exception">A delegate callback throws an exception.</exception> public ManageComPluginSourceViewModel(IManageComPluginSourceModel updateManager, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IComPluginSource pluginSource, IAsyncWorker asyncWorker) : this(updateManager, aggregator, asyncWorker) { VerifyArgument.IsNotNull("compluginSource", pluginSource); asyncWorker.Start(() => { IsLoading = true; var comPluginSource = updateManager.FetchSource(pluginSource.Id); List<DllListingModel> names = updateManager.GetComDllListings(null)?.Select(input => new DllListingModel(updateManager, input)).ToList(); return new Tuple<IComPluginSource, List<DllListingModel>>(comPluginSource, names); }, tuple => { if (tuple.Item2 != null) { _originalDllListings = new AsyncObservableCollection<IDllListingModel>(tuple.Item2); DllListings = _originalDllListings; } _pluginSource = tuple.Item1; _pluginSource.ResourcePath = pluginSource.ResourcePath; SetupHeaderTextFromExisting(); FromModel(_pluginSource); Item = ToModel(); IsLoading = false; }); }
/// <exception cref="Exception">A delegate callback throws an exception.</exception> public ManageComPluginSourceViewModel(IManageComPluginSourceModel updateManager, Task<IRequestServiceNameViewModel> requestServiceNameViewModel, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IAsyncWorker asyncWorker) : this(updateManager, aggregator, asyncWorker) { VerifyArgument.IsNotNull("requestServiceNameViewModel", requestServiceNameViewModel); PerformLoadAll(); _requestServiceNameViewModel = requestServiceNameViewModel; Item = ToModel(); }
public ManageComPluginSourceViewModel(IManageComPluginSourceModel updateManager, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IComPluginSource pluginSource, IAsyncWorker asyncWorker, Action<System.Action> dispatcherAction) : this(updateManager, aggregator, asyncWorker) { VerifyArgument.IsNotNull("comPluginSource", pluginSource); DispatcherAction = dispatcherAction; _pluginSource = pluginSource; SetupHeaderTextFromExisting(); PerformLoadAll(() => FromModel(_pluginSource)); Item = ToModel(); }
/// <exception cref="Exception">A delegate callback throws an exception.</exception> public ManageComPluginSourceViewModel(IManageComPluginSourceModel updateManager, Microsoft.Practices.Prism.PubSubEvents.IEventAggregator aggregator, IAsyncWorker asyncWorker) : base("ComPluginSource") { VerifyArgument.IsNotNull("asyncWorker", asyncWorker); VerifyArgument.IsNotNull("updateManager", updateManager); VerifyArgument.IsNotNull("aggregator", aggregator); _updateManager = updateManager; AsyncWorker = asyncWorker; HeaderText = Resources.Languages.Core.ComPluginSourceNewHeaderLabel; Header = Resources.Languages.Core.ComPluginSourceNewHeaderLabel; OkCommand = new DelegateCommand(Save, CanSave); CancelCommand = new DelegateCommand(() => CloseAction.Invoke()); ClearSearchTextCommand = new DelegateCommand(() => SearchTerm = ""); RefreshCommand = new DelegateCommand(() => PerformLoadAll()); _warewolfserverName = updateManager.ServerName; if (Application.Current != null && Application.Current.Dispatcher != null) { DispatcherAction = Application.Current.Dispatcher.Invoke; } }