public ControlStylingCommandBase(ISceneViewHost viewHost, SceneViewModel viewModel, IPropertyId targetProperty, bool useRootTemplateProperty)
     : base(viewModel)
 {
     this.viewHost                = viewHost;
     this.targetProperty          = viewModel.ProjectContext.ResolveProperty(targetProperty) as ReferenceStep;
     this.useRootTemplateProperty = useRootTemplateProperty;
 }
        private void UpdateExternalNodes()
        {
            ISceneViewHost sceneViewHost = (ISceneViewHost)this.multiDocumentReferenceChangeModel.ProjectContext.GetService(typeof(ISceneViewHost));

            foreach (IGrouping <IDocumentRoot, ChangedNodeInfo> grouping in Enumerable.Select <IGrouping <IDocumentRoot, ChangedNodeInfo>, IGrouping <IDocumentRoot, ChangedNodeInfo> >(Enumerable.GroupBy <ChangedNodeInfo, IDocumentRoot>((IEnumerable <ChangedNodeInfo>) this.multiDocumentReferenceChangeModel.NodesForExternalUpdate, (Func <ChangedNodeInfo, IDocumentRoot>)(changeInfo => changeInfo.Node.DocumentRoot)), (Func <IGrouping <IDocumentRoot, ChangedNodeInfo>, IGrouping <IDocumentRoot, ChangedNodeInfo> >)(documentGroup => documentGroup)))
            {
                SceneView      sceneView      = sceneViewHost.OpenView(grouping.Key, false);
                SceneViewModel sceneViewModel = sceneView != null ? sceneView.ViewModel : (SceneViewModel)null;
                using (SceneEditTransaction editTransaction = sceneViewModel.CreateEditTransaction(this.UndoDescription))
                {
                    if (sceneViewModel != null)
                    {
                        foreach (ChangedNodeInfo changedNodeInfo in (IEnumerable <ChangedNodeInfo>)grouping)
                        {
                            this.ApplyChange(changedNodeInfo);
                        }
                    }
                    if (this.documentsToClose.Contains(sceneViewModel.Document))
                    {
                        this.documentsToClose.Remove(sceneViewModel.Document);
                    }
                    editTransaction.Commit();
                }
            }
        }
        public override void EnsureEditable()
        {
            base.EnsureEditable();
            if (this.contentProvider.Document == null)
            {
                this.contentProvider.ProjectItem.OpenDocument(false);
            }
            if (this.contentProvider.View != null || this.contentProvider.Document == null)
            {
                return;
            }
            ISceneViewHost sceneViewHost = (ISceneViewHost)this.ProjectContext.GetService(typeof(ISceneViewHost));

            if (sceneViewHost == null)
            {
                return;
            }
            this.contentProvider.View = sceneViewHost.OpenView((IDocumentRoot)this.contentProvider.Document, false);
        }
Пример #4
0
            protected override void Work()
            {
                IProjectDocument projectDocument = this.model.ResourceEntryNode.ProjectContext.OpenDocument(this.documentPaths[this.documentPathIndex]);

                if (projectDocument == null)
                {
                    return;
                }
                SceneDocument sceneDocument = projectDocument.Document as SceneDocument;

                if (sceneDocument == null)
                {
                    return;
                }
                SceneViewModel sceneViewModel = (SceneViewModel)null;
                ISceneViewHost sceneViewHost  = (ISceneViewHost)sceneDocument.ProjectContext.GetService(typeof(ISceneViewHost));

                if (sceneViewHost != null)
                {
                    SceneView sceneView = sceneViewHost.OpenView(sceneDocument.DocumentRoot, false);
                    sceneViewModel = sceneView != null ? sceneView.ViewModel : (SceneViewModel)null;
                }
                if (sceneViewModel == null)
                {
                    return;
                }
                List <SceneNode> list = new List <SceneNode>();

                sceneViewModel.FindInternalResourceReferences((DocumentCompositeNode)this.model.ResourceEntryNode.DocumentNode, (ICollection <SceneNode>)list);
                if (list.Count <= 0)
                {
                    return;
                }
                using (SceneEditTransaction editTransaction = sceneDocument.CreateEditTransaction(StringTable.ReferencesFixupEditTransaction))
                {
                    foreach (SceneNode reference in list)
                    {
                        this.model.FixupIndividualReference((DocumentCompositeNode)this.model.ResourceEntryNode.DocumentNode, reference);
                    }
                    editTransaction.Commit();
                }
            }
