Exemple #1
0
        /// <summary>
        /// Sets view model.
        /// </summary>
        /// <param name="viewModel">VM.</param>
        public virtual void SetViewModel(Tum.FamilyTreeDSL.ViewModel.FamilyTreeDSLMainViewModel viewModel)
        {
            try
            {
                this.ViewModel   = viewModel;
                this.DataContext = viewModel;

                viewModel.Ribbon = this.Ribbon;
                viewModel.RestoreLayout();
            }
            catch (System.Exception ex)
            {
                System.Windows.MessageBox.Show("Error during initialization: " + ex.Message);
            }

            // Register known windows
            DslEditorServices::IUIVisualizerService popupVisualizer = ViewModel.GlobalServiceProvider.Resolve <DslEditorServices::IUIVisualizerService>();

            popupVisualizer.TryRegister("SelectElementPopup", typeof(DslEditorPopups::SelectElementPopup));
            popupVisualizer.TryRegister("DeleteElementsPopup", typeof(DslEditorPopups::DeleteElementsPopup));
            popupVisualizer.TryRegister("SelectElementWithRSTypePopup", typeof(DslEditorPopups::SelectElementWithRSTypePopup));
            popupVisualizer.TryRegister("SelectRSTypePopup", typeof(DslEditorPopups::SelectRSTypePopup));

            /*
             * try
             * {
             * // load plugins
             * LoadPlugins();
             * }
             * catch (System.Exception ex)
             * {
             * System.Windows.MessageBox.Show("Error during plugin loading: " + ex.Message);
             * }*/
        }
		/// <summary>
        /// Sets view model.
        /// </summary>
        /// <param name="viewModel">VM.</param>
		public virtual void SetViewModel(Tum.FamilyTreeDSL.ViewModel.FamilyTreeDSLMainViewModel viewModel)
		{
			try
            {           
				this.ViewModel = viewModel;
                this.DataContext = viewModel;

            	viewModel.Ribbon = this.Ribbon;
				viewModel.RestoreLayout();
			}
			catch (System.Exception ex)
            {
				System.Windows.MessageBox.Show("Error during initialization: " + ex.Message);
			}
			
			// Register known windows
			DslEditorServices::IUIVisualizerService popupVisualizer = ViewModel.GlobalServiceProvider.Resolve<DslEditorServices::IUIVisualizerService>();				
			popupVisualizer.TryRegister("SelectElementPopup", typeof(DslEditorPopups::SelectElementPopup));
			popupVisualizer.TryRegister("DeleteElementsPopup", typeof(DslEditorPopups::DeleteElementsPopup));				
			popupVisualizer.TryRegister("SelectElementWithRSTypePopup", typeof(DslEditorPopups::SelectElementWithRSTypePopup));
			popupVisualizer.TryRegister("SelectRSTypePopup", typeof(DslEditorPopups::SelectRSTypePopup));
				
			/*
            try
            {
                // load plugins
                LoadPlugins();
            }
            catch (System.Exception ex)
            {
                System.Windows.MessageBox.Show("Error during plugin loading: " + ex.Message);
            }*/
		}
		/// <summary>
        /// Creates and assings the main view model.
        /// </summary>
        protected override void CreateAndAssignMainViewModel()
		{				
			FamilyTreeDSLViewModelStore vStore;
			if( this.WelcomeViewModel != null )
				vStore = new FamilyTreeDSLViewModelStore((FamilyTreeDSLDocumentData)DocData, WelcomeViewModel.Options);
			else
				vStore = new FamilyTreeDSLViewModelStore((FamilyTreeDSLDocumentData)DocData);
			
	        MainViewModel = new FamilyTreeDSLMainViewModel(vStore);
		}