Exemple #1
0
        public CommandBarViewModel(ITheaterApplicationHost appHost, INavigator navigator)
        {
            _navigator = navigator;
            _commands = appHost.GetExports<IGlobalMenuCommand>().ToList();
            CommandViewModels = new ObservableCollection<GlobalCommandViewModel>();

            _navigator.Navigated += (s, e) => UpdateCommandVisibility();
        }
Exemple #2
0
        public SideMenuViewModel(ITheaterApplicationHost appHost, ISessionManager sessionManager, IImageManager imageManager, IApiClient apiClient)
        {
            _sessionManager = sessionManager;
            Users = new SideMenuUsersViewModel(sessionManager, imageManager, apiClient);
            CommandGroups = new RangeObservableCollection<SideMenuGroupViewModel>();
            UserCommandGroups = new RangeObservableCollection<SideMenuGroupViewModel>();

            IEnumerable<IMenuCommand> commands = appHost.GetExports<IMenuCommand>().ToList();
            
            IEnumerable<IGrouping<MenuCommandGroup, IMenuCommand>> commandGroups = commands.Where(c => c.Group != MenuCommandGroup.User).Where(c => !(c is IGlobalMenuCommand)).GroupBy(c => c.Group);
            CommandGroups.AddRange(commandGroups.OrderBy(g => g.Key.SortOrder).Select(g => new SideMenuGroupViewModel(g)));

            IEnumerable<IGrouping<MenuCommandGroup, IMenuCommand>> userCommandGroups = commands.Where(c => c.Group == MenuCommandGroup.User).Where(c => !(c is IGlobalMenuCommand)).GroupBy(c => c.Group);
            UserCommandGroups.AddRange(userCommandGroups.OrderBy(g => g.Key.SortOrder).Select(g => new SideMenuGroupViewModel(g)));

            sessionManager.UserLoggedIn += UserChanged;
            sessionManager.UserLoggedOut += UserChanged;
        }
Exemple #3
0
 public HomeViewModel(ITheaterApplicationHost appHost)
 {
     var pageGenerators = appHost.GetExports<IHomePageGenerator>();
     Pages = pageGenerators.SelectMany(p => p.GetHomePages()).ToList();
 }