public UpdatePackageTemplateCollectionViewModel(SessionViewModel session)
            : base(session.SafeArgument(nameof(session)).ServiceProvider)
        {
            if (session == null)
            {
                throw new ArgumentNullException(nameof(session));
            }
            this.session = session;

            var rootGroup = new TemplateDescriptionGroupViewModel(ServiceProvider, "All templates");

            foreach (TemplateDescription template in session.FindTemplates(TemplateScope.Package))
            {
                var viewModel = new PackageTemplateViewModel(ServiceProvider, template, session);
                rootGroup.Templates.Add(viewModel);
            }

            Location = session.SolutionPath?.GetFullDirectory() ?? InternalSettings.TemplatesWindowDialogLastNewSessionTemplateDirectory.GetValue();
            if (string.IsNullOrWhiteSpace(Location))
            {
                Location = UPath.Combine <UDirectory>(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Stride Projects");
            }

            SelectedGroup = rootGroup;
        }
Beispiel #2
0
 public PreviewViewModel(SessionViewModel session)
     : base(session.SafeArgument(nameof(session)).ServiceProvider)
 {
     this.session = session;
     session.ActiveAssetView.SelectedAssets.CollectionChanged += SelectedAssetsCollectionChanged;
     session.ActiveAssetsChanged += ActiveAssetsChanged;
 }
Beispiel #3
0
        public SessionObjectPropertiesViewModel(SessionViewModel session)
            : base(session.SafeArgument(nameof(session)).ServiceProvider, session.AssetNodeContainer)
        {
            Session = session;

            // Register initialization handler that will fill the default associated data
            ViewModelService.NodePresenterFactory = new AssetNodePresenterFactory(NodeContainer.NodeBuilder, ViewModelService.AvailableCommands, ViewModelService.AvailableUpdaters);
            ViewModelService.NodeViewModelFactory = new AssetNodeViewModelFactory();

            var dialogService        = ServiceProvider.Get <IDialogService>();
            var documentationService = session.ServiceProvider.Get <UserDocumentationService>();

            RegisterNodePresenterCommand(new CopyPropertyCommand());
            RegisterNodePresenterCommand(new PastePropertyCommand());
            RegisterNodePresenterCommand(new ReplacePropertyCommand());
            RegisterNodePresenterCommand(new BrowseDirectoryCommand(dialogService, new SessionInitialDirectoryProvider(session)));
            RegisterNodePresenterCommand(new BrowseFileCommand(dialogService, new SessionInitialDirectoryProvider(session)));
            RegisterNodePresenterCommand(new FetchAssetCommand(session));
            RegisterNodePresenterCommand(new PickupAssetCommand(session));
            RegisterNodePresenterCommand(new SetContentReferenceCommand());
            RegisterNodePresenterCommand(new ResetOverrideCommand());

            RegisterNodePresenterUpdater(new ArchetypeNodeUpdater());
            RegisterNodePresenterUpdater(new DocumentationNodeUpdater(documentationService));
            RegisterNodePresenterUpdater(new OwnerAssetUpdater());
            RegisterNodePresenterUpdater(new SessionNodeUpdater(session));
        }
Beispiel #4
0
        public DebugAssetNodeCollectionViewModel(SessionViewModel session)
            : base(session.SafeArgument(nameof(session)).ServiceProvider)
        {
            this.session = session;

            RefreshQuantumNodesCommand = new AnonymousCommand(ServiceProvider, RefreshQuantumViewModel);
            //SelectNodeCommand = new AnonymousCommand<Guid>(ServiceProvider, SelectNodeByGuid);
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ThumbnailsViewModel"/> class.
 /// </summary>
 /// <param name="session">The session associated to this view model.</param>
 public ThumbnailsViewModel(SessionViewModel session)
     : base(session.SafeArgument(nameof(session)).ServiceProvider)
 {
     this.session = session;
     session.ActiveAssetView.FilteredContent.CollectionChanged += VisibleAssetsChanged;
     session.AssetPropertiesChanged    += AssetPropertiesChanged;
     ServiceProvider.ServiceRegistered += ServiceRegistered;
 }
Beispiel #6
0
        public PreviewViewModel(SessionViewModel session)
            : base(session.SafeArgument(nameof(session)).ServiceProvider)
        {
            this.session = session;
            session.ActiveAssetView.SelectedAssets.CollectionChanged += SelectedAssetsCollectionChanged;
            session.ActiveAssetsChanged += ActiveAssetsChanged;

            RenderPreviewCommand = new AnonymousCommand <bool>(session.ServiceProvider, SetIsVisible);
        }
Beispiel #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReferencesViewModel"/> class.
        /// </summary>
        /// <param name="session">The session view model.</param>
        /// <param name="assetCollection">The asset collection view model of assets for which we want to gather references.</param>
        public ReferencesViewModel(SessionViewModel session, AssetCollectionViewModel assetCollection)
            : base(session.SafeArgument(nameof(session)).ServiceProvider)
        {
            this.assetCollection = assetCollection;
            DisplayedReferences  = new AssetCollectionViewModel(session.ServiceProvider, session, AssetCollectionViewModel.AllFilterCategories);

            session.ActiveAssetView.SelectedAssets.CollectionChanged += (sender, e) => RefreshReferences();
            session.AssetPropertiesChanged += (sender, e) => Dispatcher.InvokeAsync(RefreshReferences);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ActionHistoryViewModel"/> class.
 /// </summary>
 /// <param name="session">The session this view model belongs to.</param>
 public ActionHistoryViewModel(SessionViewModel session)
     : base(session.SafeArgument(nameof(session)).ServiceProvider)
 {
     this.session = session;
     service      = ServiceProvider.Get <IUndoRedoService>();
     Transactions.CollectionChanged += (sender, e) => RefreshUndoRedoStatus();
     UndoCommand = new AnonymousCommand(ServiceProvider, () => { service.Undo(); session.CheckConsistency(); RefreshUndoRedoStatus(); });
     RedoCommand = new AnonymousCommand(ServiceProvider, () => { service.Redo(); session.CheckConsistency(); RefreshUndoRedoStatus(); });
     RefreshUndoRedoStatus();
 }
 protected AssetPreviewViewModel(SessionViewModel session)
     : base(session.SafeArgument(nameof(session)).ServiceProvider)
 {
     this.Session = session;
 }
 protected SessionObjectViewModel([NotNull] SessionViewModel session)
     : base(session.SafeArgument(nameof(session)).ServiceProvider)
 {
     Session = session;
 }