private void checkCompanyItemGrid_RightTapped(object sender, RightTappedRoutedEventArgs e) { CheckCompanyListItem ccli = (sender as Grid).DataContext as CheckCompanyListItem; scciForClipboard = new SearchedCompanyClipboardItem(ccli.RegNo, ccli.Name, ccli.Date, ccli.Result, ""); menuFlyout.ShowAt(checkCompanyList, e.GetPosition(checkCompanyList)); }
private void loadCheckCompanyList(string contents) { JsonObject jContents = JsonObject.Parse(contents); JsonArray jaCompanies = jContents.GetNamedArray("result"); ObservableCollection <CheckCompanyListItem> tempListItems = new ObservableCollection <CheckCompanyListItem>(); string id, regNo, name, date, result, recColor; for (int i = 0; i < jaCompanies.Count; i++) { JsonObject jo = jaCompanies[i].GetObject(); id = jo.GetNamedString("ID"); regNo = jo.GetNamedString("REGNO"); name = jo.GetNamedString("ENTNAME"); date = jo.GetNamedString("CHECKDATE"); result = jo.GetNamedString("CHECKRESULT"); if (result.Contains("正常")) { recColor = "Green"; } else { recColor = "#E51400"; } CheckCompanyListItem ccili = new CheckCompanyListItem(id, regNo, name, date, result, recColor); tempListItems.Add(ccili); } //ObservableCollection<CheckCompanyListItem> tempItems = new ObservableCollection<CheckCompanyListItem>(checkCompanyListItems.OrderByDescending(item => item.Date)); //checkCompanyListItems.Clear(); foreach (var item in new ObservableCollection <CheckCompanyListItem>(tempListItems.OrderByDescending(item => item.Date))) { checkCompanyListItems.Add(item); } }