private void AddNavigationSetViewModelToPanel(INavigationSet navigationSet)
        {
            var navSetViewModel = new NavigationSetViewModel();

            navSetViewModel.NavigationSet = navigationSet;
            navSetViewModel.ToolTip       = navigationSet.ToolTip;
            Items.Add(navSetViewModel);
        }
示例#2
0
        //private INavigationPanelViewModel _NavigationPanel;
        //[Import]
        //public INavigationPanelViewModel NavigationPanel
        //{
        //  get { return _NavigationPanel; }
        //  set
        //  {
        //    if (value != _NavigationPanel)
        //    {
        //      _NavigationPanel = value;
        //      NotifyOfPropertyChange(() => NavigationPanel);
        //    }
        //  }
        //}

        #endregion

        #region Methods

        public void RegisterPage(IPage page)
        {
            //CHECK FOR NULL PAGE
            if (page == null)
            {
                throw new ArgumentNullException("page");
            }

            //GET UNIQUE PAGE ID TEXT (NAVSET + NAVTEXT)
            string uniquePageIdText = GetUniqueIdText(page);

            //CHECK TO MAKE SURE WE DON'T ALREADY HAVE THIS UNIQUE PAGE ID TEXT
            if (Pages.ContainsKey(uniquePageIdText))
            {
                throw new Exceptions.NavigationTextAlreadyExistsException(uniquePageIdText);
            }

            //ADD THE PAGE TO OUR COLLECTION
            Pages.Add(uniquePageIdText, page);

            ////REGISTER PAGE WITH EVENT AGGREGATOR. IF HAS VIEWMODEL, REGISTER THAT TOO

            Services.EventAggregator.Subscribe(page);

            ////if (page.ContentViewModel != null)
            ////  Services.EventAggregator.Subscribe(page.ContentViewModel);

            //GET THE NAVSET
            INavigationSet navSet = null;

            if (NavigationSets.ContainsKey(page.NavSet))
            {
                //NAVSET ALREADY EXISTS
                navSet = NavigationSets[page.NavSet];
            }
            else
            {
                //DOESN'T EXIST, SO CREATE A NEW NAVSET AND REGISTER IT
                NavigationSet newSet = new NavigationSet();
                newSet.Text = page.NavSet;
                NavigationSets.Add(newSet.Text, newSet);
                navSet = newSet;
            }

            //ASSOCIATE THE PAGE TO THE NAVSET
            navSet.RegisterPage(page);

            //REFRESH THE NAVIGATION PANEL
            RefreshNavigationPanel();
        }
 public NavigationSetButtonViewModel(INavigationSet navigationSet)
 {
   NavigationSet = navigationSet;
   _IsExpanded = false;
 }
 public NavigationSetButtonViewModel(INavigationSet navigationSet)
 {
     NavigationSet = navigationSet;
     _IsExpanded   = false;
 }