예제 #1
0
        //清除历史查询记录
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (localSettings.Values.ContainsKey("searchHistory"))
            {
                localSettings.Values["searchHistory"] = "";
            }
            FeedDataSource dataSource = new FeedDataSource();

            dataSource.GetHSData();
            searchHistory.ItemsSource = dataSource.getHSItem();
        }
예제 #2
0
        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。Parameter
        /// 属性通常用于配置页。</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Object obj = e.Parameter;

            if (!obj.ToString().Equals(""))
            {
                expressCompany.Text = obj.ToString();
            }
            //获取历史查询数据
            FeedDataSource dataSource = new FeedDataSource();

            dataSource.GetHSData();
            searchHistory.ItemsSource = dataSource.getHSItem();
        }
예제 #3
0
        private async void searchExpress(object sender, RoutedEventArgs e)
        {
            String com = expressCompany.Text.Trim();
            String num = orderNum.Text.Trim();

            if (com == null || com.Equals(""))
            {
                Windows.UI.Popups.MessageDialog dlg = new Windows.UI.Popups.MessageDialog("请填写快递公司");
                await dlg.ShowAsync();

                return;
            }
            if (num == null || num.Equals(""))
            {
                Windows.UI.Popups.MessageDialog dlg = new Windows.UI.Popups.MessageDialog("请填写快递单号");
                await dlg.ShowAsync();

                return;
            }
            Loading.Text = "正在加载。。。";

            //异步获取快递查询结果
            FeedDataSource dataSource = new FeedDataSource();
            await dataSource.GetFeedsAsync(com, num);

            List <FeedItem> item = dataSource.getItem();

            Loading.Text = "";
            if (item == null)
            {
                Windows.UI.Popups.MessageDialog dlg = new Windows.UI.Popups.MessageDialog("不能查询到您的快递信息");
                await dlg.ShowAsync();

                searchHistory.ItemsSource = dataSource.getHSItem();
                return;
            }
            else
            {
                listSearch.ItemsSource    = dataSource.getItem();
                searchHistory.ItemsSource = dataSource.getHSItem();
            }
        }