コード例 #1
0
        protected async Task RefreshResults()
        {
            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    string stream = txt_stream.SelectedItem.ToString();
                    //await DisplayAlert("CSID ", "CSID="+CSID, "OK");
                    try
                    {
                        App_activity_indicator.IsVisible = true;
                        App_activity_indicator.IsRunning = true;
                        string webaddress = MobileConfig.GetWebAddress(Application.Current.Properties["campus"].ToString()) + string.
                                            Format("DataFinder.aspx?dataFormat=courseworkresults&CSID={0}&stream={1}", MobileConfig.get_coursework_settings_id(), stream);
                        var content = await _client.GetStringAsync(webaddress);

                        //await DisplayAlert("Content", "CSID=" + MobileConfig.get_coursework_settings_id(), "OK");
                        if (content != "[]")
                        {
                            MobileConfig.save_coursework_results_sheet(content);
                            App_activity_indicator.IsRunning = false;
                            DisplayResults();
                        }
                        else
                        {
                            await DisplayAlert("Content Error! ", "No Results Found", "OK");
                        }
                        App_activity_indicator.IsVisible = false;
                        App_activity_indicator.IsRunning = false;
                        DisplayResults();
                    }
                    catch (Exception ex)
                    {
                        await DisplayAlert("General Error! ", ex.Message, "OK");

                        App_activity_indicator.IsVisible = false;
                        App_activity_indicator.IsRunning = false;
                    }
                }
                else
                {
                    await DisplayAlert("Error! ", "No Internet Connection", "OK");
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                await DisplayAlert("Final Error! ", e.Message, "OK");

                DisplayResults();
            }
            DisplayResults();
        }