public ActionResult NavigationPartial()
        {
            var pages = this.CacheServices.Get(
                "navigationPages",
                () => this.PageServices
                .GetAll()
                .To<PageViewModel>()
                .ToList(),
                CacheTimeConstants.NavigationPages);

            var currentUserId = this.User.Identity.GetUserId();
            var notifications = this.TripNotificationServices
                .GetNotSeenForUser(currentUserId)
                .To<TripNotificationViewModel>()
                .ToList();

            var viewModel = new NavigationViewModel()
            {
                Pages = pages,
                CurrentUsername = this.User.Identity.GetUserName(),
                Notifications = notifications
            };

            return this.PartialView("~/Views/Shared/_NavigationPartial.cshtml", viewModel);
        }
Esempio n. 2
0
        public NavigationViewModelTests()
        {
            var navigationDataProvider = new Mock <INavigationDataProvider>();

            navigationDataProvider.Setup(dp => dp.GetAllFriends())
            .Returns(new List <FriendLookupItem>
            {
                new FriendLookupItem {
                    Id = 1, DisplayMember = "Paulo Costa"
                },
                new FriendLookupItem {
                    Id = 2, DisplayMember = "Leonor Costa"
                },
                new FriendLookupItem {
                    Id = 3, DisplayMember = "Odete Costa"
                },
                new FriendLookupItem {
                    Id = 4, DisplayMember = "Mário Costa"
                }
            });

            _viewModel = new NavigationViewModel(navigationDataProvider.Object);
        }
Esempio n. 3
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            try
            {
                AppUser user = User?.Identity?.Name == null ? null : await userManager.FindByNameAsync(User.Identity.Name);

                string avatar = "https://ztourist.blob.core.windows.net/others/avatar.png";
                if (user != null)
                {
                    avatar = user.Avatar;
                }
                NavigationViewModel model = new NavigationViewModel
                {
                    Avatar = avatar
                };
                return(View(model));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                throw;
            }
        }
Esempio n. 4
0
        private static void CreateOrganisationNavigation(NavigationViewModel navigation, Entity entity, UrlHelper urlHelper)
        {
            NavigationSectionViewModel organisationSection = new NavigationSectionViewModel()
            {
                Name = "Organisation"
            };

            organisationSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Profile",
                Url  = urlHelper.Action("View", "Organisation", new { newspaperID = entity.EntityID })
            });

            organisationSection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Wallet",
                Url  = urlHelper.Action("Wallet", "Organisation", new { newspaperID = entity.EntityID })
            });

            navigation.MainSections.Add(organisationSection);

            createBusinessSection(navigation, urlHelper, createCompanies: true, createOrganisations: false, createNewspapers: true);
        }
        public NavigationViewModelTest()
        {
            var eventAggregatorMock = new Mock <IEventAggregator>();

            _lookupServicesMock = new Mock <ILookupServices>();

            //Events
            _afterNavigationEvent  = new AfterNavigationEvent();
            _beforeNavigationEvent = new BeforeNavigationEvent();

            eventAggregatorMock.Setup(ea => ea.GetEvent <AfterNavigationEvent>())
            .Returns(_afterNavigationEvent);

            eventAggregatorMock.Setup(ea => ea.GetEvent <BeforeNavigationEvent>())
            .Returns(_beforeNavigationEvent);

            _lookupServicesMock.Setup(ls => ls.GetMenuItems())
            .Returns(new List <LookupItem>()
            {
                new LookupItem()
                {
                    Name = "Home", Image = "ImageURl"
                }
            });

            _lookupServicesMock.Setup(ls => ls.GetOptions())
            .Returns(new List <LookupItem>()
            {
                new LookupItem()
                {
                    Name = "Settings", Image = "ImageURl"
                }
            });

            _viewModel = new NavigationViewModel(eventAggregatorMock.Object,
                                                 _lookupServicesMock.Object);
        }
        public ActionResult RenderNavigation()
        {
            var config = configurationRepository.GetConfiguration();

            var vm = new NavigationViewModel()
            {
                Day = config.CurrentDay
            };

            var urlHelper = new UrlHelper(Request.RequestContext);

            NavigationHelper.PrepareNavigation(ref vm, urlHelper);


            if (SessionHelper.CurrentEntity.GetCurrentCountry() != null)
            {
                vm.AddMarket(SessionHelper.CurrentEntity.GetCurrentCountry(), urlHelper);
                vm.AddCountry(SessionHelper.CurrentEntity.GetCurrentCountry(), urlHelper);
            }
            else
            {
                vm.AddMarket(countryRepository.First(), urlHelper);
            }
            if (SessionHelper.CurrentEntity?.Citizen?.PlayerTypeID == (int)PlayerTypeEnum.SuperAdmin)
            {
                addAdminSection(vm, urlHelper);
            }
            vm.AddMap(urlHelper);
            addOtherSection(vm, urlHelper);
            vm.AddRankings(urlHelper);

            /* vm.AddSociety();
             * vm.AddRankings();
             * vm.AddWars();*/

            return(PartialView(vm));
        }
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var menu = new NavigationViewModel();

            menu.Navigation = new List <NavigationItem>()
            {
                new NavigationItem
                {
                    Action     = "Index",
                    Controller = "Home",
                    Text       = "Settings"
                },
                new NavigationItem
                {
                    Action     = "Auto",
                    Controller = "Home",
                    Text       = "Auto Forecast"
                },
                new NavigationItem
                {
                    Action     = "Manual",
                    Controller = "Home",
                    Text       = "Manual Forecast"
                }, new NavigationItem
                {
                    Action     = "BotForecast",
                    Controller = "Home",
                    Text       = "Forecast For Bot"
                }, new NavigationItem
                {
                    Action     = "BotPortal",
                    Controller = "Bot",
                    Text       = "Bot Portal"
                }
            };
            return(View("Navigation", menu));
        }
