Beispiel #1
0
        /// <summary>
        /// 使用在导航过程中传递的内容填充页。在从以前的会话
        /// 重新创建页时,也会提供任何已保存状态。
        /// </summary>
        /// <param name="navigationParameter">最初请求此页时传递给
        /// <see cref="Frame.Navigate(Type, Object)"/> 的参数值。
        /// </param>
        /// <param name="pageState">此页在以前会话期间保留的状态
        /// 字典。首次访问页面时为 null。</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: 将可绑定组集合分配到 this.DefaultViewModel["Groups"]
            SampleDataSource.addCommonExpress();
            SampleDataSource.LoadFile();
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Groups"] = sampleDataGroups;
        }
Beispiel #2
0
        //获取当地存储的历史查询数据
        public HistorySearchData getHistorySearch()
        {
            //获取本地存储数据
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (localSettings.Values.ContainsKey("searchHistory"))
            {
                String   searchHistory = localSettings.Values["searchHistory"].ToString();
                String[] sArray        = searchHistory.Split(new char[1] {
                    ';'
                });
                if (sArray.Length > 0)
                {
                    HistorySearchData hsdata = new HistorySearchData();
                    foreach (String item in sArray)
                    {
                        if (item.Equals("") || item == null)
                        {
                            continue;
                        }
                        String[] itemArr = item.Split(new char[1] {
                            '|'
                        });
                        if (itemArr.Length > 0)
                        {
                            HistorySearchItem hsitem = new HistorySearchItem();
                            hsitem.CompanyEn = itemArr[0];
                            JsonObject jsonObject = SampleDataSource.parseExpress();
                            var        company    = "";
                            try
                            {
                                company = jsonObject.GetNamedString(itemArr[0].ToString());
                            }
                            catch (Exception)
                            {
                                company = "";
                            }
                            hsitem.Company = company;
                            hsitem.Number  = itemArr[1];
                            hsitem.Time    = itemArr[2];
                            hsdata.HSItems.Add(hsitem);
                        }
                    }
                    return(hsdata);
                }
            }
            return(null);
        }