public MainViewModel(TableViewModel tableViewModel, EntryViewModel entryViewModel, TopBarViewModel topBarViewModel) { TopBarViewModel = topBarViewModel; TableViewModel = tableViewModel; TopBarViewModel.PropertyChanged += OnTopBarPropertyChanged; EntryViewModel = entryViewModel; }
private async Task RefreshObjectContainerTask(bool force) { await Client.RefreshObjectContainer(force); ResourcesViewModel.Synchronize(ObjectContainer.Instance.CurrentSelectedPlanet); TopBarViewModel.UpdatePlayerPlanets(ObjectContainer.Instance.PlayerPlanets); CheckHostileMissions(); }
public IViewComponentResult Invoke() { var model = new TopBarViewModel(); model.SubscibedSubs.AddRange(_subDao.GetSubsByIds(_contextService.GetSubscribedSubIds()).Select(x => x.Name).OrderBy(x => x)); model.DefaultSubs.AddRange(_subDao.GetSubsByIds(_subDao.GetDefaultSubs()).Select(x => x.Name)); return(View(model)); }
//TODO DarthAffe 06.01.2016: This is a somehow weird design ... protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.DispatcherUnhandledException += OnDispatcherUnhandledException; _apiService = new HikariApiService(); _configService = new ConfigService(); _patchService = new PatchService(_apiService, UpdateStatusFunc); _topBarViewModel = new TopBarViewModel(_configService); _gamesViewModel = new GamesViewModel(_configService, _patchService); _mainWindowViewModel = new MainWindowViewModel(_apiService, _topBarViewModel, _gamesViewModel); new MainWindow { DataContext = _mainWindowViewModel }.Show(); }
public MainWindowViewModel(OGameHttpClient client) : base(client) { ResourcesViewModel = new ResourcesViewModel(client); TopBarViewModel = new TopBarViewModel(ResourcesViewModel); GalaxyViewModel = new GalaxyViewModel(client); Observable.Interval(TimeSpan.FromMinutes(5)) .SubscribeOnDispatcher() .DelayTask(() => TimeSpan.FromMinutes(Random.Next(10, 20))) .Select(i => SafeHttpTask(() => RefreshObjectContainerTask(false))) .Subscribe(); Observable.Interval(TimeSpan.FromMinutes(1)) .SubscribeOnDispatcher() .Where(i => WorkerQueueActionRunner.ExecutionQueue.Any()) .Subscribe(token => { WorkerQueueActionRunner.CheckQueue(); }); Init(); }
public ActionResult TopBar() { var model = new TopBarViewModel(); model.SubscibedSubs.AddRange(_subDao.GetSubsByIds(_contextService.GetSubscribedSubIds()).Select(x => x.Name)); return PartialView(model); }
public async Task <IViewComponentResult> InvokeAsync() { var language = RouteData?.Values["language"]?.ToString(); var regionValue = RouteData?.Values["regionValue"] as RegionValue; var region = regionValue?.Region; var(regionPagesUrl, _, regionTitle, regions) = await _cmsApiProxy.GetRegionList(region, language); var baseUrl = $"/{language}"; var model = new TopBarViewModel { Regions = regions.Select(n => new TopBarViewModel.RegionViewModel { Id = n.Id, Name = n.Title?.Rendered, UrlPath = GetRegionUrlPath(language, n.Url_path) }).ToList(), Region = regionTitle, LanguageCode = language, BasePartialUrl = baseUrl }; var pages = await _cmsApiProxy.GetPages(language, regionPagesUrl); var urlList = new List <string>(); var partialUrl = string.Empty; if (!string.IsNullOrEmpty(language)) { urlList.Add(language); } if (!string.IsNullOrEmpty(region)) { urlList.Add(region); } if (urlList.Any()) { partialUrl = string.Join("/", urlList); } model.RegionUrl = $"/{partialUrl}"; // Get only top menu pages model.Pages = pages .Where(p => p.Page_type?.First().TypeName == CmsVariable.TopMenuPageTypeName) .Select(n => new TopBarViewModel.PageViewModel { Id = n.Id, PageName = n.Title?.Rendered, UrlPath = !string.IsNullOrEmpty(partialUrl) ? $"{partialUrl}/{n.Slug}" : n.Slug }).ToList(); model.RootUrl = $"{Request.Scheme}://{Request.Host}"; model.Translations = await _cmsApiProxy.GetTranslationsByPrefix(language, "topbar."); return(View(model)); }
public IViewComponentResult Invoke() { var model = new TopBarViewModel(); return View(model); }