Esempio n. 8
0
        public ActionResult EditNavigationItem(int id)
        {
            NavigationViewModel model = new NavigationViewModel();

            var metadataTypes = _contentDefinitionService.GetUserDefinedTypes();
            var contentItem   = _contentManager.Get(id, VersionOptions.Latest);
            var pluralService = PluralizationService.CreateService(new CultureInfo("en-US"));

            model.EntityName = contentItem.As <MenuPart>().MenuText;
            model.EntityName = pluralService.Singularize(model.EntityName);
            var menuId          = contentItem.As <MenuPart>().Record.MenuId;
            var perspectiveItem = _contentManager.Get(menuId, VersionOptions.Latest);

            model.Title     = perspectiveItem.As <TitlePart>().Title;
            model.IconClass = contentItem.As <ModuleMenuItemPart>().IconClass;
            model.Entities  = metadataTypes.Select(item => new SelectListItem {
                Text     = item.Name,
                Value    = item.Name,
                Selected = item.Name == model.EntityName
            }).ToList();
            model.NavigationId  = id;
            model.PrespectiveId = menuId;
            return(View(model));
        }
        public ConnectivityIndicatorViewModel(Action <NavigationViewModel> navigate, NavigationViewModel back)
            : base(navigate, back)
        {
            RecalculateCommand  = new RelayCommand(Recalculate);
            SetAllValuesCommand = new RelayCommand(SetAllValues);

            ImportCommand      = new RelayCommand(Import);
            RiverImportCommand = new RelayCommand(RiverImport);
            DamImportCommand   = new RelayCommand(DamImport);


            ConnectivityIndicator.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName != "Reaches")
                {
                    return;
                }
                _dams = null;
                RaisePropertyChanged("");
            };

            _weightP = ConnectivityIndicator.PotadromousWeight;
            _weightD = ConnectivityIndicator.DiadromousWeight;
        }
