Пример #1
0
        private async void GetAsync(string user_name, string user_password)
        {
            httpclientPost httpclient = new httpclientPost();
            string         json       = await httpclient.PostHttpClient(user_name, user_password);

            viewModel.Rootobject = JsonConvert.DeserializeObject <Models.VolunteerModel.Rootobject>(json);
        }
        private async void GetAsync(string user_name, string user_password)
        {
            httpclientPost httpclient = new httpclientPost();
            string         json       = await httpclient.PostHttpClient(user_name, user_password);

            viewModel.Rootobject = JsonConvert.DeserializeObject <Models.VolunteerModel.Rootobject>(json);
            if (viewModel.Rootobject.data.record.Length == 0)
            {
                sp1.Visibility        = Visibility.Collapsed;
                none_image.Visibility = Visibility.Visible;
            }
            viewModel.Record_year1 = new ObservableCollection <Models.VolunteerModel.Record>();
            SelectyearFunction(DateTime.Now.Year, viewModel.Record_year1);
            if (viewModel.Record_year1.Count == 0)
            {
                sp2.Visibility         = Visibility.Collapsed;
                none_image2.Visibility = Visibility.Visible;
            }
            viewModel.Record_year2 = new ObservableCollection <Models.VolunteerModel.Record>();
            SelectyearFunction(DateTime.Now.Year - 1, viewModel.Record_year2);
            if (viewModel.Record_year2.Count == 0)
            {
                sp3.Visibility         = Visibility.Collapsed;
                none_image3.Visibility = Visibility.Visible;
            }
            viewModel.Record_year3 = new ObservableCollection <Models.VolunteerModel.Record>();
            SelectyearFunction(DateTime.Now.Year - 2, viewModel.Record_year3);
            if (viewModel.Record_year3.Count == 0)
            {
                sp4.Visibility         = Visibility.Collapsed;
                none_image4.Visibility = Visibility.Visible;
            }
            viewModel.Record_year4 = new ObservableCollection <Models.VolunteerModel.Record>();
            SelectyearFunction(DateTime.Now.Year - 3, viewModel.Record_year4);
            if (viewModel.Record_year4.Count == 0)
            {
                sp5.Visibility         = Visibility.Collapsed;
                none_image5.Visibility = Visibility.Visible;
            }
            viewModel.Record_year5 = new ObservableCollection <Models.VolunteerModel.Record>();
            SelectyearFunction(DateTime.Now.Year - 4, viewModel.Record_year5);
            if (viewModel.Record_year5.Count == 0)
            {
                sp6.Visibility         = Visibility.Collapsed;
                none_image6.Visibility = Visibility.Visible;
            }
            viewModel.Record_year6 = new ObservableCollection <Models.VolunteerModel.Record>();
            SelectyearFunction(DateTime.Now.Year - 5, viewModel.Record_year6);
            if (viewModel.Record_year6.Count == 0)
            {
                sp7.Visibility         = Visibility.Collapsed;
                none_image7.Visibility = Visibility.Visible;
            }
            viewModel.Record_year7 = new ObservableCollection <Models.VolunteerModel.Record>();
            SelectyearFunction(DateTime.Now.Year - 6, viewModel.Record_year7);
            if (viewModel.Record_year7.Count == 0)
            {
                sp8.Visibility         = Visibility.Collapsed;
                none_image8.Visibility = Visibility.Visible;
            }
        }