public ViewModelTransactionalActionStack(int capacity, IViewModelServiceProvider serviceProvider, IEnumerable<IActionItem> initialActionsItems) : base(capacity, initialActionsItems) { if (serviceProvider == null) throw new ArgumentNullException("serviceProvider"); ServiceProvider = serviceProvider; Dispatcher = serviceProvider.Get<IDispatcherService>(); }
/// <summary> /// Initializes a new instance of the <see cref="LoggerViewModel"/> class with a single logger. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> to use for this view model.</param> /// <param name="logger">The <see cref="Logger"/> to monitor.</param> public LoggerViewModel(IViewModelServiceProvider serviceProvider, Logger logger) : this(serviceProvider) { if (logger == null) throw new ArgumentNullException("logger"); Loggers.Add(logger, new List<ILogMessage>()); logger.MessageLogged += MessageLogged; }
public ViewModelTransactionalActionStack(int capacity, IViewModelServiceProvider serviceProvider) : base(capacity) { if (serviceProvider == null) throw new ArgumentNullException("serviceProvider"); ServiceProvider = serviceProvider; Dispatcher = serviceProvider.Get<IDispatcherService>(); }
/// <summary> /// Initializes a new instance of the <see cref="AnonymousCommand"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="Services.IDispatcherService"/> to use for this view model.</param> /// <param name="action">An anonymous method that will be called each time the command is executed.</param> /// <param name="canExecute">An anonymous method that will be called each time the command <see cref="CommandBase.CanExecute(object)"/> method is invoked.</param> public AnonymousCommand(IViewModelServiceProvider serviceProvider, Action<object> action, Func<bool> canExecute = null) : base(serviceProvider) { if (action == null) throw new ArgumentNullException(nameof(action)); this.action = action; this.canExecute = canExecute; }
/// <summary> /// Initializes a new instance of the <see cref="AnonymousCommand"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="Services.IDispatcherService"/> to use for this view model.</param> /// <param name="action">An anonymous method that will be called each time the command is executed.</param> public AnonymousCommand(IViewModelServiceProvider serviceProvider, Action action) : base(serviceProvider) { if (action == null) throw new ArgumentNullException(nameof(action)); this.action = x => action(); }
public static ObservableViewModel CombineViewModels(IViewModelServiceProvider serviceProvider, NodeContainer nodeContainer, IReadOnlyCollection<ObservableViewModel> viewModels) { if (viewModels == null) throw new ArgumentNullException(nameof(viewModels)); var combinedViewModel = new ObservableViewModel(serviceProvider, nodeContainer, viewModels.SelectMany(x => x.Dirtiables)); var rootNodes = new List<ObservableModelNode>(); foreach (var viewModel in viewModels) { if (!(viewModel.RootNode is SingleObservableNode)) throw new ArgumentException(@"The view models to combine must contains SingleObservableNode.", nameof(viewModels)); viewModel.parent = combinedViewModel; var rootNode = (ObservableModelNode)viewModel.RootNode; rootNodes.Add(rootNode); } if (rootNodes.Count < 2) throw new ArgumentException(@"Called CombineViewModels with a collection of view models that is either empty or containt just a single item.", nameof(viewModels)); // Find best match for the root node type var rootNodeType = rootNodes.First().Root.Type; if (rootNodes.Skip(1).Any(x => x.Type != rootNodeType)) rootNodeType = typeof(object); CombinedObservableNode rootCombinedNode = CombinedObservableNode.Create(combinedViewModel, "Root", null, rootNodeType, rootNodes, null); rootCombinedNode.Initialize(); combinedViewModel.RootNode = rootCombinedNode; return combinedViewModel; }
/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> private ObservableViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { ObservableViewModelService = serviceProvider.TryGet<ObservableViewModelService>(); if (ObservableViewModelService == null) throw new InvalidOperationException($"{nameof(ObservableViewModel)} requires a {nameof(ObservableViewModelService)} in the service provider."); Logger = GlobalLogger.GetLogger(DefaultLoggerName); }
public ModelNodeCommandWrapper(IViewModelServiceProvider serviceProvider, INodeCommand nodeCommand, GraphNodePath nodePath, Index index) : base(serviceProvider) { if (nodeCommand == null) throw new ArgumentNullException(nameof(nodeCommand)); NodePath = nodePath; Index = index; NodeCommand = nodeCommand; }
public ModelNodeCommandWrapper(IViewModelServiceProvider serviceProvider, INodeCommand nodeCommand, GraphNodePath nodePath, IEnumerable<IDirtiable> dirtiables) : base(serviceProvider, dirtiables) { if (nodeCommand == null) throw new ArgumentNullException(nameof(nodeCommand)); NodePath = nodePath; NodeCommand = nodeCommand; Service = serviceProvider.Get<ObservableViewModelService>(); }
/// <summary> /// Initializes a new instance of the <see cref="AnonymousCommand"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> to use for this view model.</param> /// <param name="action">An anonymous method that will be called each time the command is executed.</param> public AnonymousCommand(IViewModelServiceProvider serviceProvider, Action<object> action) : base(serviceProvider) { if (action == null) throw new ArgumentNullException("action"); this.action = action; }
public CombinedNodeCommandWrapper(IViewModelServiceProvider serviceProvider, string name, IReadOnlyCollection<ModelNodeCommandWrapper> commands) : base(serviceProvider) { if (commands == null) throw new ArgumentNullException(nameof(commands)); if (commands.Count == 0) throw new ArgumentException(@"The collection of commands to combine is empty", nameof(commands)); if (commands.Any(x => !ReferenceEquals(x.NodeCommand, commands.First().NodeCommand))) throw new ArgumentException(@"The collection of commands to combine cannot contain different node commands", nameof(commands)); this.commands = commands; Name = name; }
/// <summary> /// Initializes a new instance of the <see cref="AnonymousCommand"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> to use for this view model.</param> /// <param name="action">An anonymous method that will be called each time the command is executed.</param> /// <param name="canExecute">An anonymous method that will be called each time the command <see cref="CommandBase.CanExecute(object)"/> method is invoked.</param> public AnonymousCommand(IViewModelServiceProvider serviceProvider, Action action, Func<bool> canExecute) : base(serviceProvider) { this.canExecute = canExecute; if (action == null) throw new ArgumentNullException("action"); this.action = x => action(); }
/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> /// <param name="nodeContainer">A <see cref="NodeContainer"/> to use to build view model nodes.</param> /// <param name="modelNode">The root model node of the view model to generate.</param> /// <param name="dirtiables">The list of <see cref="IDirtiable"/> objects linked to this view model.</param> public ObservableViewModel(IViewModelServiceProvider serviceProvider, NodeContainer nodeContainer, IGraphNode modelNode, IEnumerable<IDirtiable> dirtiables) : this(serviceProvider, nodeContainer, dirtiables.SafeArgument("dirtiables").ToList()) { if (modelNode == null) throw new ArgumentNullException(nameof(modelNode)); var node = ObservableViewModelService.ObservableNodeFactory(this, "Root", modelNode.Content.IsPrimitive, modelNode, new GraphNodePath(modelNode), modelNode.Content.Type, null); node.Initialize(); RootNode = node; node.CheckConsistency(); }
/// <summary> /// Initializes a new instance of the <see cref="LoggerViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> to use for this view model.</param> public LoggerViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { AddLoggerCommand = new AnonymousCommand<Logger>(serviceProvider, AddLogger); RemoveLoggerCommand = new AnonymousCommand<Logger>(serviceProvider, RemoveLogger); ClearLoggersCommand = new AnonymousCommand(serviceProvider, ClearLoggers); ClearMessagesCommand = new AsyncCommand(serviceProvider, ClearMessages); messages.CollectionChanged += MessagesCollectionChanged; }
/// <summary> /// Initializes a new instance of the <see cref="ActionItemViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> to use for this view model.</param> /// <param name="actionItem">The action item linked to this view model.</param> public ActionItemViewModel(IViewModelServiceProvider serviceProvider, IActionItem actionItem) : base(serviceProvider) { if (actionItem == null) throw new ArgumentNullException(nameof(actionItem)); ActionItem = actionItem; DisplayName = actionItem.Name; Refresh(); }
/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> /// <param name="propertyProvider">The object providing properties to display</param> /// <param name="graphNode">The root node of the view model to generate.</param> private ObservableViewModel(IViewModelServiceProvider serviceProvider, IPropertiesProviderViewModel propertyProvider, IGraphNode graphNode) : this(serviceProvider) { if (graphNode == null) throw new ArgumentNullException(nameof(graphNode)); PropertiesProvider = propertyProvider; var node = ObservableViewModelService.ObservableNodeFactory(this, "Root", graphNode.Content.IsPrimitive, graphNode, new GraphNodePath(graphNode), graphNode.Content.Type, Index.Empty); node.Initialize(); RootNode = node; node.CheckConsistency(); }
/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> /// <param name="modelContainer">A <see cref="ModelContainer"/> to use to build view model nodes.</param> /// <param name="modelNode">The root model node of the view model to generate.</param> /// <param name="dirtiables">The list of <see cref="IDirtiableViewModel"/> objects linked to this view model.</param> public ObservableViewModel(IViewModelServiceProvider serviceProvider, ModelContainer modelContainer, IModelNode modelNode, IEnumerable<IDirtiableViewModel> dirtiables) : this(serviceProvider, modelContainer, dirtiables.SafeArgument("dirtiables").ToList()) { if (modelNode == null) throw new ArgumentNullException("modelNode"); var node = observableViewModelService.ObservableNodeFactory(this, "Root", modelNode.Content.IsPrimitive, modelNode, new ModelNodePath(modelNode), modelNode.Content.Type, null); Identifier = new ObservableViewModelIdentifier(node.ModelGuid); node.Initialize(); RootNode = node; node.CheckConsistency(); }
/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> /// <param name="nodeContainer">A <see cref="NodeContainer"/> to use to build view model nodes.</param> /// <param name="dirtiables">The list of <see cref="IDirtiable"/> objects linked to this view model.</param> private ObservableViewModel(IViewModelServiceProvider serviceProvider, NodeContainer nodeContainer, IEnumerable<IDirtiable> dirtiables) : base(serviceProvider) { if (nodeContainer == null) throw new ArgumentNullException(nameof(nodeContainer)); if (dirtiables == null) throw new ArgumentNullException(nameof(dirtiables)); NodeContainer = nodeContainer; Dirtiables = dirtiables; ObservableViewModelService = serviceProvider.Get<ObservableViewModelService>(); Logger = GlobalLogger.GetLogger(DefaultLoggerName); }
public VirtualNodeCommandWrapper(IViewModelServiceProvider serviceProvider, INodeCommand nodeCommand, IGraphNode node, Index index) : base(serviceProvider) { if (nodeCommand == null) throw new ArgumentNullException(nameof(nodeCommand)); if (node == null) throw new ArgumentNullException(nameof(node)); this.node = node; this.index = index; NodeCommand = nodeCommand; Service = serviceProvider.Get<ObservableViewModelService>(); }
/// <summary> /// Initializes a new instance of the <see cref="AnonymousCommandWrapper"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="ITransactionalActionStack"/> to use for this view model.</param> /// <param name="name">The name of this command.</param> /// <param name="combineMode">The combine mode to apply to this command.</param> /// <param name="redo">The do/redo function.</param> /// <param name="undo">The undo action, if the command can be undone.</param> /// <param name="dirtiables">The <see cref="IDirtiableViewModel"/> instances associated to this command.</param> public AnonymousCommandWrapper(IViewModelServiceProvider serviceProvider, string name, CombineMode combineMode, Func<object, UndoToken> redo, Action<object, UndoToken> undo, IEnumerable<IDirtiableViewModel> dirtiables) : base(serviceProvider, dirtiables) { if (name == null) throw new ArgumentNullException("name"); if (redo == null) throw new ArgumentNullException("redo"); this.name = name; this.combineMode = combineMode; this.redo = redo; this.undo = undo; this.serviceProvider = serviceProvider; }
/// <summary> /// Initializes a new instance of the <see cref="AnonymousCommandWrapper"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="ITransactionalActionStack"/> to use for this view model.</param> /// <param name="name">The name of this command.</param> /// <param name="combineMode">The combine mode to apply to this command.</param> /// <param name="redo">The do/redo function.</param> /// <param name="undo">The undo action, if the command can be undone.</param> /// <param name="dirtiables">The <see cref="IDirtiableViewModel"/> instances associated to this command.</param> /// <param name="discardTransactions">The transaction will be discarded if true, otherwise it is ended.</param> public AnonymousCommandWrapper(IViewModelServiceProvider serviceProvider, string name, CombineMode combineMode, Func<object, UndoToken> redo, Action<object, UndoToken> undo, IEnumerable<IDirtiableViewModel> dirtiables, bool discardTransactions = true) : base(serviceProvider, dirtiables) { if (name == null) throw new ArgumentNullException(nameof(name)); if (redo == null) throw new ArgumentNullException(nameof(redo)); Name = name; CombineMode = combineMode; this.redo = (parameter, creatingActionItem) => redo(parameter); this.undo = undo; DiscardTransactions = discardTransactions; }
/// <summary> /// Initializes a new instance of the <see cref="LoggerViewModel"/> class with multiple loggers. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> to use for this view model.</param> /// <param name="loggers">The collection of <see cref="Logger"/> to monitor.</param> public LoggerViewModel(IViewModelServiceProvider serviceProvider, IEnumerable<Logger> loggers) : this(serviceProvider) { if (loggers == null) throw new ArgumentNullException("loggers"); foreach (var logger in loggers) { Loggers.Add(logger, new List<ILogMessage>()); logger.MessageLogged += MessageLogged; } ClearMessagesCommand = new AsyncCommand(serviceProvider, ClearMessages); }
/// <summary> /// Initializes a new instance of the <see cref="LoggerResultViewModel"/> class multiple instances of <see cref="LoggerResult"/>. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> to use for this view model.</param> /// <param name="loggerResults"></param> public LoggerResultViewModel(IViewModelServiceProvider serviceProvider, IEnumerable<LoggerResult> loggerResults) : base(serviceProvider, loggerResults) { var messages = (ObservableList<ILogMessage>)Messages; foreach (var logger in Loggers) { var loggerResult = (LoggerResult)logger.Key; logger.Value.AddRange(loggerResult.Messages); messages.AddRange(loggerResult.Messages); } }
/// <summary> /// Initializes a new instance of the <see cref="ActionStackViewModel"/>. /// </summary> /// <param name="serviceProvider">The service provider related to this view model</param> /// <param name="actionStack">The action stack. Cannot be null.</param> public ActionStackViewModel(IViewModelServiceProvider serviceProvider, ITransactionalActionStack actionStack) : base(serviceProvider) { ActionStack = actionStack; actionStack.ActionItemsAdded += ActionItemsAdded; actionStack.ActionItemsCleared += ActionItemsCleared; actionStack.ActionItemsDiscarded += ActionItemsDiscarded; actionStack.Undone += ActionItemModified; actionStack.Redone += ActionItemModified; }
/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> /// <param name="modelContainer">A <see cref="ModelContainer"/> to use to build view model nodes.</param> /// <param name="dirtiables">The list of <see cref="IDirtiableViewModel"/> objects linked to this view model.</param> private ObservableViewModel(IViewModelServiceProvider serviceProvider, ModelContainer modelContainer, IEnumerable<IDirtiableViewModel> dirtiables) : base(serviceProvider) { if (modelContainer == null) throw new ArgumentNullException("modelContainer"); if (dirtiables == null) throw new ArgumentNullException("dirtiables"); this.modelContainer = modelContainer; this.dirtiables = dirtiables; this.dirtiables.ForEach(x => x.DirtinessUpdated += DirtinessUpdated); observableViewModelService = serviceProvider.Get<ObservableViewModelService>(); Logger = GlobalLogger.GetLogger(DefaultLoggerName); }
/// <summary> /// Initializes a new instance of the <see cref="AnonymousCommandWrapper"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="ITransactionalActionStack"/> to use for this view model.</param> /// <param name="name">The name of this command.</param> /// <param name="combineMode">The combine mode to apply to this command.</param> /// <param name="redo">The do/redo function.</param> /// <param name="undo">The undo action, if the command can be undone.</param> /// <param name="dirtiables">The <see cref="IDirtiableViewModel"/> instances associated to this command.</param> /// <param name="discardTransactions">The transaction will be discarded if true, otherwise it is ended.</param> public AnonymousCommandWrapper(IViewModelServiceProvider serviceProvider, string name, CombineMode combineMode, Func<object, bool, UndoToken> redo, Action<object, UndoToken> undo, IEnumerable<IDirtiableViewModel> dirtiables, bool discardTransactions = true) : base(serviceProvider, dirtiables) { if (name == null) throw new ArgumentNullException("name"); if (redo == null) throw new ArgumentNullException("redo"); this.name = name; this.combineMode = combineMode; this.redo = redo; this.undo = undo; this.serviceProvider = serviceProvider; this.DiscardTransactions = discardTransactions; this.AllowReentrancy = false; }
public ModelNodeCommandWrapper(IViewModelServiceProvider serviceProvider, INodeCommand nodeCommand, string observableNodePath, ObservableViewModel owner, ModelNodePath nodePath, IEnumerable<IDirtiableViewModel> dirtiables) : base(serviceProvider, dirtiables) { if (nodeCommand == null) throw new ArgumentNullException(nameof(nodeCommand)); if (owner == null) throw new ArgumentNullException(nameof(owner)); NodePath = nodePath; // Note: the owner should not be stored in the command because we want it to be garbage collectable Identifier = owner.Identifier; ModelContainer = owner.ModelContainer; NodeCommand = nodeCommand; Service = serviceProvider.Get<ObservableViewModelService>(); ObservableNodePath = observableNodePath; }
public CombinedNodeCommandWrapper(IViewModelServiceProvider serviceProvider, string name, string observableNodePath, ObservableViewModelIdentifier identifier, IReadOnlyCollection<ModelNodeCommandWrapper> commands) : base(serviceProvider, null) { if (commands == null) throw new ArgumentNullException("commands"); if (commands.Count == 0) throw new ArgumentException(@"The collection of commands to combine is empty", "commands"); if (commands.Any(x => !ReferenceEquals(x.NodeCommand, commands.First().NodeCommand))) throw new ArgumentException(@"The collection of commands to combine cannot contain different node commands", "commands"); service = serviceProvider.Get<ObservableViewModelService>(); this.commands = commands; this.name = name; this.identifier = identifier; this.serviceProvider = serviceProvider; ObservableNodePath = observableNodePath; }
public static ObservableViewModel Create(IViewModelServiceProvider serviceProvider, IPropertiesProviderViewModel propertyProvider) { if (serviceProvider == null) throw new ArgumentNullException(nameof(serviceProvider)); if (propertyProvider == null) throw new ArgumentNullException(nameof(propertyProvider)); if (!propertyProvider.CanProvidePropertiesViewModel) return null; var rootNode = propertyProvider.GetRootNode(); if (rootNode == null) return null; return new ObservableViewModel(serviceProvider, propertyProvider, rootNode); }
public NewsPageViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { OpenUrlCommand = new AnonymousTaskCommand(ServiceProvider, OpenUrl); }
public AddItemTemplateCollectionViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { RootGroup = new TemplateDescriptionGroupViewModel(serviceProvider, "All templates"); }
public AsyncCommand(IViewModelServiceProvider serviceProvider, Action action) : base(serviceProvider) { this.action = x => action(); }
public AsyncCommand(IViewModelServiceProvider serviceProvider, Action <object> action) : base(serviceProvider) { this.action = action; }
/// <summary> /// Initializes a new instance of the <see cref="AssetNodePresenterCommandWrapper"/> class. /// </summary> /// <param name="serviceProvider">The service provider of the view model.</param> /// <param name="nodePresenters">The <see cref="INodePresenter"/> instances on which to invoke the command.</param> /// <param name="command">The command to invoke.</param> public AssetNodePresenterCommandWrapper([NotNull] IViewModelServiceProvider serviceProvider, IReadOnlyCollection <INodePresenter> nodePresenters, INodePresenterCommand command) : base(serviceProvider, nodePresenters, command) { }
public DebugAssetChildNodeViewModel(IViewModelServiceProvider serviceProvider, IGraphNode node, HashSet <IGraphNode> registeredNodes) : this(serviceProvider, node, NodeIndex.Empty, null, LinkRoot, registeredNodes) { }
public BlockTemplateDescriptionViewModel(IViewModelServiceProvider serviceProvider, IBlockFactory blockFactory) : base(serviceProvider, CreateTemplate(blockFactory)) { BlockFactory = blockFactory; }
protected TemplateDescriptionCollectionViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { }
protected PickablePackageViewModel([NotNull] IViewModelServiceProvider serviceProvider) : base(serviceProvider) { }
/// <summary> /// Initializes a new instance of the <see cref="TransactionViewModel"/> class. /// </summary> /// <param name="serviceProvider">The service provider to use for this view model.</param> /// <param name="transaction">The transaction represented by this view model.</param> public TransactionViewModel(IViewModelServiceProvider serviceProvider, IReadOnlyTransaction transaction) : base(serviceProvider) { this.transaction = transaction; Name = ServiceProvider.Get <IUndoRedoService>().GetName(transaction); }
public ImportModelFromFileViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { ReferenceViewModel = GraphViewModel.Create(serviceProvider, new[] { referenceContainer }); }
public StatusViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { }
/// <summary> /// Initializes a new instance of the <see cref="NodePresenterCommandWrapper"/> class. /// </summary> /// <param name="serviceProvider">The service provider of the view model.</param> /// <param name="presenters">The <see cref="INodePresenter"/> instances on which to invoke the command.</param> /// <param name="command">The command to invoke.</param> public NodePresenterCommandWrapper([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IReadOnlyCollection <INodePresenter> presenters, [NotNull] INodePresenterCommand command) : base(serviceProvider) { this.presenters = presenters ?? throw new ArgumentNullException(nameof(presenters)); Command = command ?? throw new ArgumentNullException(nameof(command)); }
public AddItemWindow(IViewModelServiceProvider serviceProvider, TemplateDescriptionCollectionViewModel templateDescriptions) { DataContext = templateDescriptions; InitializeComponent(); AddItemCommand = new AnonymousCommand <ITemplateDescriptionViewModel>(serviceProvider, ValidateSelectedTemplate); }
/// <summary> /// Initializes a new instance of the <see cref="EditableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ITransactionalActionStack"/> to use for this view model.</param> protected EditableViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { ActionStack = serviceProvider.Get <ITransactionalActionStack>(); }
/// <summary> /// Initializes a new instance of the <see cref="CancellableCommand"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IActionStack"/> to use for this view model.</param> /// <param name="dirtiables">The <see cref="IDirtiableViewModel"/> instances associated to this command.</param> protected NodeCommandWrapperBase(IViewModelServiceProvider serviceProvider, IEnumerable <IDirtiableViewModel> dirtiables) : base(serviceProvider, dirtiables) { }
/// <summary> /// Initializes a new instance of the <see cref="DirtiableEditableViewModel"/> class. /// </summary> protected DirtiableEditableViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { }
internal UninstallHelper(IViewModelServiceProvider serviceProvider, NugetStore store) { this.serviceProvider = serviceProvider; this.store = store; store.NugetPackageUninstalling += PackageUninstalling; }
public static async Task <List <NewsPageViewModel> > FetchNewsPages(IViewModelServiceProvider serviceProvider, int maxCount) { var result = new List <NewsPageViewModel>(); var rss = new MemoryStream(); try { WebRequest request = WebRequest.Create(Urls.RssFeed); using var reponse = await request.GetResponseAsync(); using var str = reponse.GetResponseStream(); str?.CopyTo(rss); } catch { // Unable to reach the URL, return an empty list return(result); } rss.Position = 0; if (rss.Length == 0) { return(result); } try { int count = 0; using XmlReader rssReader = XmlReader.Create(rss); rssReader.MoveToContent(); while (rssReader.ReadToFollowing("item") && count < maxCount) { rssReader.ReadToFollowing("title"); string title = rssReader.Read() ? rssReader.Value : null; rssReader.ReadToFollowing("description"); string description = rssReader.Read() ? rssReader.Value : null; rssReader.ReadToFollowing("pubDate"); var date = new DateTime(); bool dateValid = rssReader.Read() && DateTime.TryParseExact(rssReader.Value, "ddd, dd MMM yyyy HH:mm:ss zz00", CultureInfo.InvariantCulture, DateTimeStyles.None, out date); rssReader.ReadToFollowing("link"); string link = rssReader.Read() ? rssReader.Value : null; if (dateValid && title != null && link != null && description != null) { var page = new NewsPageViewModel(serviceProvider) { Title = title, Url = link, Description = description, Date = date }; result.Add(page); ++count; } } } catch { result.Clear(); } return(result); }
public BuildLogViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { }
public DebugAssetBaseNodeViewModel(IViewModelServiceProvider serviceProvider, IGraphNode node) : base(serviceProvider, node) { Asset = DebugAssetNodeCollectionViewModel.FindAssetForNode(node.Guid); }
public AsyncCommand(IViewModelServiceProvider serviceProvider, Action action, Func <bool> canExecute) : base(serviceProvider) { this.action = x => action(); this.canExecute = canExecute; }
/// <summary> /// Initializes a new instance of the <see cref="DirtiableEditableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ITransactionalActionStack"/> to use for this view model.</param> public DirtiableEditableViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { }
/// <summary> /// Initializes a new instance of the <see cref="ObservableViewModel"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IDispatcherService"/> and an <see cref="ObservableViewModelService"/> to use for this view model.</param> private ObservableViewModel(IViewModelServiceProvider serviceProvider) : base(serviceProvider) { ObservableViewModelService = serviceProvider.Get<ObservableViewModelService>(); Logger = GlobalLogger.GetLogger(DefaultLoggerName); }
/// <summary> /// Initializes a new instance of the <see cref="CommandBase"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="Services.IDispatcherService"/> to use for this view model.</param> protected CommandBase([NotNull] IViewModelServiceProvider serviceProvider) : base(serviceProvider) { }
public FixAssetReferencesWindow(IViewModelServiceProvider serviceProvider) { InitializeComponent(); Width = Math.Min(Width, SystemParameters.WorkArea.Width); Height = Math.Min(Height, SystemParameters.WorkArea.Height); }
public DebugAssetRootNodeViewModel(IViewModelServiceProvider serviceProvider, string assetName, IGraphNode node, HashSet <IGraphNode> registeredNodes) : base(serviceProvider, node, registeredNodes) { AssetName = assetName; }
public ModelComponentViewModel(IViewModelServiceProvider serviceProvider, EntityViewModel entity) : base(serviceProvider) { this.entity = entity; }
public DebugAssetNodeViewModel(IViewModelServiceProvider serviceProvider, IGraphNode node) : base(serviceProvider) { Node = node; BreakCommand = new AnonymousCommand(ServiceProvider, Break); }
public XenkoDebugService(IViewModelServiceProvider serviceProvider) { Dispatcher = serviceProvider.Get <IDispatcherService>(); RecompilationDelay = TimeSpan.FromSeconds(0.5); }
public DebugUndoRedoUserControl(IViewModelServiceProvider serviceProvider, IUndoRedoService undoRedo) { InitializeComponent(); DataContext = new DebugUndoRedoViewModel(serviceProvider, undoRedo); }