Esempio n. 10
0
        public void GoBackTestCase()
        {
            NavigationViewModel navigationViewModel = null;

            Given("Init view-model", frame => ViewModelBase.CreateViewModel <NavigationViewModel>(frame))
            .And("Navigate NavigationPage", viewModel =>
            {
                navigationViewModel = viewModel;
                return(ViewModelBase.Navigate <NavigationPage>(viewModel));
            })
            .And("Check success Navigate method for NavigationPage", nResult => nResult.HasSuccessAndGetViewModel())
            .AndAsync("Check load NavigationPage", async viewModel => await WaitLoadPageAndCheckViewModelAsync <NavigationPage, ViewModelBase>(viewModel))
            .And("Navigate SecondPage", viewModel => viewModel.Navigate <SecondPage, SecondViewModel>())
            .And("Check success Navigate method for SecondPage", nResult => nResult.HasSuccessAndGetViewModel())
            .AndAsync("Check load SecondPage", async viewModel => await WaitLoadPageAndCheckViewModelAsync <SecondPage, SecondViewModel>(viewModel))
            .And("Check CanGoBack", viewModel =>
            {
                Assert.IsTrue(viewModel.NavigationManager.CanGoBack, "CanGoBack must be true");
                return(viewModel);
            })
            .When("Execute GoBack", viewModel => viewModel.NavigationManager.GoBack())
            .ThenAsync("Check load NavigationPage", async() => await WaitLoadPageAndCheckViewModelAsync <NavigationPage, NavigationViewModel>(navigationViewModel))
            .And("Check properties", viewModel =>
            {
                Assert.IsTrue(viewModel.IsNavigated, "IsNavigated must be true");
                Assert.IsTrue(viewModel.IsLoaded, "IsNavigated must be true");
                Assert.IsFalse(viewModel.IsLeaved, "IsNavigated must be false");
                Assert.AreEqual(5, viewModel.MethodCallLog.Count, "long call log should be 5");
                Assert.AreEqual("OnGoPageAsync", viewModel.MethodCallLog[0], "1st must be called OnGoPageAsync");
                Assert.AreEqual("OnLoadPageAsync", viewModel.MethodCallLog[1], "2st must be called OnLoadPageAsync");
                Assert.AreEqual("OnLeavePageAsync", viewModel.MethodCallLog[2], "3st must be called OnLeavePageAsync");
                Assert.AreEqual("OnGoPageAsync", viewModel.MethodCallLog[3], "1st must be called OnGoPageAsync");
                Assert.AreEqual("OnLoadPageAsync", viewModel.MethodCallLog[4], "2st must be called OnLoadPageAsync");
            })
            .Run <TestWindow>(window => window.Frame, Timeouts.Second.Ten);
        }
 public InvasiveSpeciesViewModel(Action <NavigationViewModel> navigate, NavigationViewModel back)
     : base(navigate, back)
 {
     AddSpeciesCommand    = new RelayCommand(AddSpecies);
     ImportSpeciesCommand = new RelayCommand(ImportSpecies);
 }
 public NoSelectionViewModel(NavigationViewModel navigationViewModel)
 {
     _navigationViewModel = navigationViewModel;
 }
Esempio n. 13
0
 public App()
 {
     InitializeComponent();
     Core.Initialize();
     MainPage = NavigationViewModel.GetMainPage();
 }
