public AppViewModel() { ViewModelBase loginViewModel = ViewsFactory.CreateView("GameWindowView"); loginViewModel.OnViewChange += LoginViewModel_OnViewChange; CurrentView = loginViewModel; }
private void App_OnViewChange(object sender, PropertyChangedEventArgs e) { ViewModelBase viewModel = ViewsFactory.CreateView(e.PropertyName); viewModel.OnViewChange += LoginViewModel_OnViewChange; CurrentView = viewModel; }
public App() { InitializeComponent(); var mainView = ViewsFactory.CreateBindedView <MainView, MainViewModel>(); Debug.WriteLine("MainPage is of type = " + mainView); MainPage = new NavigationPage(mainView); }
public async Task NavigateToAsync <View, ViewModel>() where View : Page where ViewModel : BaseViewModel { View page = ViewsFactory.CreateBindedView <View, ViewModel>(); await GetMainPage().PushAsync(page); }
public async Task NavigateToAsync <View, ViewModel>(ViewModel viewModel) where View : Page where ViewModel : BaseViewModel { View page = ViewsFactory.CreateView <View>(); page.BindingContext = viewModel; await GetMainPage().PushAsync(page); }
private async void EventsListView_ItemTapped(object sender, Telerik.XamarinForms.DataControls.ListView.ItemTapEventArgs e) { var tappedEvent = EventsListView.SelectedItem; if (tappedEvent != null) { var eventsViewModel = BindingContext as EventsViewModel; if (eventsViewModel != null) { await ViewsFactory.CreateViewFromEvent(tappedEvent, eventsViewModel, Navigation); } } }
public void Run() { Mediator mediator = InstantiateMediator(); Console.WriteLine("Facade works"); Thread.Sleep(1000); Console.ReadKey(); IPlayerRepository playerRepoProxy = new PlayerRepoProxy(new PlayerRepository()); _controller = new HomeController(ViewsFactory.Create("HomeController"), this, playerRepoProxy, mediator); _showProfilesCommand = new ShowPlayerProfilesCommand((IHomeController)_controller); _showProfilesCommand.Execute(); while (true) { Render(); HandleInput(); Thread.Sleep(16); } }
/// <summary> /// Method that setup all collection of the database with POCO /// </summary> public void init() { // entities logAdministrative = new LogAdministrativeFactory(db); logService = new LogServiceFactory(db); state = new StateFactory(db); municipality = new MunicipalityFactory(db); weatherStation = new WeatherStationFactory(db); crop = new CropFactory(db); cultivar = new CultivarFactory(db); soil = new SoilFactory(db); historicalClimatic = new HistoricalClimaticFactory(db); historicalYield = new HistoricalYieldFactory(db); climatology = new ClimatologyFactory(db); forecast = new ForecastFactory(db); forecastClimate = new ForecastClimateFactory(db); forecastYield = new ForecastYieldFactory(db); forecastScenario = new ForecastScenarioFactory(db); user = new UserFactory(db); role = new RoleFactory(db); source = new SourceFactory(db); // views views = new ViewsFactory(db); }
public void Execute(System.Xml.XmlNode node) { ViewsFactory.SaveQueue(); }
protected void Button29_Click(object sender, EventArgs e) { BaseViews views = ViewsFactory.GetViews(typeof(HHOnline.News.ArticleViews)); views.AddViewCount(4); }
private void BindData() { string articleIDStr = Request.QueryString["id"]; if (!string.IsNullOrEmpty(articleIDStr)) { int articleID; if (int.TryParse(HHOnline.Framework.GlobalSettings.Decrypt(articleIDStr), out articleID)) { // 增加点击率 //ArticleManager.IncreaseHitTimes(articleID); BaseViews views = ViewsFactory.GetViews(typeof(ArticleViews)); views.AddViewCount(articleID); Article article = ArticleManager.GetArticle(articleID); if (article != null) { lblAbstract.InnerHtml = article.Abstract; lblAuthor.Text = string.IsNullOrEmpty(article.Author) ? "匿名" : article.Author; lblDate.Text = article.Date.HasValue ? article.Date.Value.ToString() : DateTime.Now.ToString(); lblHitTimes.Text = article.HitTimes.ToString(); lblTitle.Text = article.Title; lblSubTitle.Text = article.SubTitle; lblKeywords.Text = string.IsNullOrEmpty(article.Keywords) ? "无" : article.Keywords; // 获取所有产品 ProductQuery pq = new ProductQuery(); pq.HasPublished = true; List <Product> products = Products.GetProductList(pq); List <ReplaceKeyValue> rkvs = new List <ReplaceKeyValue>(); foreach (Product item in products) { ReplaceKeyValue rkv = new ReplaceKeyValue(); rkv.Key = item.ProductName; rkv.Value = "<a style='color: blue; text-decoration:underline;' href=\"view.aspx?product-product&ID=" + HHOnline.Framework.GlobalSettings.Encrypt(item.ProductID.ToString()) + "\">" + item.ProductName + "</a>"; rkvs.Add(rkv); } FastReplace fr = new FastReplace(rkvs.ToArray()); lblContent.InnerHtml = fr.ReplaceAll(article.Content); // 查找分类 ArticleCategory ac = ArticleManager.GetArticleCategory(article.Category); if (ac != null) { btnCategory.Text = ac.Name; btnCategory.OnClientClick = "window.location.href='view.aspx?news-newslist&cate=" + HHOnline.Framework.GlobalSettings.Encrypt(ac.ID.ToString()) + "';return false;"; } if (!string.IsNullOrEmpty(article.CopyFrom)) { lblCopyForm.Text = "文章来源: " + article.CopyFrom; lblCopyForm.Visible = true; } else { lblCopyForm.Visible = false; } // 获取附件 ArticleAttachment attachment = ArticleAttachments.GetAttachment(article.Image); if (attachment != null) { if (attachment.IsRemote) { imgAttachment.ImageUrl = attachment.FileName; } else { imgAttachment.ImageUrl = attachment.GetDefaultImageUrl(100, 100); } imgAttachment.Visible = true; } else { imgAttachment.Visible = false; } this.ShortTitle = article.Title; } else { imgAttachment.Visible = false; } } this.SetTitle(); } }
public IController ChangeController(string command, IBoardStrategy strategy = null) { return(command.Equals(Contracts.Contracts.GameController) ? new GameController(ViewsFactory.Create(command), WindowFacade, strategy) : this); }