private void AssembleMainWindow() { MainWindow = new MainWindow(); //Initialize all the various modules here var dataPlotView = (FrameworkElement)MainWindow.FindName("DataPlot"); var chartView = (ICustomChart)dataPlotView.FindName("theChart"); var dataPlotModel = new DataPlotModel(chartView); //var dataPlotModel = new DataPlotModel(); var dataPlotViewModel = new DataPlotViewModel(dataPlotModel, dataPlotView); dataPlotView.DataContext = dataPlotViewModel; var windowFactory = new PieFactory(); var dataSeriesFactory = new DataSeriesFactory(); FMI.DataSeriesFactory = dataSeriesFactory; Fingrid.DataSeriesFactory = dataSeriesFactory; var sidebarModel = new SidebarModel(dataPlotModel, windowFactory); var sidebarViewModel = new SidebarViewModel(sidebarModel); var sidebarView = ((FrameworkElement)MainWindow.FindName("Sidebar")); sidebarView.DataContext = sidebarViewModel; MainWindow.Show(); }
public override IRenderingModelBase GetModel() { SidebarModel model = new SidebarModel(); FillBaseProperties(model); model.Visits = _visitsRepository.Get(); model.PersonalInformation = _personalInformationRepository.Get(); model.OnsiteBehavior = _onsiteBehaviorRepository.Get(); model.Referral = _referralRepository.Get(); model.IsActive = _trackerService.IsActive; return(model); }
private void ModelReady(SidebarModel model) { DataContext = Model = model; model.Start(); Ready = true; if (_openSettings) { _openSettings = false; (Application.Current as App).OpenSettings(); } }
public ActionResult _SideBar() { SidebarModel model = new SidebarModel(); using (DefinitionService service = new DefinitionService()) { model.CategoryList = service.GetCategories(); } using (BlogService service = new BlogService()) { model.BlogList = service.GetBlogs(); } return(PartialView(model)); }
private void ModelReady(SidebarModel model) { DataContext = Model = model; model.Start(); Ready = true; BindGraphs(); if (_openSettings) { _openSettings = false; App.Current.OpenSettings(); } }
public ActionResult Enum() { ///新建模型 SidebarModel sidebarModel = new SidebarModel(); sidebarModel.MonthCategory = _categoryService.GetMonthCategory(); sidebarModel.Categorys = _categoryService.GetAllCategory(); sidebarModel.LastBlog = _articleService.GetLastBlog(); sidebarModel.LastComment = _commentService.GetLastComments(); ViewBag.SidebarModel = sidebarModel; Blog.Model.User user = _userService.GetLoginUser(); ViewBag.IsLogin = user != null; ViewBag.IsAdmin = ViewBag.IsLogin && user.Role == Blog.Domain.UserRole.Admin; return(View("_Sidebar", sidebarModel)); }
public async Task <IViewComponentResult> InvokeAsync(string controllername, string actionname) { // var user = await SessionCookieHelper.CurrentUser(HttpContextAccessor.HttpContext); var model = new SidebarModel(); model.ControllerName = controllername; model.ActionName = actionname; var data = await _SY_MenuFunctionService.GetAllActiveByUserId(HttpContextAccessor.HttpContext, user); model.Data = data.ToList(); model.CurrentView = model.Data.FirstOrDefault(n => n.ControllerName.Equals(model.ControllerName) && n.ActionName.Equals(model.ActionName)); model.Breadcrumb = await _SY_MenuFunctionService.GetBreadcrumb(model.CurrentView != null?model.CurrentView.Id : "", model.CurrentView != null?model.CurrentView.ParentId : "", ""); return(View(model)); }
public IActionResult Sidebar([FromBody] GameController.GameRefreshData data) { var uid = _signInManager.UserManager.GetUserId(User); var friends = _GameRepo.GetFriendList(uid); var games = _GameRepo.GetUserGameList(uid); FriendsPartialViewModel friendsAndGames = new FriendsPartialViewModel { UserFriends = friends, UserGames = games, ActiveGame = data.GameID }; var sidebar = new SidebarModel(); var t1 = this.RenderViewAsync <FriendsPartialViewModel>("_ActiveGamesPartial", friendsAndGames, true); var t2 = this.RenderViewAsync <IEnumerable <User> >("_OnlineFriendsPartial", friends.OnlineFriends, true); var t3 = this.RenderViewAsync <IEnumerable <User> >("_OfflineFriendsPartial", friends.OfflineFriends, true); Task.WaitAll(new Task <string>[] { t1, t2, t3 }); sidebar.ActiveGames = t1.Result; sidebar.OnlineFriends = t2.Result; sidebar.OfflineFriends = t3.Result; return(Json(sidebar)); }
public ActionResult SideBar() { var model = new SidebarModel() { Categories = cacheManager.Get(CacheConstant.ALL_CATEGORIES, () => { return(categoryService.GetActives().Select(x => new CategoryModel { Id = x.Id, Name = x.Name, PostCount = postService.GetCount(x.Id), Url = urlService.GetUrl(x.Id, Core.Enums.EntityType.Category) }).ToList()); }), RecentPosts = cacheManager.Get(CacheConstant.RECENT_POSTS, () => { return(postService.GetRecents().Select(x => new PostModel { Title = x.Title, PicturePath = x.PicturePath, ShortContent = x.ShortContent, CreateDate = x.CreateDate, CategoryName = categoryService.GetById(x.CategoryId).Name, CommentCount = 0, ViewCount = x.ViewCount, Url = urlService.GetUrl(x.Id, Core.Enums.EntityType.Post) }).ToList()); }), PopularPosts = cacheManager.Get(CacheConstant.POPULAR_POSTS, () => { return(postService.GetPopulars().Select(x => new PostModel { Title = x.Title, PicturePath = x.PicturePath, ShortContent = x.ShortContent, CreateDate = x.CreateDate, CategoryName = categoryService.GetById(x.CategoryId).Name, CommentCount = 0, ViewCount = x.ViewCount, Url = urlService.GetUrl(x.Id, Core.Enums.EntityType.Post) }).ToList()); }), Tags = tagService.GetTags(10).Select(x => new TagModel { Id = x.Id, Name = x.TagName }).ToList() }; if (settingService.GetSetting("post.comment.enabled").BoolValue&& settingService.GetSetting("post.recentcomment").BoolValue) { model.RecentComments = postService.GetRecentComments(5).Select(x => new CommentModel { FullName = x.FullName, PostName = postService.GetById(x.PostId).Title, PostUrl = urlService.GetUrl(x.PostId, Core.Enums.EntityType.Post) }).ToList(); } return(PartialView("_Sidebar", model)); }