コード例 #1
0
        /// <summary>
        /// Sets the application model on the given pad.
        /// Pad refreshes its information according to the given application model.
        /// </summary>
        /// <param name='applicationViewModel'>
        /// Application model.
        /// </param>
        public void SetApplicationModel(ApplicationViewModel applicationViewModel) 
        {
            if(m_initialized == false || m_dockFrame.GdkWindow == null) 
            {
                //GdkWindow is for each dock frame is assigned when windowShell calls ShowAll(). See DockContainer.OnRealize method
                throw new InvalidOperationException("ExperimentCanvasPad must be first initialized and dockFrame must have assigned GdkWindow before setting application model.");
            }

            m_applicationViewModel = applicationViewModel;

            if(m_applicationViewModel.Experiment == null) 
            {
                m_experimentPad.Content = CreateWelcomePageWidget();
            } 
            else 
            {
                CreateExperimentControlToolbar();

                m_experimentCanvasWidget = new ExperimentCanvasWidget();
                m_experimentPad.Content = m_experimentCanvasWidget;
                DrawExperiment();
                m_applicationViewModel.Experiment.NodeRemoved += OnNodeRemoved;
                m_applicationViewModel.Experiment.EdgeRemoved += OnEdgeRemoved;

                //enable drop of components to canvas
                EnableDrop(m_experimentCanvasWidget);
            }
        }
コード例 #2
0
        private void SetModel(ApplicationViewModel appModel)
        {
            if (m_viewModel != null)
            {
                m_viewModel.PropertyChanged -= appModel_PropertyChanged;
                m_viewModel.Dispose();
            }

            m_viewModel = appModel;
            m_viewModel.PropertyChanged += appModel_PropertyChanged;

            SetComponentLibrary(m_viewModel);
            SetWorkspace(m_viewModel);
            SetLog(m_viewModel);
            SetSettings(m_viewModel);
            SetBenchmarkWizard(m_viewModel);

            if (m_viewModel.Experiment != null)
            {
                SetExperimentViewModel(m_viewModel.Experiment);
            }
            else
            {
                ExperimentDocumentWrapper = new object[] { new StartPageModel(this) };
            }

            NotifyPropertyChanged("");
        }
コード例 #3
0
 public ApplicationContext(ApplicationViewModel applicationViewModel)
 {
     Application = applicationViewModel;
     Actions = new ActionManager(this);
     NodeConnectionControlFactory = new NodeConnectionControlFactory(this);
     NodeControlFactory = new NodeControlFactory(this);
 }
コード例 #4
0
        public static void Run(ApplicationViewModel application)
        {
            if (ConsoleInstance != null)
            {
                throw new InvalidOperationException("Console UI is already running!");
            }

            ConsoleInstance = new ConsoleUI(application);

            ConsoleInstance.ComponentLibraryScannningWaiter.Wait();

            ConsoleInstance.DisplayExistingLogs();
            ConsoleInstance.StartListenToLogEvents();

            ConsoleInstance.Exit = false;

            while (!ConsoleInstance.Exit)
            {
                Console.Write("#> ");
                string input = Console.ReadLine();
                if (ConsoleInstance.ParseInput(input) == false)
                {
                    Console.WriteLine("Command is incorrect. Display commands using ?");
                }
            }

            //cleanup
            LogViewModel.DestroyLogTargets();
        }
コード例 #5
0
 public void SetApplicationModel(ApplicationViewModel newApplicationViewModel) 
 {
     if(MainWindow == null) 
     {
         throw new InvalidOperationException("Application Context has not initialized its Window, thus the application view model cannot be set!");
     }
     Application = newApplicationViewModel;
     MainWindow.SetApplicationViewModel(newApplicationViewModel);
 }
コード例 #6
0
        public AboutExperimentDialog (ApplicationViewModel appVM)
            : this()
        {
            m_applicationViewModel= appVM;

            tbx_experimentName.Text= m_applicationViewModel.Experiment.ExperimentInfo.Name;
            tbx_author.Text= m_applicationViewModel.Experiment.ExperimentInfo.Author;
            tbx_contributors.Text = m_applicationViewModel.Experiment.ExperimentInfo.Contributors;
            tbx_description.Buffer.Text = m_applicationViewModel.Experiment.ExperimentInfo.Description;
        }
