コード例 #1
0
        public ComponentLibraryOrganizerVM(ComponentLibraryViewModel componentLibrary)
        {
            m_componentsLibraryViewModel = componentLibrary;
            m_tagNodeCollection.Add(m_allComponents);
            BuildTagsHierarchy();

            Tags = CollectionViewSource.GetDefaultView(m_tagNodeCollection);
            Tags.SortDescriptions.Add(new SortDescription("Label", ListSortDirection.Ascending));
        }
コード例 #2
0
        public static ComponentsLibraryNode Build(ComponentLibraryViewModel viewModel)
        {
            ComponentsLibraryNode root = new ComponentsLibraryNode(String.Empty);

            // package references
            ComponentsLibraryNode packageReferencesNode = new ComponentsLibraryNode("Package References");
            root.AddChild(packageReferencesNode);

            if (viewModel.Experiment != null)
            {
                foreach (IPackageReference reference in viewModel.Experiment.References)
                {
                    ComponentsLibraryNode referenceNode = new ComponentsLibraryNode(reference.Name);
                    packageReferencesNode.AddChild(referenceNode);
                }
            }

            // components
            ComponentsLibraryNode allComponentsNode = new ComponentsLibraryNode("All Components");
            root.AddChild(allComponentsNode);
            
            foreach (MetadataDefinition component in viewModel.ComponentsCollection)
            {
                ComponentsLibraryNode componentNode = new ComponentsLibraryNode(component.Label, component);
                allComponentsNode.AddChild(componentNode);
                
                foreach (string qualifiedTag in component.Tags.Values)
                {
                    string[] tags = qualifiedTag.Split(new char[] {'.'});
                    if (tags.Length > 0)
                    {
                        ComponentsLibraryNode node = root;
                        
                        foreach (string tag in tags)
                        {
                            ComponentsLibraryNode childNode = node.GetChild(tag);
                            if (childNode == null)
                            {
                                childNode = new ComponentsLibraryNode(tag);
                                node.AddChild(childNode);
                            }
                            node = childNode;
                        }
                        node.AddChild(componentNode);
                    }
                }
            }
            return root;
        }
コード例 #3
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();
        }
        public ComponentsLibraryViewModelWrapper(ComponentLibraryViewModel componentsLibraryViewModel)
        {
            if (componentsLibraryViewModel == null)
                throw new ArgumentNullException("componentsLibraryViewModel", "Wrapped component view model cannot be null");

            m_componentsLibraryViewModel = componentsLibraryViewModel;
            m_componentsLibraryViewModel.PropertyChanged += m_componentsLibraryViewModel_PropertyChanged;
            m_componentsLibraryViewModel.Rescanned += m_componentsLibraryViewModel_Rescanned;
            m_componentsLibraryViewModel.Rescanning += new EventHandler(m_componentsLibraryViewModel_Rescanning);
            m_isRescanning = m_componentsLibraryViewModel.IsRescanning;

            Rescan = new DelegateCommand(RescanFunc, CanRescanFunc);
            OpenOrganizer = new DelegateCommand(OpenOrganizerFunc);
            m_setPropertyMethod = new Action<PropertyInfo, object>(SetProperty);

            ComponentsCollectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(VisibleNodes);
            //ComponentsCollectionView.SortDescriptions.Add(new SortDescription("Label", ListSortDirection.Ascending));

            m_searchTimer.Tick += new EventHandler(m_searchTimer_Tick);
            m_searchTimer.Interval = new TimeSpan(0, 0, 0, 0, 200);

            AddIoSpecFilter = new DelegateCommand(AddIoSpecFilterFunc);
            RemoveIoSpecFilter = new DelegateCommand(RemoveIoSpecFilterFunc);

            IoSpecFilters.CollectionChanged += IoSpecFiltersCollectionChanged;

            // Don't build the hierarchy unless the library is done scanning.
            if (m_componentsLibraryViewModel.IsRescanning == false)
            {
                BuildTagsHierarchy();
            }

            if (Experiment != null)
            {
                Experiment.References.CollectionChanged += References_CollectionChanged;
            }
        }
コード例 #5
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();
        }
コード例 #6
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;
        }