Пример #5
0
        internal static void EditControl(SceneElement sceneElement)
        {
            if (sceneElement == null || sceneElement.DocumentNode == null)
            {
                return;
            }
            IType type = sceneElement.DocumentNode.Type;

            if (type.XamlSourcePath == null)
            {
                return;
            }
            try
            {
                IDocumentRoot  documentRoot  = sceneElement.ProjectContext.GetDocumentRoot(type.XamlSourcePath);
                ISceneViewHost sceneViewHost = sceneElement.ProjectContext as ISceneViewHost;
                if (sceneViewHost == null || documentRoot == null)
                {
                    return;
                }
                sceneViewHost.OpenView(documentRoot, true);
            }
            catch (Exception ex)
            {
                if (ex is ArgumentException || ex is IOException || (ex is InvalidOperationException || ex is UnauthorizedAccessException))
                {
                    string message = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.FileOpenFailedDialogMessage, new object[2]
                    {
                        (object)Path.GetFileName(type.XamlSourcePath),
                        (object)ex.Message
                    });
                    sceneElement.DesignerContext.MessageDisplayService.ShowError(message);
                }
                else
                {
                    throw;
                }
            }
        }
Пример #6
0
        public override IDocumentView CreateDefaultView()
        {
            SceneView recycledView = this.designerContext.ViewRootResolver.GetRecycledView(this);

            if (recycledView != null)
            {
                return((IDocumentView)recycledView);
            }
            SceneViewModel viewModel = new SceneViewModel(this.designerContext, this);
            ISceneViewHost viewHost  = (ISceneViewHost)this.ProjectContext.GetService(typeof(ISceneViewHost));
            string         str       = (string)this.ProjectContext.GetCapabilityValue(PlatformCapability.HostPlatformName);

            if (str == "SL")
            {
                return((IDocumentView) new SilverlightSceneView(viewHost, viewModel));
            }
            if (str == "WPF")
            {
                return((IDocumentView) new WPFSceneView(viewHost, viewModel));
            }
            throw new InvalidOperationException("Invalid host platform");
        }
Пример #7
0
 public EditNewStyleWithTemplateCommand(ISceneViewHost viewHost, SceneViewModel viewModel, IPropertyId targetProperty)
     : base(viewHost, viewModel, targetProperty)
 {
 }
 public ReplaceStyleTemplateCommand(ISceneViewHost viewHost, SceneViewModel viewModel, IPropertyId targetProperty, bool useRootTemplateProperty)
     : base(viewHost, viewModel, targetProperty, useRootTemplateProperty)
 {
 }
 public EditCopyOfTemplateCommand(ISceneViewHost viewHost, SceneViewModel viewModel, IPropertyId targetProperty)
     : base(viewHost, viewModel, targetProperty)
 {
 }
Пример #10
0
 public EditNewTemplateCommand(ISceneViewHost viewHost, SceneViewModel viewModel)
     : base(viewHost, viewModel, (IPropertyId)null, true)
 {
 }
Пример #11
0
 public EditTemplatesListCommand(ISceneViewHost viewHost, SceneViewModel viewModel)
     : base(viewModel)
 {
     this.viewHost = viewHost;
 }
 public EditExistingStyleTemplateCommand(ISceneViewHost viewHost, SceneViewModel viewModel, IPropertyId targetProperty)
     : this(viewHost, viewModel, targetProperty, false)
 {
 }
 public ControlStylingCommandBase(ISceneViewHost viewHost, SceneViewModel viewModel, IPropertyId targetProperty)
     : this(viewHost, viewModel, targetProperty, false)
 {
 }
 public EditExistingStyleTemplateCommand(ISceneViewHost viewHost, SceneViewModel viewModel, IPropertyId targetProperty, bool editTemplate)
     : base(viewHost, viewModel, targetProperty)
 {
     this.editTemplate = editTemplate;
 }
Пример #15
0
 public EditCopyOfStyleTemplateCommand(ISceneViewHost viewHost, SceneViewModel viewModel)
     : base(viewHost, viewModel, ControlElement.TemplateProperty)
 {
     this.useStyle = new bool?();
 }
Пример #16
0
 private WPFSceneView(ISceneViewHost viewHost, SceneViewModel viewModel, bool isRootView)
     : base(viewHost, viewModel, isRootView)
 {
 }
Пример #17
0
 public WPFSceneView(ISceneViewHost viewHost, SceneViewModel viewModel)
     : base(viewHost, viewModel, true)
 {
 }
Пример #18
0
 private SilverlightSceneView(ISceneViewHost viewHost, SceneViewModel viewModel, bool isRootView)
     : base(viewHost, viewModel, isRootView)
 {
 }
Пример #19
0
 public SilverlightSceneView(ISceneViewHost viewHost, SceneViewModel viewModel)
     : base(viewHost, viewModel, true)
 {
 }