コード例 #7
0
        /// <summary>
        /// Sets the application model on the given pad.
        /// Pad refreshes its information according to the given application model.
        /// </summary>
        /// <param name='applicationModel'>
        /// Application model.
        /// </param>
        public void SetApplicationModel(ApplicationViewModel applicationViewModel) 
        {
            if(dockFrame == null || dockFrame.GdkWindow == null) 
            {
                //GdkWindow is for each dock frame is assigned when windowShell calls ShowAll(). See DockContainer.OnRealize method
                throw new InvalidOperationException("ComponentsLibraryPad must be first initialized and dockFrame must have assigned GdkWindow before setting application model.");
            }

            widget.SetApplicationModel(applicationViewModel);
        }
コード例 #8
0
        public PackageReferencesWindow(ApplicationViewModel viewModel) : this()
        {
            if (viewModel == null)
                throw new ArgumentNullException();
            this.viewModel = viewModel;

            TreeStore treeStore = new TreeStore(typeof(PackageReferenceNode));
            FormatTreeView(treeStore);
            BuildModel(treeStore);
            treeView.Model = treeStore;
        }
コード例 #9
0
        /// <summary>
        /// Sets the application model on the given pad.
        /// Pad refreshes its information according to the given application model.
        /// </summary>
        /// <param name='applicationViewModel'>
        /// Application model.
        /// </param>
        public void SetApplicationModel(ApplicationViewModel applicationViewModel) 
        {
            if(m_initialized == false || m_dockFrame.GdkWindow == null) 
            {
                //GdkWindow is for each dock frame is assigned when windowShell calls ShowAll(). See DockContainer.OnRealize method
                throw new InvalidOperationException("OutputWindowPad must be first initialized and dockFrame must have assigned GdkWindow before setting application model.");
            }

            applicationViewModel.PropertyChanged += HandlePropertyChanged;

            SetLogViewModel(applicationViewModel.LogViewModel);
        }
コード例 #10
0
ファイル: MainWindow.cs プロジェクト: CoEST/TraceLab
        /// <summary>
        /// Sets the application view model to all UI panels and elements in current window
        /// </summary>
        /// <param name='applicationViewModel'>
        /// Application view model.
        /// </param>
        public void SetApplicationViewModel (ApplicationViewModel applicationViewModel)
        {
            // change application view model in all current pads
            foreach (IDockPad pad in ApplicationPads) {
                pad.SetApplicationModel (applicationViewModel);
            }

            //set experiment name
            if (applicationViewModel.Experiment != null) {
                m_applicationContext.Application.PropertyChanged += HandleApplicationPropertyChanged;
                this.WindowShell.Title = applicationViewModel.ExperimentName;
            }
        }
コード例 #11
0
        private ConsoleUI(ApplicationViewModel application)
        {
            Application = application;

            ComponentLibraryScannningWaiter = new System.Threading.ManualResetEventSlim();
            if (Application.ComponentLibraryViewModel.IsRescanning == false)
            {
                ComponentLibraryScannningWaiter.Set();
            }

            //attach event to the rescanned event of components library, so that console prompt is shown after rescan is done
            Application.ComponentLibraryViewModel.Rescanned += new EventHandler(ComponentLibraryViewModel_Rescanned);
        }
コード例 #12
0
        /// <summary>
        /// Opens the given applicationViewModel in the current window IF (and only if) the current window has not been used yet. 
        /// Otherwise, opens it in a new window.
        /// </summary>
        /// <param name="newApplicationViewModel">The new application view model.</param>
        public void OpenInWindow(ApplicationViewModel newApplicationViewModel)
        {
            var experiment = this.Application.Experiment;

            if (experiment == null)
            {
                OpenInCurrentWindow(newApplicationViewModel);
            }
            else
            {
                OpenNewExperimentWindow(newApplicationViewModel);
            }
        }
