Example #1
0
 protected override SceneElement CreateElement(SceneViewModel viewModel, ISceneInsertionPoint insertionPoint, string url)
 {
     try
     {
         ITypeId      targetType   = (ITypeId)viewModel.ProjectContext.ResolveType(PlatformTypes.Image);
         ImageElement imageElement = (ImageElement)viewModel.CreateSceneNode(targetType);
         imageElement.Uri = url;
         if (viewModel.DesignerContext.ProjectManager.OptionsModel.NameInteractiveElementsByDefault)
         {
             new SceneNodeIDHelper(viewModel, insertionPoint.SceneNode ?? viewModel.ViewRoot).SetValidName((SceneNode)imageElement, url);
         }
         imageElement.SetValueAsWpf(ImageElement.StretchProperty, (object)Stretch.Fill);
         return((SceneElement)imageElement);
     }
     catch (WebException ex)
     {
         this.DesignerContext.MessageDisplayService.ShowError(new ErrorArgs()
         {
             Message   = StringTable.ImageDocumentTypeImageInsertFailureMessage,
             Exception = (Exception)ex
         });
         return((SceneElement)null);
     }
 }