Esempio n. 14
0
 public StopwatchPageViewModel(CalculatorsAndStopwatchApplicationViewModel applicationViewModel)
 {
     _applicationViewModel = applicationViewModel;
     _navigationViewModel = new NavigationViewModel(_applicationViewModel);
 }
        public void NavigationViewModel_RemoveEnvironment_InvokesSelectLocalhost()
        {
            //------------Setup for test--------------------------
            var publisher = new Mock<IEventAggregator>();
            publisher.Setup(p => p.Publish(It.IsAny<SetActiveEnvironmentMessage>())).Verifiable();

            var localhost = new Mock<IEnvironmentModel>();
            localhost.Setup(e => e.ID).Returns(Guid.Empty);
            localhost.Setup(e => e.Name).Returns("localhost");
            localhost.Setup(e => e.IsLocalHost).Returns(true);
            localhost.Setup(e => e.IsConnected).Returns(true);
            localhost.Setup(e => e.CanStudioExecute).Returns(true);
            localhost.SetupGet(x => x.Connection.AppServerUri).Returns(new Uri("http://127.0.0.1/"));

            localhost.Setup(e => e.CanStudioExecute).Returns(true);

            var toBeRemoved = new Mock<IEnvironmentModel>();
            toBeRemoved.Setup(e => e.ID).Returns(Guid.NewGuid());
            toBeRemoved.Setup(e => e.Name).Returns("Other Server");
            toBeRemoved.Setup(e => e.CanStudioExecute).Returns(true);
            toBeRemoved.SetupGet(x => x.Connection.AppServerUri).Returns(new Uri("http://127.0.0.2/"));

            var envList = new List<IEnvironmentModel> { localhost.Object, toBeRemoved.Object };
            var envRepo = new Mock<IEnvironmentRepository>();
            envRepo.Setup(e => e.All()).Returns(envList);
            envRepo.Setup(e => e.Source).Returns(localhost.Object);

            var localhostExplorerItemModel = new ExplorerItemModel { EnvironmentId = Guid.Empty, DisplayName = "localhost" };

            ExplorerItemModel anotherEnvironment = new ExplorerItemModel { DisplayName = "Other Server", EnvironmentId = toBeRemoved.Object.ID };
            var studioResourceRepository = new StudioResourceRepository(localhostExplorerItemModel, _Invoke);
            studioResourceRepository.ExplorerItemModels.Add(anotherEnvironment);
            studioResourceRepository.GetExplorerProxy = guid => new Mock<IClientExplorerResourceRepository>().Object;
            var viewModel = new NavigationViewModel(publisher.Object, new TestAsyncWorker(), null, envRepo.Object, studioResourceRepository, new Mock<IConnectControlSingleton>().Object, () => { });


            foreach(var env in envList)
            {
                viewModel.AddEnvironment(env);
            }

            //------------Execute Test---------------------------
            viewModel.RemoveEnvironment(toBeRemoved.Object);

            //------------Assert Results-------------------------
            publisher.Verify(p => p.Publish(It.IsAny<SetActiveEnvironmentMessage>()));
            Assert.IsTrue(viewModel.ExplorerItemModels[0].IsExplorerSelected);
        }
Esempio n. 16
0
 public MenuViewModel(NavigationViewModel navigationViewModel)
 {
     _navigationViewModel = navigationViewModel;
     EmpCommand           = new BaseCommand(OpenEmp);
     DeptCommand          = new BaseCommand(OpenDept);
 }
Esempio n. 17
0
 public NavigationPage()
 {
     Model = new NavigationViewModel();
     NavigationCacheMode = NavigationCacheMode.Required;
     this.InitializeComponent();
 }
		public RequiredPropertiesViewModel(RelayCommand<string> navCommand)
		{
			NavigationViewModel = new NavigationViewModel(navCommand, "PackagePartSelection", "ProgresPage");
		}
 public SearchNavigationView(NavigationViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }
 public TaskListViewModel(ProjectViewModel project)
 {
     Project    = project;
     SubMenu    = new SubMenuViewModel(project.Id, SubMenuPage.TaskList);
     Navigation = new NavigationViewModel(NavigationTarget.ProjectsList);
 }
Esempio n. 21
0
 public NavigationView(NavigationViewModel model)
 {
     InitializeComponent();
     Model = model;
 }
Esempio n. 22
0
 public NavigationView()
 {
     ViewModel = new NavigationViewModel();
     InitializeComponent();
 }