コード例 #13
0
ファイル: ExperimentCanvasPad.cs プロジェクト: CoEST/TraceLab
        /// <summary>
        /// Sets the application model on the given pad.
        /// Pad refreshes its information according to the given application model.
        /// </summary>
        /// <param name='applicationViewModel'>
        /// Application model.
        /// </param>
        public void SetApplicationModel (ApplicationViewModel applicationViewModel)
        {

            if (m_initialized == false || m_dockFrame.GdkWindow == null) {
                //GdkWindow is for each dock frame is assigned when windowShell calls ShowAll(). See DockContainer.OnRealize method
                throw new InvalidOperationException ("ExperimentCanvasPad must be first initialized and dockFrame must have assigned GdkWindow before setting application model.");
            }

            m_applicationViewModel = applicationViewModel;        

            if(m_applicationViewModel.Experiment == null) 
            {
                m_experimentPad.Content = new WelcomePageWidget(m_applicationContext);
            } 
            else 
            {
                
                bool isExperimentEditable = m_applicationViewModel.Experiment is IEditableExperiment;

                //we check whether the challenge is password protected and which password has been used by the user > if challenge password than make the exp not editable
                string isChallengeString = m_applicationViewModel.Experiment.ExperimentInfo.IsChallenge;
                if (!string.IsNullOrEmpty (isChallengeString) && isChallengeString.Equals ("True")) {
                    isExperimentEditable = !hasChallengePasswordBeenUsed();
                } 

                CreateExperimentControlToolbar();

                m_experimentCanvasWidget = new ExperimentCanvasWidget();
                m_experimentPad.Content = m_experimentCanvasWidget;

    
                m_experimentDrawer = new ExperimentDrawer(m_experimentCanvasWidget, m_applicationContext.NodeControlFactory,
                                                          m_applicationContext.NodeConnectionControlFactory);

                m_experimentDrawer.DrawExperiment(m_applicationViewModel.Experiment, isExperimentEditable);
                m_applicationViewModel.Experiment.NodeRemoved += OnNodeRemoved;
                m_applicationViewModel.Experiment.EdgeRemoved += OnEdgeRemoved;            

                if(isExperimentEditable) 
                {
                    //enable drop of components to canvas
                    EnableDrop();
                }

                // TLAB-184
                (m_experimentCanvasWidget.ExperimentCanvas.View as StandardDrawingView).PanTool += PanToolHandler;
                (m_experimentCanvasWidget.ExperimentCanvas.View as StandardDrawingView).PanToolButtonReleased += PanToolButtonReleasedHandler;
                /// TLAB-184
            }
        }
コード例 #14
0
        public static ApplicationViewModel CreateNewApplicationViewModel(ApplicationViewModel context, Experiment experiment)
        {
            ApplicationViewModel newApplicationViewModel = new ApplicationViewModel(context.Workspace);

            newApplicationViewModel.ComponentLibraryViewModel = context.ComponentLibraryViewModel.Clone();
            newApplicationViewModel.Settings = context.Settings.Clone();
            newApplicationViewModel.BenchmarkWizard = context.BenchmarkWizard;

            newApplicationViewModel.Experiment = experiment;
            newApplicationViewModel.WorkspaceViewModel = new WorkspaceViewModel(newApplicationViewModel.Workspace, experiment.ExperimentInfo.Id);
            newApplicationViewModel.LogViewModel = new LogViewModel(newApplicationViewModel.Experiment.ExperimentInfo.Id, context.LogViewModel);

            return newApplicationViewModel;
        }
コード例 #15
0
        public ApplicationViewModelWrapper(ApplicationViewModel appModel)
        {
            if (appModel == null)
                throw new ArgumentNullException("appModel");

            New = new TraceLab.UI.WPF.Commands.DelegateCommand(NewFunc);
            Open = new TraceLab.UI.WPF.Commands.DelegateCommand(OpenFunc, CanOpenFunc);
            Save = new TraceLab.UI.WPF.Commands.DelegateCommand(SaveFunc, CanSaveFunc);
            SaveAs = new TraceLab.UI.WPF.Commands.DelegateCommand(SaveAsFunc, CanSaveFunc);

            OpenSettings = new TraceLab.UI.WPF.Commands.DelegateCommand(OpenSettingsFunc);

            SetModel(appModel);
        }
コード例 #16
0
        public PackageReferencesWindow(ApplicationViewModel viewModel) : this()
        {
            if (viewModel == null)
                throw new ArgumentNullException("viewModel");

            if(viewModel.Experiment == null)
                throw new InvalidOperationException("Package reference window cannot be used when there is no experiment opened");

            this.m_experiment = viewModel.Experiment;

            m_treeStore = new Gtk.TreeStore(typeof(PackageReferenceNode));
            FormatTreeView();
            BuildModel();
            treeView.Model = m_treeStore;
        }
