/// <summary>
        /// Attempt to create a HelixWatch3DViewModel. If one cannot be created,
        /// fall back to creating a DefaultWatch3DViewModel and log the exception.
        /// </summary>
        /// <param name="model">The NodeModel to associate with the returned view model.</param>
        /// <param name="parameters">A Watch3DViewModelStartupParams object.</param>
        /// <param name="logger">A logger to be used to log the exception.</param>
        /// <returns></returns>
        public static DefaultWatch3DViewModel TryCreateHelixWatch3DViewModel(NodeModel model, Watch3DViewModelStartupParams parameters, DynamoLogger logger)
        {
            try
            {
                var vm = new HelixWatch3DViewModel(model, parameters);
                return(vm);
            }
            catch (Exception ex)
            {
                logger.Log(Resources.BackgroundPreviewCreationFailureMessage, LogLevel.Console);
                logger.Log(ex.Message, LogLevel.File);

                var vm = new DefaultWatch3DViewModel(model, parameters)
                {
                    Active         = false,
                    CanBeActivated = false
                };
                return(vm);
            }
        }
示例#2
0
 /// <summary>
 /// Sets up the provided <see cref="DefaultWatch3DViewModel"/> object and 
 /// adds it to the Watch3DViewModels collection.
 /// </summary>
 /// <param name="watch3DViewModel"></param>
 /// <param name="factory"></param>
 protected void RegisterWatch3DViewModel(DefaultWatch3DViewModel watch3DViewModel, IRenderPackageFactory factory)
 {
     watch3DViewModel.Setup(this, factory);
     watch3DViewModels.Add(watch3DViewModel);
     RaisePropertyChanged("Watch3DViewModels");
 }
示例#3
0
 /// <summary>
 /// Sets up the provided <see cref="DefaultWatch3DViewModel"/> object and 
 /// adds it to the Watch3DViewModels collection.
 /// </summary>
 /// <param name="watch3DViewModel"></param>
 /// <param name="factory"></param>
 protected void RegisterWatch3DViewModel(DefaultWatch3DViewModel watch3DViewModel, IRenderPackageFactory factory)
 {
     watch3DViewModel.Setup(this, factory);
     watch3DViewModels.Add(watch3DViewModel);
     watch3DViewModel.Active = PreferenceSettings
         .GetIsBackgroundPreviewActive(watch3DViewModel.PreferenceWatchName);
     RaisePropertyChanged("Watch3DViewModels");
 }