Esempio n. 23
0
        public ActionResult EditNavigationItemPOST(int perspectiveId, int navigationId, NavigationViewModel model)
        {
            var    pluralService         = PluralizationService.CreateService(new CultureInfo("en-US"));
            string pluralContentTypeName = pluralService.Pluralize(model.EntityName);

            var contentItem = _contentManager.Get(navigationId, VersionOptions.DraftRequired);

            contentItem.As <MenuPart>().MenuText = pluralContentTypeName;
            //contentItem.As<MenuItemPart>().Url = "~/Coevery#/" + pluralContentTypeName;
            contentItem.As <ModuleMenuItemPart>().ContentTypeDefinitionRecord = _contentTypeDefinitionRepository.Table.FirstOrDefault(x => x.Name == model.EntityName);
            contentItem.As <ModuleMenuItemPart>().IconClass = model.IconClass;
            //contentItem.As<MenuItemPart>().FeatureId = "Coevery." + pluralContentTypeName;
            _contentManager.Publish(contentItem);

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
        public void NavigationViewModel_UpdateWorkspaces_IfConnectedThenRefresh()
        {
            //Arrange
            Mock<IEnvironmentModel> mockEnvironment = EnviromentRepositoryTest.CreateMockEnvironment();
            mockEnvironment.Setup(model => model.CanStudioExecute).Returns(true);
            mockEnvironment.Setup(model => model.ID).Returns(Guid.Empty);
            mockEnvironment.Setup(a => a.IsConnected).Returns(true);
            var environmentRepository = GetEnvironmentRepository(mockEnvironment);
            const string displayName = "localhost (https://localhost:3242/)";

            ObservableCollection<IExplorerItemModel> explorerItemModels = new ObservableCollection<IExplorerItemModel>();
            ExplorerItemModel server = new ExplorerItemModel { ResourceType = Common.Interfaces.Data.ResourceType.Server, DisplayName = displayName, IsExplorerExpanded = true, EnvironmentId = Guid.Empty };
            ExplorerItemModel folder1 = new ExplorerItemModel { ResourceType = Common.Interfaces.Data.ResourceType.Folder, DisplayName = "Folder1", ResourcePath = "Folder1", IsExplorerExpanded = true, EnvironmentId = Guid.Empty };
            ExplorerItemModel resource1 = new ExplorerItemModel { ResourceType = Common.Interfaces.Data.ResourceType.WorkflowService, DisplayName = "Resource1", ResourcePath = "Resource1", IsExplorerExpanded = false, EnvironmentId = Guid.Empty };
            ExplorerItemModel resource2 = new ExplorerItemModel { ResourceType = Common.Interfaces.Data.ResourceType.WorkflowService, DisplayName = "Resource2", ResourcePath = "Resource2", IsExplorerExpanded = false, IsExplorerSelected = true, EnvironmentId = Guid.Empty };
            ExplorerItemModel folder2 = new ExplorerItemModel { ResourceType = Common.Interfaces.Data.ResourceType.Folder, DisplayName = "Folder2", ResourcePath = "Folder2", IsExplorerExpanded = false, EnvironmentId = Guid.Empty };

            folder1.Children.Add(resource1);
            folder1.Children.Add(resource2);
            server.Children.Add(folder1);
            server.Children.Add(folder2);
            explorerItemModels.Add(server);

            var mockStudioRepo = new Mock<IStudioResourceRepository>();
            mockStudioRepo.SetupGet(p => p.ExplorerItemModels).Returns(explorerItemModels);

            var viewmodel = new NavigationViewModel(new Mock<IEventAggregator>().Object, new TestAsyncWorker(), null, environmentRepository, mockStudioRepo.Object, new Mock<IConnectControlSingleton>().Object, () => { }) { SelectedItem = resource2 };

            viewmodel.Environments.Add(mockEnvironment.Object);
            viewmodel.ExplorerItemModels = explorerItemModels;
            var connectControlSingletonMock = new Mock<IConnectControlSingleton>();
            //Act
            viewmodel.UpdateWorkspaces(connectControlSingletonMock.Object);
            //Assert
            connectControlSingletonMock.Verify(a=>a.Refresh(Guid.Empty),Times.Exactly(1));
        }
Esempio n. 25
0
        public ActionResult CreateNavigationItemPOST(int perspectiveId, int navigationId, NavigationViewModel model)
        {
            var    pluralService         = PluralizationService.CreateService(new CultureInfo("en-US"));
            string pluralContentTypeName = pluralService.Pluralize(model.EntityName);

            if (string.IsNullOrWhiteSpace(model.IconClass))
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Content(T("Icon is required.").ToString()));
            }

            //add
            var moduleMenuPart = Services.ContentManager.New <MenuPart>("ModuleMenuItem");

            // load the menu
            var menu = Services.ContentManager.Get(perspectiveId);

            moduleMenuPart.MenuText     = pluralContentTypeName;
            moduleMenuPart.MenuPosition = Position.GetNext(_navigationManager.BuildMenu(menu));
            moduleMenuPart.Menu         = menu;
            //menuPart.As<MenuItemPart>().Url = "~/Coevery#/" + pluralContentTypeName;
            moduleMenuPart.As <ModuleMenuItemPart>().ContentTypeDefinitionRecord = _contentTypeDefinitionRepository.Table.FirstOrDefault(x => x.Name == model.EntityName);
            moduleMenuPart.As <ModuleMenuItemPart>().IconClass = model.IconClass;
            //menuPart.As<MenuItemPart>().FeatureId = "Coevery." + pluralContentTypeName;
            Services.ContentManager.Create(moduleMenuPart);
            if (!moduleMenuPart.ContentItem.Has <IPublishingControlAspect>() && !moduleMenuPart.ContentItem.TypeDefinition.Settings.GetModel <ContentTypeSettings>().Draftable)
            {
                _contentManager.Publish(moduleMenuPart.ContentItem);
            }
            return(Json(new { id = moduleMenuPart.ContentItem.Id }));
        }
        //NavigationViewModel CreateViewModel(Mock<IResourceRepository> mockResourceRepository, bool isFromActivityDrop = false, enDsfActivityType activityType = enDsfActivityType.All, Mock<IConnectControlSingleton> connectControlASingleton = null)
        //{
        //    var importServiceContext = new ImportServiceContext();
        //    ImportService.CurrentContext = importServiceContext;

        //    ImportService.Initialize(new List<ComposablePartCatalog>());

        //    return CreateViewModel(EnvironmentRepository.Instance, mockResourceRepository, isFromActivityDrop, activityType, connectControlASingleton);
        //}

        NavigationViewModel CreateViewModel(IEnvironmentRepository environmentRepository, Mock<IResourceRepository> mockResourceRepository, bool isFromActivityDrop = false, enDsfActivityType activityType = enDsfActivityType.All, Mock<IConnectControlSingleton> connectControlASingleton = null, bool mockClone = true)
        {
            var studioResourceRepository = BuildExplorerItems(mockResourceRepository.Object,mockClone);
            connectControlASingleton = connectControlASingleton ?? new Mock<IConnectControlSingleton>();
            var navigationViewModel = new NavigationViewModel(new Mock<IEventAggregator>().Object, new TestAsyncWorker(), null, environmentRepository, studioResourceRepository, connectControlASingleton.Object, () => { }, isFromActivityDrop, activityType);
            return navigationViewModel;
        }