コード例 #17
0
        public AboutExperimentDialog (ApplicationViewModel appVM) : this()
        {
            m_applicationViewModel = appVM;

            tbx_experimentName.Text = m_applicationViewModel.Experiment.ExperimentInfo.Name;
            tbx_author.Text = m_applicationViewModel.Experiment.ExperimentInfo.Author;
            tbx_contributors.Text = m_applicationViewModel.Experiment.ExperimentInfo.Contributors;
            tbx_description.Buffer.Text = m_applicationViewModel.Experiment.ExperimentInfo.Description;

            string IsChallenge = m_applicationViewModel.Experiment.ExperimentInfo.IsChallenge;
        
            //check if it's challenge or not
            if (!string.IsNullOrEmpty (IsChallenge) && IsChallenge.Equals ("True")) {
                showOrHydeHiddenFields (true);
                tbx_tags.Text = m_applicationViewModel.Experiment.ExperimentInfo.Tags;
          
                //fill the metric dropdown with output variables and set the default value (if any)
                fillMetricVariable ();

                String metricValue = m_applicationViewModel.Experiment.ExperimentInfo.ExperimentResultsUnitname;
                if (!string.IsNullOrEmpty (metricValue)) {
                    setActiveComboBoxValue (metricCombobox, metricValue);
                }

                //sets the DeadLine
                if (!string.IsNullOrEmpty (m_applicationViewModel.Experiment.ExperimentInfo.Deadline)) {
                    this.deadLineTextArea.Text = m_applicationViewModel.Experiment.ExperimentInfo.Deadline;
                }

                //change label for window title and Label name
                this.label1.Text = CHALLENGE_NAME;
                this.Title = ABOUT_THE_CHALLENGE;
               
            } else {
                //change label for window title and Label name
                this.label1.Text = EXPERIMENT_NAME;
                this.Title = ABOUT_THE_EXPERIMENT;

                showOrHydeHiddenFields (false);
            }            
        }
コード例 #18
0
        public void SetApplicationModel(ApplicationViewModel applicationViewModel)
        {
            this.applicationViewModel = applicationViewModel;
            if(viewModel != null) 
            {
                //detach handlers
                viewModel.Rescanned -= ComponentsLibraryRescannedHandler;
                viewModel.Rescanning -= ComponentsLibraryRescanningHandler;
            }
            
            viewModel = applicationViewModel.ComponentLibraryViewModel;

            //attach handlers
            viewModel.Rescanned += ComponentsLibraryRescannedHandler;
            viewModel.Rescanning += ComponentsLibraryRescanningHandler;
            
            // Don't build hierarchy unless the library is done scanning
            if (viewModel.IsRescanning == false)
                ComponentsLibraryRescannedHandler(this, EventArgs.Empty);

            EnableDrag();
        }
コード例 #19
0
        public void SetApplicationModel(ApplicationViewModel applicationViewModel)
        {
            this.applicationViewModel = applicationViewModel;
            if(viewModel != null) 
            {
                //detach handlers
                viewModel.Rescanned -= ComponentsLibraryRescannedHandler;
                viewModel.Rescanning -= ComponentsLibraryRescanningHandler;

                if (viewModel.Experiment != null)
                {
                    viewModel.Experiment.References.CollectionChanged -= References_CollectionChanged;
                }
            }
            
            viewModel = applicationViewModel.ComponentLibraryViewModel;

            //attach handlers
            viewModel.Rescanned += ComponentsLibraryRescannedHandler;
            viewModel.Rescanning += ComponentsLibraryRescanningHandler;

            if (viewModel.Experiment != null)
            {
                viewModel.Experiment.References.CollectionChanged += References_CollectionChanged;
                this.packageReferencesButton.Sensitive = true;
            } 
            else 
            {
                this.packageReferencesButton.Sensitive = false;
            }
            
            // Don't build hierarchy unless the library is done scanning
            if (viewModel.IsRescanning == false)
                ComponentsLibraryRescannedHandler(this, EventArgs.Empty);

            EnableDrag();
        }
コード例 #20
0
 /// <summary>
 /// Opens the experiment in the current window.
 /// All pads refresh their information according to new application view model.
 /// </summary>
 /// <param name='newApplicationViewModel'>
 /// New application view model.
 /// </param>
 private void OpenInCurrentWindow(ApplicationViewModel newApplicationViewModel)
 {
     this.SetApplicationModel(newApplicationViewModel);
 }
