/// <summary>
    /// OnInitialized 方法
    /// </summary>
    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        IsFullSide    = RootPage.IsFullSide;
        IsFixedHeader = RootPage.IsFixedHeader;
        IsFixedFooter = RootPage.IsFixedFooter;
        ShowFooter    = RootPage.ShowFooter;
        UseTabSet     = RootPage.UseTabSet;

        SideBarItems.ElementAt(IsFullSide ? 0 : 1).Active = true;
    }
示例#2
0
        /// <summary>
        /// The OnDrawerItemSelected
        /// </summary>
        /// <param name="e">The e<see cref="RoutedPropertyChangedEventArgs{object}"/></param>
        private void OnDrawerItemSelected(ISideBarItem selectedItem)
        {
            try
            {
                //ISideBarItem selectedItem = e.NewValue as ISideBarItem;
                SelectedSideBarItem = null;
                SelectedSideBarItem = SideBarItems.FirstOrDefault(a => a.MenuViewKey == selectedItem.MenuViewKey);

                _eventAggregator.GetEvent <PubSubEvent <ISideBarItem> >().Publish(selectedItem);

                IsLeftDrawerOpen = false;
            }
            catch (Exception ex)
            {
                Logger.LogProjectError(null, ex);
            }
        }
示例#3
0
        public MainAppViewModel(IGlobalProperties globalProperties, IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator)
        {
            try
            {
                _regionManager    = regionManager;
                _container        = container;
                _eventAggregator  = eventAggregator;
                _globalProperties = globalProperties;
                _globalProperties.Notifications.Insert(0, new Notification(NotificationType.APPLICATION, "Application Started !"));

                MainAppLoadedCommand = new DelegateCommand(
                    () =>
                {
                    _regionManager.RequestNavigate(RegionNames.ToolbarRegion, ViewKeys.NotificationsBar);
                    SelectedSideBarItem  = SideBarItems.First();
                    Mouse.OverrideCursor = null;

                    _regionManager.Regions[RegionNames.ContentRegion].NavigationService.Navigated += (o, e) =>
                    {
                        if (!SideBarItems.Select(a => a.MenuViewKey).Contains(e.Uri.OriginalString))
                        {
                            SelectedSideBarItem = null;
                        }
                        else if (SelectedSideBarItem == null || SelectedSideBarItem.MenuViewKey != e.Uri.OriginalString)
                        {
                            SelectedSideBarItem = SideBarItems.First(a => a.MenuViewKey == e.Uri.OriginalString);
                        }

                        if (e.Uri.OriginalString == "Home")
                        {
                            if (Project.GetProjectInstance != null)
                            {
                                Project.GetProjectInstance.SelectedSystemID = string.Empty;
                            }
                            UndoRedoSetup.SetInstanceNull();
                        }
                    };
                }
                    );
                DrawerItemSelectionChangedCommand = new DelegateCommand <ISideBarItem>(OnDrawerItemSelected);
            }
            catch (Exception ex)
            {
                Logger.LogProjectError(null, ex);
            }
        }
示例#4
0
        public SideBarItems GetSideBar(int latestPostCount)
        {
            var sideBar = new SideBarItems {
                Tags = new List <string>(), Categories = new List <string>(), LatestPosts = new List <PostDetails>()
            };

            if (_context.Categories.Any())
            {
                foreach (var cat in _context.Categories)
                {
                    sideBar.Categories.Add(cat.Name);
                }
            }
            if (_context.Tags.Any())
            {
                foreach (var tag in _context.Tags)
                {
                    sideBar.Tags.Add(tag.Name);
                }
            }

            if (_context.Posts.Any())
            {
                foreach (var latestPosts in _context.Posts.OrderBy(u => u.Created).Take(latestPostCount))
                {
                    sideBar.LatestPosts.Add(new PostDetails
                    {
                        PostHeader = latestPosts.Title,
                        PostID     = latestPosts.Id,
                        PostSlug   = latestPosts.UrlSlug
                    }
                                            );
                }
            }

            return(sideBar);
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        protected override void OnInitialized()
        {
            base.OnInitialized();

            SideBarItems.ElementAt(IsFullSide ? 0 : 1).Active = true;
        }