Esempio n. 27
0
 public ConnectCommand(NavigationViewModel navigationViewModel)
 {
     _navigationViewModel = navigationViewModel;
 }
Esempio n. 28
0
        public override async Task ActivateAsync()
        {
            await base.ActivateAsync();

            NavigationViewModel.SetGroup(WorkingCopy.Parent);
        }
Esempio n. 29
0
 public ApplicationFormViewModel(ProjectViewModel project)
 {
     Project    = project;
     SubMenu    = new SubMenuViewModel(project.Id, SubMenuPage.ApplicationForm);
     Navigation = new NavigationViewModel(NavigationTarget.ProjectsList);
 }
Esempio n. 30
0
 public IActionResult Language(NavigationViewModel viewModel)
 {
     HttpContext.Session.SetString(SystemConstants.AppSettings.DefaultLanguageId, viewModel.CurrentLanguageId);
     return(Redirect(viewModel.ReturnUrl));
 }
Esempio n. 31
0
 public NavigationView(NavigationViewModel model)
 {
     InitializeComponent();
     Model = model;
 }
Esempio n. 32
0
 public CoreViewModel(Action <NavigationViewModel> navigate, NavigationViewModel back)
     : base(navigate, back)
 {
 }
        public IHttpActionResult Frontend()
        {
            NavigationViewModel viewmodel    = new NavigationViewModel();
            EventDataController dataCtrl     = new EventDataController();
            SeatDataController  seatDataCtrl = new SeatDataController();
            PartnerDisplayRelationDataController displayDataCtrl = new PartnerDisplayRelationDataController();
            var events    = dataCtrl.GetItems().ToList();
            var nextEvent = events.OrderByDescending(x => x.Start).First();

            if (events.OrderByDescending(x => x.Start).FirstOrDefault(x => x.End > DateTime.Now) != null)
            {
                nextEvent = events.OrderByDescending(x => x.Start).FirstOrDefault(x => x.End > DateTime.Now);
            }
            var partner = displayDataCtrl.GetItems()
                          .Where(x => x.Partner.IsActive)
                          .OrderByDescending(x => x.Partner.PartnerPackID)
                          .ThenBy(x => x.Partner.Position);

            #region NavigationTop
            viewmodel.Data.NavigationTop.Add(new NavItem()
            {
                Text         = "News",
                State        = "news.all",
                StateCompare = "news"
            });
            viewmodel.Data.NavigationTop.Add(new NavItem()
            {
                Text         = "Events",
                State        = "event.all",
                StateCompare = "event"
            });
            viewmodel.Data.NavigationTop.Add(new NavItem()
            {
                Text         = "Galerie",
                State        = "gallery.all",
                StateCompare = "gallery"
            });
            viewmodel.Data.NavigationTop.Add(new NavItem()
            {
                Text         = "Turniere",
                State        = "event.tournaments.all({id: " + nextEvent.ID + "})",
                StateCompare = "event.tournaments"
            });
            viewmodel.Data.NavigationTop.Add(new NavItem()
            {
                Text         = "Sitzplan",
                State        = "event.seating({id: " + nextEvent.ID + "})",
                StateCompare = "event.seating"
            });
            viewmodel.Data.NavigationTop.Add(new NavItem()
            {
                Text         = "Sponsoren",
                State        = "partner",
                StateCompare = "partner"
            });
            #endregion
            #region NavigationUser
            if (UserHelper.Authenticated)
            {
                if (UserHelper.CurrentUserRole == UserRole.Admin || UserHelper.CurrentUserRole == UserRole.Team)
                {
                    viewmodel.Data.NavigationUser.Add(new NavItem()
                    {
                        Text         = "<i class='fas fa-user-secret'></i>",
                        State        = "admin.dashboard",
                        StateCompare = "admin.dashboard",
                        Tooltip      = "Adminbereich"
                    });
                }
                viewmodel.Data.NavigationUser.Add(new NavItem()
                {
                    Text         = "<i class='fas fa-utensils'></i>",
                    State        = "catering",
                    StateCompare = "catering",
                    Tooltip      = "Catering"
                });
                //viewmodel.Data.NavigationUser.Add(new NavItem()
                //{
                //    Text = "<i class='fas fa-comments'></i>",
                //    State = "profile.overview",
                //    StateCompare = "profile",
                //    Tooltip = "Chat"
                //});
                viewmodel.Data.NavigationUser.Add(new NavItem()
                {
                    Text         = "<i class='fas fa-user-circle'></i>",
                    State        = "profile.overview",
                    StateCompare = "profile",
                    Tooltip      = UserHelper.CurrentUserName
                });
                viewmodel.Data.NavigationUser.Add(new NavItem()
                {
                    Text         = "<i class='fas fa-sign-out'></>",
                    State        = "logout",
                    StateCompare = "logout",
                    Tooltip      = "Ausloggen"
                });
            }
            else
            {
                viewmodel.Data.NavigationUser.Add(new NavItem()
                {
                    Text         = "<i class='fas fa-user-plus'></i>",
                    State        = "register",
                    StateCompare = "register",
                    Tooltip      = "Registrieren"
                });
                viewmodel.Data.NavigationUser.Add(new NavItem()
                {
                    Text         = "<i class='fas fa-sign-in'></i>",
                    State        = "login",
                    StateCompare = "login",
                    Tooltip      = "Einloggen"
                });
            }
            #endregion
            #region NavigationAside
            viewmodel.Data.NavigationAside.Add(new NavItem()
            {
                Text  = "Informationen",
                State = "event.details({id: " + nextEvent.ID + "})"
            });
            viewmodel.Data.NavigationAside.Add(new NavItem()
            {
                Text  = "Sitzplan",
                State = "event.seating({id: " + nextEvent.ID + "})"
            });
            viewmodel.Data.NavigationAside.Add(new NavItem()
            {
                Text  = "Jugendschutz",
                State = "jugendschutz"
            });
            viewmodel.Data.NavigationAside.Add(new NavItem()
            {
                Text  = "Teilnahmebedingungen",
                State = "teilnahmebedingungen"
            });
            viewmodel.Data.NavigationAside.Add(new NavItem()
            {
                Text  = "Kontakt",
                State = "contact"
            });
            #endregion
            #region EventsAside
            foreach (var e in events.Where(x => x.End > DateTime.Now).OrderByDescending(x => x.Start))
            {
                var   seats      = seatDataCtrl.GetItems().Where(x => x.EventID == e.ID);
                Int32 seatsCount = Properties.Settings.Default.SeatAmount - seats.Count(x => x.State == -1);
                Int32 flagged    = seats.Count(x => x.State == 1);
                Int32 reserved   = seats.Count(x => x.State >= 2);
                Int32 free       = seatsCount - flagged - reserved;
                viewmodel.Data.EventsAside.Add(new EventItem()
                {
                    ID           = e.ID,
                    Title        = $"{e.EventType.Name} Vol.{e.Volume}",
                    Start        = e.Start,
                    End          = e.End,
                    PublicAccess = !e.IsPrivate,
                    Seating      = new data.ViewModel.Event.EventViewModelItem.SeatingReservation()
                    {
                        SeatsCount = seatsCount,
                        Flagged    = flagged,
                        Reserved   = reserved,
                        Free       = free
                    }
                });
            }
            #endregion
            #region PartnerTop
            foreach (var p in partner.Where(x => x.PartnerDisplay.Name == "Header"))
            {
                viewmodel.Data.PartnerTop.Add(new PartnerItem()
                {
                    Name          = p.Partner.Name,
                    Link          = p.Partner.Link,
                    ImagePassive  = Properties.Settings.Default.imageAbsolutePath + p.Partner.ImagePassive,
                    ImageOriginal = Properties.Settings.Default.imageAbsolutePath + p.Partner.ImageOriginal
                });
            }
            #endregion
            #region NavigationBottom
            foreach (var p in partner.Where(x => x.PartnerDisplay.Name == "Footer"))
            {
                viewmodel.Data.NavigationBottom.Add(new LinkItem()
                {
                    Text = p.Partner.Name,
                    Link = p.Partner.Link
                });
            }
            #endregion

            return(Ok(viewmodel));
        }
 public ApplicationViewModel(IWindowViewModel window, NavigationViewModel router)
 {
     Window              = window;
     Router              = router;
     Router.OnNavigated += Router_OnNavigated;
 }
Esempio n. 35
0
 public CustomAdapter(Context context, IMvxAndroidBindingContext bindingContext, NavigationViewModel navModel)
     : base(context, bindingContext)
 {
     _navModel = navModel;
     _context  = context;
 }
Esempio n. 36
0
 public MainViewModel(ITeamsService teamsService) : base(teamsService)
 {
     TeamsAreaViewModel  = new TeamsAreaViewModel(TeamsService);
     NavigationViewModel = new NavigationViewModel(TeamsService);
 }
Esempio n. 37
0
 private void RemoveEnvironment(IEnvironmentModel environment)
 {
     NavigationViewModel.RemoveEnvironment(environment);
     SaveEnvironment(environment);
 }
Esempio n. 38
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new NavigationViewModel();
 }
		public ProgresPageViewModel(RelayCommand<string> navCommand)
		{
			NavigationViewModel = new NavigationViewModel(navCommand, "RequiredProperties", "");
		}