コード例 #21
0
 /// <summary>
 /// Opens the new window based on the given application view model.
 /// </summary>
 /// <param name="newApplicationViewModel">The new application view model.</param>
 private static void OpenNewExperimentWindow(ApplicationViewModel newApplicationViewModel)
 {
     var wrapper = new ApplicationViewModelWrapper(newApplicationViewModel);
     System.Windows.Window window = new TraceLab.UI.WPF.Views.MainWindow(wrapper);
     window.Show();
 }
コード例 #22
0
        private void SetBenchmarkWizard(ApplicationViewModel appModel)
        {
            if (appModel == null)
                throw new ArgumentNullException("appModel");

            BenchmarkWizardViewModel = new BenchmarkWizardViewModel(appModel.BenchmarkWizard, 
                                                                    appModel.Workspace, 
                                                                    (TraceLab.Core.Components.ComponentsLibrary)appModel.ComponentLibraryViewModel);
        }
コード例 #23
0
        /// <summary>
        /// Sets the application model on the given pad.
        /// Pad refreshes its information according to the given application model.
        /// </summary>
        /// <param name='applicationModel'>
        /// Application model.
        /// </param>
        public void SetApplicationModel(ApplicationViewModel appliactionViewModel) 
        {
            if(m_initialized == false || m_dockFrame.GdkWindow == null) 
            {
                //GdkWindow is for each dock frame is assigned when windowShell calls ShowAll(). See DockContainer.OnRealize method
                throw new InvalidOperationException("ComponentsLibraryPad must be first initialized and dockFrame must have assigned GdkWindow before setting application model.");
            }

            if(m_componentsLibraryViewModel != null) 
            {
                //detach handlers
                m_componentsLibraryViewModel.Rescanned -= ComponentsLibraryRescannedHandler;
                m_componentsLibraryViewModel.Rescanning -= ComponentsLibraryRescanningHandler;
            }

            m_componentsLibraryViewModel = appliactionViewModel.ComponentLibraryViewModel;

            // Don't build hierarchy unless the library is done scanning
            if (m_componentsLibraryViewModel.IsRescanning == false)
            {
                BuildTagsHierarchy();
            }
            
            //attach handlers
            m_componentsLibraryViewModel.Rescanned += ComponentsLibraryRescannedHandler;
            m_componentsLibraryViewModel.Rescanning += ComponentsLibraryRescanningHandler;
        }
コード例 #24
0
ファイル: ExperimentCanvasPad.cs プロジェクト: CoEST/TraceLab
        // ***************************************************
        // HERZUM SPRINT 2.4 TLAB-157
        public void SetApplicationModel(ApplicationViewModel applicationViewModel,  ExperimentCanvasWidget experimentCanvasWidget, CompositeComponentGraph subExperiment) 
        {
            // HERZUM SPRINT 1.0
            // scopeNodeControlCurrent = scopeNodeControl;
            // END HERZUM SPRINT 1.0

            if(m_initialized == false || m_dockFrame.GdkWindow == null) 
            {
                //GdkWindow is for each dock frame is assigned when windowShell calls ShowAll(). See DockContainer.OnRealize method
                throw new InvalidOperationException("ExperimentCanvasPad must be first initialized and dockFrame must have assigned GdkWindow before setting application model.");
            }

            m_applicationViewModel = applicationViewModel;

            if(m_applicationViewModel.Experiment == null) 
            {
                m_experimentPad.Content = new WelcomePageWidget(m_applicationContext);
            } 
            else 
            {
                // CreateExperimentControlToolbar();


                m_subExperiment = new CompositeComponentEditableGraph(subExperiment);
                if (subExperiment.OwnerNode != null)
                    m_subExperiment.OwnerNode = subExperiment.OwnerNode;
                if (subExperiment.GraphIdPath != null)
                    m_subExperiment.GraphIdPath = subExperiment.GraphIdPath;

                m_experimentCanvasWidget = experimentCanvasWidget;


                m_experimentPad.Content = m_experimentCanvasWidget;

                // bool isExperimentEditable = m_applicationViewModel.Experiment is IEditableExperiment;


                m_experimentDrawer = new ExperimentDrawer(m_experimentCanvasWidget, 
                                                          new NodeControlFactory(m_applicationContext),
                                                          new NodeConnectionControlFactory(m_applicationContext));


                m_experimentDrawer.DrawExperiment(m_subExperiment, false);

            }
        }
