private void Awake() { leanShake = GetComponent <LeanShake>(); searchedItem = GetComponent <SearchedItem>(); addButton.OnClick.AddListener(() => leanShake.Shake(10f)); addButton.OnClick.AddListener(AddSearchedItem); }
public IActionResult Search() { var searchedItem = new SearchedItem() { }; return(View("Show", searchedItem)); }
public SearchViewModel() { SearchHistoryList = new ObservableCollection <string>(); //InitSearchPage(); SearchCommand = new Command <string>(async(str) => { if (!Tools.IsNetConnective()) { CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long); return; } if (string.IsNullOrEmpty(str)) { CrossToastPopUp.Current.ShowToastWarning("请输入关键词", ToastLength.Short); } else { if (!SearchHistoryList.Contains(str)) { SearchedItem searchedItem = new SearchedItem { createTime = DateTime.UtcNow.ToString(), searchedString = str }; await LocalDatabaseHelper <SearchedItem> .InsertOrReplaceAsync(searchedItem); } ProductListPage productListPage = new ProductListPage(str); SearchString = ""; await Application.Current.MainPage.Navigation.PushAsync(productListPage); } }, (str) => { return(true); }); ClearCommand = new Command(async() => { bool action = await Application.Current.MainPage.DisplayAlert("确认", "删除所有搜索历史?", "确认", "取消"); if (action) { await localDatabaseService.DeleteAllSearchedItem(); InitSearchPage(); } }, () => { return(true); }); }
// // https://stackoverflow.com/questions/3120616/wpf-datagrid-selected-row-clicked-event sol #2 private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { DataGridRow row = ItemsControl.ContainerFromElement((DataGrid)sender, e.OriginalSource as DependencyObject) as DataGridRow; if (row == null) { return; } SearchedItem si = row.Item as SearchedItem; if (si == null) { return; } (new Comparison(this, si)).ShowDialog(); }
public Comparison(MainWindow mw, SearchedItem si) { InitializeComponent(); _mw = mw; Item = si; lookupLabel.Content = "Lookup: ID " + si.Id; Title = "MapleRIL - Lookup: ID " + si.Id; // source lookup sourceRegionLabel.Content = _mw.SourceRegion; sourceNameLabel.Content = si.Name; WzImageProperty sourceInfoProp = si.ItemType.GetInfoPropertyById(_mw.SourceWzs, si.Id); safeDescAndParse(sourceDescBlock, si.ItemType.GetDescription(si.SourceStringWzProperty, sourceInfoProp)); try { sourceImage.Source = wpfImage(sourceInfoProp["icon"].GetBitmap()); } catch { } // target lookup targetRegionLabel.Content = _mw.TargetRegion; WzImageProperty targetStringProp = si.ItemType.GetStringPropertyById(_mw.TargetWzs, si.Id); if (targetStringProp == null) { targetNotExist(); return; } targetNameLabel.Content = targetStringProp["name"].GetString(); WzImageProperty targetInfoProp = si.ItemType.GetInfoPropertyById(_mw.TargetWzs, si.Id); safeDescAndParse(targetDescBlock, si.ItemType.GetDescription(targetStringProp, targetInfoProp)); try { targetImage.Source = wpfImage(sourceInfoProp["icon"].GetBitmap()); } catch { } }
private void FindItem_Load(object sender, EventArgs e) { findItemListView.RowHeight = 56; findItemListView.OwnerDraw = true; imageColumn.Renderer = new CustomItemRenderer(); imageColumn.AspectGetter = delegate(object row) { SearchedItem item = (SearchedItem)row; if (item == null) { return(WoWItem.UnknownImage); } return(item.ItemImage); }; findItemListView.CellToolTipGetter = delegate(OLVColumn col, object row) { SearchedItem item = (SearchedItem)row; var wowItem = item.Item; if (wowItem == null) { return(""); } string name = (string)wowItem.Data["name"]; string desc = (string)wowItem.Data["description"]; string bonding = (string)wowItem.Data["bonding"]; string invtype = (string)wowItem.Data["inventorytype"]; string reqLevel = (string)wowItem.Data["requiredLevel"]; int itemLevel = (int)wowItem.Data["itemlevel"]; string durability = (string)wowItem.Data["maxdurability"]; string text = String.Format("Name: {0}\r\nDescription: {1}\r\nBonding: {2}\r\nInventory Type: {3}\r\nRequired Level: {4}\r\nItem Level: {5}\r\nMax Durability: {6}", name, desc == String.Empty ? "None" : desc, bonding, invtype, reqLevel, itemLevel, durability); return(text); }; }
/// <summary> /// 插入搜索历史 /// </summary> /// <param name="searchedItem"></param> /// <returns></returns> public Task <int> InsertSearchedItem(SearchedItem searchedItem) { //Database.DeleteAllAsync<SearchedItem>(); //先清空 return(LocalDatabaseHelper <SearchedItem> .InsertOrReplaceAsync(searchedItem)); }
public static List <SearchedItem> ItemSearchResponse(string url) { List <SearchedItem> searchedItems = new List <SearchedItem>(); WebRequest request = HttpWebRequest.Create(url); try { HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse(); XmlDocument doc = new XmlDocument(); StreamReader reader = new StreamReader(webResponse.GetResponseStream()); doc.LoadXml(reader.ReadToEnd()); XmlNodeList listIsValid = doc.GetElementsByTagName("IsValid"); if (listIsValid.Count > 0 && listIsValid[0].InnerXml == "True") { XmlNodeList listItems = doc.GetElementsByTagName("Item"); foreach (XmlNode nodeItem in listItems) { SearchedItem searchedItem = new SearchedItem(); foreach (XmlNode nodeChild in nodeItem.ChildNodes) { if (nodeChild.Name == "DetailPageURL") { searchedItem.DetailPageURL = nodeChild.InnerText; } else if (nodeChild.Name == "SmallImage") { foreach (XmlNode nodeURLImg in nodeChild.ChildNodes) { if (nodeURLImg.Name == "URL") { searchedItem.SmallImage = nodeURLImg.InnerText; } } } else if (nodeChild.Name == "ItemAttributes") { foreach (XmlNode nodeItemAtributes in nodeChild.ChildNodes) { if (nodeItemAtributes.Name == "Title") { searchedItem.Title = nodeItemAtributes.InnerText; } } } else if (nodeChild.Name == "OfferSummary") { foreach (XmlNode nodeOfferSummary in nodeChild.ChildNodes) { if (nodeOfferSummary.Name == "LowestNewPrice") { foreach (XmlNode nodeLowestNewPrice in nodeOfferSummary.ChildNodes) { if (nodeLowestNewPrice.Name == "CurrencyCode") { searchedItem.CurrencyCode = nodeLowestNewPrice.InnerText; } else if (nodeLowestNewPrice.Name == "FormattedPrice") { string price = nodeLowestNewPrice.InnerText.Remove(0, 1); searchedItem.NewPrice = Double.Parse(price); break; } } } else if (nodeOfferSummary.Name == "LowestUsedPrice") { foreach (XmlNode nodeLowestUsedPrice in nodeOfferSummary.ChildNodes) { if (nodeLowestUsedPrice.Name == "CurrencyCode") { searchedItem.CurrencyCode = nodeLowestUsedPrice.InnerText; } else if (nodeLowestUsedPrice.Name == "FormattedPrice") { string price = nodeLowestUsedPrice.InnerText.Remove(0, 1); searchedItem.UsedPrice = Double.Parse(price); break; } } } } } else if (nodeChild.Name == "CustomerReviews") { foreach (XmlNode nodeCustomerReview in nodeChild.ChildNodes) { if (nodeCustomerReview.Name == "IFrameURL") { searchedItem.CustomerReviewURL = nodeCustomerReview.InnerText; break; } } } } searchedItems.Add(searchedItem); } } return(searchedItems); } catch (Exception ex) { ex.ToString(); return(null); } }