async public void ShowPinDetailInfo(string id) { await Navigation.PopToRootAsync(); tmpSpaceData detailInfo = null; foreach (var item in AppData.Spaces.tmpSpaceCollection) { if (item.ID == id) { detailInfo = item; break; } } if (detailInfo == null) { return; } var detailInfoPage = new DetailPage() { BindingContext = new DetailInfoViewModel(detailInfo) }; await Application.Current.MainPage.Navigation.PushModalAsync(new NavigationPage(detailInfoPage)); }
public MainPageViewModel() { AllNotes = new ObservableCollection <string>(); SelectedNoteChangedCommand = new Command(async() => { var detailVM = new DetailPageViewModel(SelectedNote); var detailPage = new DetailPage(); detailPage.BindingContext = detailVM; await Application.Current.MainPage.Navigation.PushAsync(detailPage); }); EraseCommand = new Command(() => TheNote = string.Empty); SaveCommand = new Command(() => { if (!string.IsNullOrEmpty(TheNote)) { AllNotes.Add(TheNote); TheNote = string.Empty; } }); }
private void OnDetailPageParseDone(DetailPage detailPage) { if (DetailPageParseDone != null) { DetailPageParseDone(detailPage); } }
public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath) { var page = new DetailPage(monkeys [indexPath.Row].ImageFile); var vc = page.CreateViewController(); NavigationController.PushViewController(vc, true); }
public void OnTapped(Object o) { var nextPage = new DetailPage(); nextPage.BindingContext = o; Navigation.PushAsync(nextPage); }
/// <summary> /// 一个详细页处理完成 /// </summary> /// <param name="detailPage"></param> void SnifferThread_DetailPageParseDone(DetailPage detailPage) { if (Data.Tables.Count == 0) { //如果没有表,则先创建表结构 Data.Tables.Add(detailPage.DetailPageConfiguration.CreateDataTable()); } DataTable table = Data.Tables[0]; DataRow row = table.NewRow(); bool hasData = false; foreach (DataColumn col in table.Columns) { if (col.ColumnName != "ID" && !string.IsNullOrEmpty(row[col].ToString())) { hasData = true; break; } } hasData = true; if (hasData) { AddValueToRow(row, detailPage); table.Rows.Add(row); } //改变完成记录的显示 this.SnifferForm.SetCountStep(this.ThreadIndex); }
public static void WebView_NewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs args) { Type t = null; object parameter = null; string url = args.Uri.ToString(); if (DetailPage.isSupport(url)) { t = typeof(DetailPage); parameter = DetailPage.getItemId(url); } if (t != null) { args.Handled = true; if (parameter == null) { MainPage.currenMainPage.NvInvoked(t); } else { MainPage.currenMainPage.NvInvoked(t, parameter); } } }
public void Show(TableBase table) { DetailPage detailPage = new DetailPage(); detailPage.MyInit(_db, table, this); SetPage(detailPage); }
public MainPageViewModel() { List <Note> notesList = App.Database.GetNotesAsync().Result; foreach (var note in notesList) { notes.Add(note); } EraseCommand = new Command(() => { Note = string.Empty; }); SaveCommand = new Command(async() => { Note note = new Note() { Text = Note, Date = DateTime.Now }; Notes.Add(note); await App.Database.SaveNoteAsync(note); Note = string.Empty; }); SelectionChangedCommand = new Command(async() => { var detailVM = new DetailPageViewModel(SelectedNote); var detailView = new DetailPage(); detailView.BindingContext = detailVM; await Application.Current.MainPage.Navigation.PushAsync(detailView); }); }
private void Execute(PageBase page) { //标记为采集中 page.SnifferState = SnifferState.Working; //Console.WriteLine("开始处理\t" + page.Config.Url); if (page.IsListPage) { ListPage listPage = page as ListPage; ExecuteListPage(listPage); } else { #region 详细页处理逻辑 DetailPage detailPage = page as DetailPage; //详细页处理 ExcuteDetailPage(detailPage); #endregion } OnPageDoneEventHandler?.Invoke(page, Context); if (page.Config.Plug != null) { page.Config.Plug.OnPageDoneEventHandler(page, Context); } }
public void HomeController_DetailAction_ReturnSpecificPark() { DetailPage detailPage = new DetailPage(driver); string result = detailPage.Url; Assert.AreEqual("/Home/Detail", result); }
public ActionResult Index(int id) { Restaurant restaurant = context.Restaurants .Include(r => r.User) .Include(r => r.Place) .Include(r => r.Meals) .Include("Meals.CategoryMeal") .Include("Meals.Reviews") .FirstOrDefault(r => r.Id == id); if (restaurant == null) { return(HttpNotFound()); } List <string> categoryName = new List <string>(); List <CategoryMeal> catMeal = new List <CategoryMeal>(); foreach (var meal in restaurant.Meals) { if (!categoryName.Contains(meal.Name)) { categoryName.Add(meal.Name); catMeal.Add(meal.CategoryMeal); } } DetailPage detailPage = new DetailPage { Restaurant = restaurant, categoryMeal = catMeal }; return(View(detailPage)); }
static void Main(string[] args) { Console.WriteLine("商铺采集小程序,管理员QQ 592955699!"); var shopConfig = ShopConfig.LoadConfig(); Console.WriteLine($"商铺账号:{shopConfig.Account}"); Console.WriteLine($"文件地址:{shopConfig.SavePath}"); //注册编码(放在将要指定编码,进行文件解析前) Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); SnifferContext snifferContext = new SnifferContext(); PageConfigManager pageConfigManager = new PageConfigManager(); String path = AppContext.BaseDirectory + "PageConfigs\\ShopConfig.xml"; var configs = pageConfigManager.LoadConfig(path); foreach (var item in configs) { Console.WriteLine($"商铺地址:{item.Url}"); if (item.PageType == PageType.DetailPage) { DetailPage rootDetailPage = new DetailPage(null, item); snifferContext.AddToWaitPages(rootDetailPage); } else { ListPage rootListPage = new ListPage(null, item); snifferContext.AddToWaitPages(rootListPage); Console.WriteLine($"采集页数:{rootListPage.ListPageConfig.MaxPage}"); } } SnifferManager sniffer = new SnifferManager(snifferContext); sniffer.OnPageDoneEventHandler = (page, context) => { Console.WriteLine($"OnPageDoneEventHandler\t\t{page.Url}"); Console.WriteLine($"待处理页面 {context.GetWaitPageCount()} 个"); }; sniffer.OnRootPageDoneEventHandler = (page, context) => { Console.WriteLine($"OnRootPageDoneEventHandler\t{page.Url}"); }; sniffer.OnListUrlPageDoneEventHandler = (page, context) => { Console.WriteLine($"OnListUrlPageDoneEventHandler\t{page.Url}"); }; sniffer.OnListPageDoneEventHandler = (page, context) => { Console.WriteLine($"OnListPageDoneEventHandler\t{page.Url}"); }; //详细页采集完毕,组合生成url待下载 sniffer.OnDetailPageDoneEventHandler = (page, context) => { //Console.WriteLine($"OnDetailPageDoneEventHandler\t{page.Url}"); }; sniffer.Execute(); }
async Task ItemClick(Pokemon poke) { var detailPage = new DetailPage(poke); await Navigation.PushAsync(detailPage); //var pokePage = new PokemonList(type); //await Navigation.PushAsync(pokePage); }
public static void ShowDetail(IEnumerable<object> collection, object item) { var page = new DetailPage(); if (_sampleData == null) _sampleData = new SampleDataSource(page.BaseUri); page.Items = collection; page.Item = item; Window.Current.Content = page; }
public void TestCase() { Console.WriteLine("1. tekan tombol login google"); HomePage home = new HomePage(driver); home.click(); var parentWindow = driver.CurrentWindowHandle; var googletab = driver.WindowHandles; foreach (var next_tab in googletab) { if (next_tab != parentWindow) { Console.WriteLine("2. Isi email dan password"); driver.SwitchTo().Window(next_tab); WebDriverWait wait2 = new WebDriverWait(driver, TimeSpan.FromSeconds(30000)); wait2.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("input[name='identifier'][type='email']"))).SendKeys("*****@*****.**"); var next = driver.FindElement(By.Id("identifierNext")); next.Click(); var pass = new WebDriverWait(driver, TimeSpan.FromSeconds(30000)).Until(ExpectedConditions.ElementToBeClickable((By.CssSelector("input[name='password'][type='password']")))); pass.SendKeys("7471063kartika"); next = driver.FindElement(By.Id("passwordNext")); next.Click(); } } driver.SwitchTo().Window(parentWindow); home = new HomePage(driver); var username = home.username(); Assert.That(username, Is.Not.Empty, "user berhasil login"); Console.WriteLine("3. Klik satu berita trending"); home.FirstTendingClick(); DetailPage detail = new DetailPage(driver); var title = detail.titleNews(); Assert.That(title, Is.Not.Empty, "halaman detail berita berhasil terbuka"); Console.WriteLine("4. Isi kolum komentar "); Console.WriteLine("5. Cek Tombol posting "); detail.clickcomment(); detail.Writecomment("tested"); var isBtnEnable = detail.IsbtnCommentEnable(); Assert.That(isBtnEnable, Is.True, "Tombol posting enabled "); Console.WriteLine("6. Kosongkan kolum komentar "); Console.WriteLine("7. Cek tombol posting "); detail = new DetailPage(driver); detail.clickcomment(); detail.Deletecomment(); isBtnEnable = detail.IsbtnCommentEnable(); Assert.That(isBtnEnable, Is.False, "Tombol posting disabled "); }
public ActionResult Detail(string parkCode) { Session["parkCode"] = parkCode; string code = Session["parkCode"].ToString(); DetailPage model = GetDetailPage(code.ToString()); return(View("Detail", model)); }
public void FindHighTempOnWeather() { IndexPage page = new IndexPage(driver); page.Navigate(); DetailPage detPage = page.NavigateToDetail(); WeatherPage wetPage = detPage.NavigateToWeather(); Assert.AreEqual("62", wetPage.HighTemp.Text); }
public DetailPage GetDetailPage(string parkCode) { var model = new DetailPage(); model.NatPark = _dal.GetPark(parkCode); model.Weather = _dal.GetForecast(parkCode); model.Weather.InCelcius = TempInC(); return(model); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); var img = string.Empty; if (NavigationContext.QueryString.TryGetValue("img", out img)) { Content = new DetailPage(img).ConvertPageToUIElement(this); } }
public void SurveyConfirmation_Redirect() { SurveyConfirmationPage surveyPage = new SurveyConfirmationPage(driver); surveyPage.Navigate(); DetailPage tacoSalad = surveyPage.SurveyRedirect(); string result = tacoSalad.Url; Assert.AreEqual("/Home/Detail", result); }
/// <summary> /// 采集详细页 /// </summary> /// <param name="listPage"></param> public void ParseDetailPage(ListPage listPage) { ListPage backListPage = null; bool isNotPage = false; int pageIndex = this.SnifferForm.GetStartPageIndex(listPage); pageIndex = pageIndex + (listPage.ListPageConfiguration.PageIndexSeed - 1); int snifferPageCount = SnifferForm.GetSnifferPageCount(listPage); int donePageCount = 0; while (!isNotPage) { listPage.Sniffer(); //如果不成功,或者大于要采集的页数,则表示没有数据了,完成了分类 if (!listPage.Succeed || donePageCount == snifferPageCount || (backListPage != null && backListPage.PageBody == listPage.PageBody)) { break; } OnPageIndexChange(listPage.PageUrl); foreach (UrlItem urlItem in listPage.SubPageUrlResults) { DetailPageConfiguration detailPageConf = (DetailPageConfiguration)listPage.ListPageConfiguration.SubPageConfiguration; DetailPage detailPage = new DetailPage(listPage, detailPageConf); detailPage.PageIndex = detailPageConf.PageStartIndex; detailPage.PageName = urlItem.Title; detailPage.PageUrl = urlItem.Url; detailPage.Sniffer(); OnDetailPageParseDone(detailPage); } pageIndex = pageIndex + listPage.ListPageConfiguration.PageIndexStep; donePageCount++; ListPage newListPage = new ListPage(listPage.Parent, listPage.ListPageConfiguration); newListPage.PageName = listPage.PageName; newListPage.PageUrl = listPage.PageUrl; if (listPage.ListPageConfiguration.PageMethod == PageMethod.Get) { ReplacePageIndex(newListPage, pageIndex); } else { newListPage.PageQuery = string.Format(newListPage.PageQuery, pageIndex); } backListPage = listPage; listPage = newListPage; } }
void AddValueToRow(DataRow row, DetailPage page) { foreach (string key in page.ResultItems.Keys) { row[key] = page.ResultItems[key]; } //foreach (DetailPage p in page.SubPages) //{ // AddValueToRow(row, p); //} }
async void OnItemTapped(object sender, ItemTappedEventArgs e) { tmpSpaceData detailInfo = (tmpSpaceData)e.Item; var detailInfoPage = new DetailPage() { BindingContext = new DetailInfoViewModel(detailInfo) { Navigation = this.Navigation } }; await Navigation.PushModalAsync(detailInfoPage, true); }
public void SeeifTheTempChangedToCelcius() { IndexPage page = new IndexPage(driver); page.Navigate(); DetailPage detPage = page.NavigateToDetail(); WeatherPage wetPage = detPage.NavigateToWeather(); Assert.AreEqual("62", wetPage.HighTemp.Text); WeatherPage newwetPage = wetPage.ClickCelcius(); Assert.AreEqual("17", newwetPage.HighTemp.Text); }
private void DisplayFood() { if (selectedFood != null) { var viewModel = new DetailViewModel { SelectedFood = selectedFood, Foods = foods, Position = foods.IndexOf(selectedFood) }; var detailPage = new DetailPage { BindingContext = viewModel }; var navigation = Application.Current.MainPage.Navigation; _ = navigation.PushAsync(detailPage, true); } }
public App() { InitializeComponent(); // MainPage = new NavigationPage(new RegionPage()); // MainPage = new NavigationPage(new DashboardPage()); //DashboardPage dashboardPage = new DashboardPage(); //NavigationPage.SetHasNavigationBar(dashboardPage, false); // Navigation.PushAsync(dashboardPage); //MainPage = new TestingPage(); // MainPage =new MasterTabbedPage(); // MainPage = new NavigationPage(new DetailPage()); MainPage = new DetailPage(); }
public void OnDetailPageDoneEventHandler(DetailPage page, SnifferContext snifferContext) { String filePath = Path.Combine(ShopConfig.SavePath, fileName); String key, value; page.Data.TryGetValue("店铺Id", out key); page.Data.TryGetValue("产品Id", out value); String url = String.Format("https://seller.17zwd.com/site/goods/img/download?goods_id={0}&shop_id={1}\r\n", value, key); AppendFile(filePath, url); //保存后,清除数据,减少内存开销 page.Data.Clear(); page.Body = ""; }
async void GoToDetailPage() { var detailPage = new DetailPage(); Brush bgColor = GetColorFromShipRarity(SelectedShip.Rarity); detailPage.Title = SelectedShip.Name; detailPage.BarBackground = bgColor; await Application.Current.MainPage.Navigation.PushAsync(detailPage, true); (detailPage.BindingContext as DetailPageVM).Ship = SelectedShip; (detailPage.BindingContext as DetailPageVM).ColorBrush = bgColor; (detailPage.BindingContext as DetailPageVM).RaisePropertyChanged("Ship"); (detailPage.BindingContext as DetailPageVM).RaisePropertyChanged("ColorBrush"); SelectedShip = null; RaisePropertyChanged("SelectedShip"); }
public void Selenium_TemperatureCoversion_Radiobutton_RedirectDetailView() { DetailPage entryPage = new DetailPage(driver); entryPage.Navigate(); DetailPage testdetailPage = entryPage.TempConversion(DetailPage.TempTypes.C); string result = entryPage.C.Text; Assert.AreEqual("C", result); testdetailPage = entryPage.TempConversion(DetailPage.TempTypes.F); result = entryPage.F.Text; Assert.AreEqual("F", result); }
/// <summary> /// 详细页采集 /// </summary> /// <param name="detailPage"></param> private void ExcuteDetailPage(DetailPage detailPage) { try { foreach (FieldItem fieldItem in detailPage.DetailPageConfig.FieldItems) { String value = fieldItem.SnifferItem.Regex <String>(detailPage.Body, fieldItem.DefaultValue); //是否是父详细页的子页 if (detailPage.ParentPage is DetailPage && ((DetailPage)detailPage.ParentPage).DetailPageConfig.IsList) { #region 当前页是父详细页的子页,则将此内容加入到详细页上去 var parentPsage = ((DetailPage)detailPage.ParentPage); String parentValue = ""; if (parentPsage.Data.TryGetValue(fieldItem.Name, out parentValue)) { parentValue += value; parentPsage.Data.Add(fieldItem.Name, parentValue); } else { parentPsage.Data.Add(fieldItem.Name, value); } #endregion } else { detailPage.Data.Add(fieldItem.Name, value); } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { //标注为已完成 Context.AddToComplatePages(detailPage); //触发页面采集事件 detailPage.PageDone(this); } }
/// <summary> /// Konstruktor der MainMenuPage, welcher eine Instanz der Seite erstellt. /// </summary> /// <param name="user"></param> public MainMenuPage(User user) { DataAccessHandler accessHandler = new DataAccessHandler(); string serverAdress = accessHandler.ServerAdress; files = new localFileSystem(); String userPath = files.AdjustPath(user.user_Email); files.CreateInitalFolders(userPath); //Toolbar ToolbarItem toolButton = new ToolbarItem { Name = "Hinzufügen", Order = ToolbarItemOrder.Primary, Icon = null, Command = new Command(() => Navigation.PushAsync(new AddProduktPage())) }; this.ToolbarItems.Add(toolButton); //? //InitLogout(); //Ende Toolbar //View ProductCollection = new Collection<Product>(); ProductCollection = files.LoadProductList(); List<PContent> PcontentCollection = files.loadContentList(userPath); ScrollView scrollView = new ScrollView(); StackLayout stackLayout = new StackLayout(); foreach (Product product in ProductCollection) { TapGestureRecognizer gesture = new TapGestureRecognizer(); bool owned = files.HasContent(product, PcontentCollection); Color color = Color.FromHex("E2001A"); DetailPage detailPage = new DetailPage(product, userPath); var test = (DependencyService.Get<ISaveAndLoad>().PathCombine(DependencyService.Get<ISaveAndLoad>().Getpath(localFileSystem.productFolderLocation), product.product_ID + product.product_Thumbnail)); if (owned == true) color = Color.FromHex("006AB3"); Frame frame = new Frame { BackgroundColor = color, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Content = new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.StartAndExpand, Children = { new Image { Source = ImageSource.FromFile(DependencyService.Get<ISaveAndLoad>().PathCombine(DependencyService.Get<ISaveAndLoad>().Getpath(localFileSystem.productFolderLocation), product.product_Thumbnail)), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, HeightRequest = 110 }, new Label { FormattedText = product.product_Name, TextColor = Color.Black, VerticalOptions = LayoutOptions.Center, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), HorizontalOptions = LayoutOptions.Center }, }//ende stacklayout (innen) }//ende stacklayout };//frame ende stackLayout.Children.Add(frame); gesture.Tapped += async (sender, e) => { await Navigation.PushAsync(detailPage); }; frame.GestureRecognizers.Add(gesture); } scrollView.Content = stackLayout; Content = scrollView; BackgroundColor = Color.White; Padding = new Thickness(5, Device.OnPlatform(0, 15, 0), 5, 5); //View Ende }