コード例 #25
0
ファイル: ExperimentCanvasPad.cs プロジェクト: CoEST/TraceLab
        // HERZUM SPRINT 2.5 TLAB-157
        /*
        private bool IsInEditableExperiment(CompositeComponentGraph experiment){
            if (experiment == null || experiment.OwnerNode == null)
                return true;

            CompositeComponentGraph fatherExperiment = experiment.OwnerNode.Owner as CompositeComponentGraph ;
            if (fatherExperiment != null && fatherExperiment.OwnerNode!= null){
                CompositeComponentBaseMetadata meta = fatherExperiment.OwnerNode.Data.Metadata as CompositeComponentBaseMetadata;
                if (meta != null && meta.ComponentGraph is CompositeComponentEditableGraph)
                    return IsInEditableExperiment (meta.ComponentGraph);
                else
                    return false;
            } else
                return true;
        }
        */
        // END SPRINT 2.5 TLAB-157

        public void SetScopeApplicationModel(ScopeNodeControl scopeNodeControl, ApplicationViewModel applicationViewModel, CompositeComponentGraph subExperiment) 
        {
            // HERZUM SPRINT 1.0
            // scopeNodeControlCurrent = scopeNodeControl;
            // END HERZUM SPRINT 1.0

                if(m_initialized == false || m_dockFrame.GdkWindow == null) 
            {
                //GdkWindow is for each dock frame is assigned when windowShell calls ShowAll(). See DockContainer.OnRealize method
                throw new InvalidOperationException ("ExperimentCanvasPad must be first initialized and dockFrame must have assigned GdkWindow before setting application model.");
            }

            m_applicationViewModel = applicationViewModel;

            // HERZUM SPRINT 1.0
            // Experiment e = new Experiment ();
            // m_applicationViewModel = ApplicationViewModel.CreateNewApplicationViewModel (applicationViewModel, e);
            // m_applicationContext = new ApplicationContext (m_applicationViewModel);
            // END HERZUM SPRINT 1.0

            if(m_applicationViewModel.Experiment == null) 
            {
                m_experimentPad.Content = new WelcomePageWidget(m_applicationContext);
            } 
            else 
            {
                // CreateExperimentControlToolbar();

                // HERZUM SPRINT 1.0
                m_subExperiment = new CompositeComponentEditableGraph (subExperiment);
                // END HERZUM SPRINT 1.0

                // HERZUM SPRINT 1.0 PROGRESS
                // HERZUM SPRINT 2.4 TLAB-157
                if (subExperiment.OwnerNode != null)
                    // END HERZUM SPRINT 2.4 TLAB-157
                    m_subExperiment.OwnerNode = subExperiment.OwnerNode;
                // HERZUM SPRINT 2.4 TLAB-157
                if (subExperiment.GraphIdPath != null)
                    // END HERZUM SPRINT 2.4 TLAB-157
                    m_subExperiment.GraphIdPath = subExperiment.GraphIdPath;
                // END HERZUM SPRINT 1.0

                // HERZUM SPRINT 4.3: TLAB-238 TLAB-243
                if (m_subExperiment.ExperimentInfo != null)
                    m_subExperiment.ExperimentInfo.FilePath = m_applicationContext.Application.Experiment.ExperimentInfo.FilePath;
                // END HERZUM SPRINT 4.3: TLAB-238 TLAB-243

                // HERZUM SPRINT 1.1 LOOP
                // ScopeMetadata scopeMetadata = scopeNodeControlCurrent.ExperimentNode.Data.Metadata as ScopeMetadata;

                // HERZUM SPRINT 2.1
                // ScopeBaseMetadata scopeMetadata = scopeNodeControlCurrent.ExperimentNode.Data.Metadata as ScopeBaseMetadata;
                ScopeBaseMetadata scopeMetadata = scopeNodeControl.ExperimentNode.Data.Metadata as ScopeBaseMetadata;
                // END HERZUM SPRINT 2.1

                // END HERZUM SPRINT 1.1 LOOP

                scopeMetadata.SetSubExperiment (m_subExperiment);
                m_experimentCanvasWidget = new ExperimentCanvasWidget ();
                m_experimentPad.Content = m_experimentCanvasWidget;

                bool isExperimentEditable = m_applicationViewModel.Experiment is IEditableExperiment;
             //   isExperimentEditable = isChallengePasswordBeenUsed ();

                m_experimentDrawer = new ExperimentDrawer (m_experimentCanvasWidget, m_applicationContext.NodeControlFactory,
                                                           m_applicationContext.NodeConnectionControlFactory);

                //m_experimentDrawer.DrawExperiment(m_applicationViewModel.Experiment, isExperimentEditable);

                // HERZUM SPRINT 2.5 TLAB-157
                // isExperimentEditable = isExperimentEditable && IsInEditableExperiment (m_subExperiment);
                isExperimentEditable = checkEditable (m_subExperiment);
                // END HERZUM SPRINT 2.5 TLAB-157

                if (scopeNodeControl is ChallengeNodeControl)
                    isExperimentEditable = true;

                // HERZUM SPRINT 3.0: TLAB-172
                isExperimentEditable = isExperimentEditable && !isInCompositeCrumb();
                // END HERZUM SPRINT 3.0: TLAB-172

                m_experimentDrawer.DrawExperiment(m_subExperiment, isExperimentEditable);               

                // HERZUM SPRINT 1.0
                m_subExperiment.NodeRemoved += OnNodeRemoved;
                m_subExperiment.EdgeRemoved += OnEdgeRemoved;
                //
                //m_applicationViewModel.Experiment.NodeRemoved += OnNodeRemoved;
                //m_applicationViewModel.Experiment.EdgeRemoved += OnEdgeRemoved;
                // END HERZUM SPRINT 1.0

                if(isExperimentEditable) 
                {
                    //enable drop of components to canvas
                    EnableDrop ();
                }
            }
        }
コード例 #26
0
        private void SetComponentLibrary(ApplicationViewModel appModel)
        {
            if (appModel == null)
                throw new ArgumentNullException("appModel");
 
            ComponentLibraryViewModel = new ComponentsLibraryViewModelWrapper(appModel.ComponentLibraryViewModel);

            if (ComponentLibraryViewModel.IsRescanning == false)
            {
                LoadUserTags();
            }
        }
コード例 #27
0
        private void SetWorkspaceViewModel(ApplicationViewModel applicationViewModel) 
        {
            if(m_workspaceViewModel != null) 
            {
                //detach handlers
                ((INotifyCollectionChanged)m_workspaceViewModel.WorkspaceUnitCollection).CollectionChanged -= WorkspaceCollectionChanged;
                m_workspaceStore.Clear();
            }
            
            m_workspaceViewModel = applicationViewModel.WorkspaceViewModel;
            m_experimentId = applicationViewModel.Experiment.ExperimentInfo.Id;
            
            // Load existing tasks
            AddUnits(m_workspaceViewModel.WorkspaceUnitCollection);

            //attach listener to workspace collection
            ((INotifyCollectionChanged)m_workspaceViewModel.WorkspaceUnitCollection).CollectionChanged += WorkspaceCollectionChanged;
        }
コード例 #28
0
 /// <summary>
 /// Opens the new window based on the given application view model.
 /// </summary>
 /// <param name="newApplicationViewModel">The new application view model.</param>
 private static void OpenNewExperimentWindow(ApplicationViewModel newApplicationViewModel)
 {
     ApplicationContext app = new ApplicationContext(newApplicationViewModel);
     app.InitializeWindow();
 }
コード例 #29
0
        private void SetWorkspace(ApplicationViewModel appModel)
        {
            if (appModel == null)
                throw new ArgumentNullException("appModel");

            if (appModel.WorkspaceViewModel != null)
            {
                if (WorkspaceViewModel != null)
                {
                    WorkspaceViewModel.Dispose();
                }
                WorkspaceViewModel = new WorkspaceViewModelWrapper(appModel.WorkspaceViewModel);
            }
        }
コード例 #30
0
 /// <summary>
 /// Opens the given applicationViewModel in the current window IF (and only if) the current window has not been used yet.  Otherwise, opens it in a new window.
 /// </summary>
 /// <param name="newApplicationViewModel">The new application view model.</param>
 private void OpenInWindow(ApplicationViewModel newApplicationViewModel)
 {
     if (m_viewModel.Experiment == null || (m_viewModel.Experiment != null && m_viewModel.Experiment.IsModified == false && m_viewModel.Experiment.VertexCount == 2))
     {
         OpenInCurrentWindow(newApplicationViewModel);
     }
     else
     {
         OpenNewExperimentWindow(newApplicationViewModel);
     }
 }