Exemplo n.º 1
0
        private async Task ClassGetListAsync()
        {
            string[] words;

            GetContent get     = new GetContent(classUrl, "class_content_key");
            string     content = await get.GetContentAsync();

            words = content.Split(new char[] { ' ' });
            list  = new List <string>(words);
            pickerclass.ItemsSource = list;

            if (list.Count > 0)
            {
                GetStringFromKey SchedulegetTextFromKey = new GetStringFromKey("selected_class_key");
                pickerclass.SelectedIndex = (SchedulegetTextFromKey.GetText() == "") ? 0 : int.Parse(SchedulegetTextFromKey.GetText());
                classChanged = pickerclass.Items[pickerclass.SelectedIndex];
            }
        }
Exemplo n.º 2
0
        public async Task PasswordLoadingAsync()
        {
            try
            {
                GetContent get     = new GetContent(Url, "login_content_key");
                string     content = await get.GetContentAsync();

                List <Access> tr = JsonConvert.DeserializeObject <List <Access> >(content);
                trends = new ObservableCollection <Access>(tr);
                int i = trends.Count;
                if (i > 0)
                {
                    isLoaded            = true;
                    btn_login.TextColor = Color.White;
                }
            }
            catch (Exception ey)
            {
                Crashes.TrackError(ey);
            }
        }
Exemplo n.º 3
0
        protected async Task OnGetListAsync()
        {
            activity_indicator.IsRunning = true;
            activity_indicator.IsVisible = true;

            GetContent getContent = new GetContent(Url, "schedule_content_key");
            string     content    = await getContent.GetContentAsync();

            List <Subject> tr = JsonConvert.DeserializeObject <List <Subject> >(content);

            trends = new ObservableCollection <Subject>(tr);
            int i = trends.Count;

            if (i > 0)
            {
                activity_indicator.IsRunning = false;
                activity_indicator.IsVisible = false;
            }
            i = (trends.Count * heightRowsList);
            activity_indicator.HeightRequest = i;
            ChoseClassAndDay();
        }
Exemplo n.º 4
0
        protected async System.Threading.Tasks.Task OnGetListAsync()
        {
            GetUrl get = new GetUrl();

            Url = get.GetNewsUrl();
            activity_indicator.IsRunning = true;
            activity_indicator.IsVisible = true;
            GetContent getContent = new GetContent(Url, "news_content_key");
            string     content    = await getContent.GetContentAsync();

            List <News> tr = JsonConvert.DeserializeObject <List <News> >(content);

            trends = new ObservableCollection <News>(tr);
            int i = trends.Count;

            if (i > 0)
            {
                activity_indicator.IsRunning = false;
                activity_indicator.IsVisible = false;
            }
            i = (trends.Count * heightRowsList);
            activity_indicator.HeightRequest = i;
            ConvertAndShowNews();
        }
Exemplo n.º 5
0
        public async Task PasswordCheckAsync()
        {
            if (!isLoaded)
            {
                await DisplayAlert("Слабый интернет или нет сигнала", "Попробуйте еще раз", "Ок");

                _ = PasswordLoadingAsync();
            }

            List <Access> json = new List <Access>(trends);

            if (entry_login.Text != "")
            {
                string logintext = entry_login.Text;
                logintext = logintext.Replace(" ", "");
                bool isActive = false;
                foreach (Access s in json)
                {
                    if (s.login == logintext && s.password == entry_password.Text)
                    {
                        Application.Current.Properties["login_key"]    = s.login;
                        Application.Current.Properties["password_key"] = s.password;
                        var a = s.login;
                        if (a.Contains('_'))
                        {
                            string     content = "";
                            GetContent get     = new GetContent(classUrl, "class_list_content_key");
                            content = await get.GetContentAsync();

                            string[] words    = a.Split(new char[] { '_' });
                            string   classall = words[0];

                            content = content.ToLower();
                            words   = content.Split(new char[] { ' ' });

                            List <string> list       = new List <string>(words);
                            int           indexClass = Array.IndexOf(words, classall);
                            Application.Current.Properties["selected_class_key"] = (indexClass != -1) ? indexClass.ToString() : 0.ToString();
                        }
                        isActive = true;
                        break;
                    }
                }

                if (isActive)
                {
                    MainPage main = new MainPage();
                    await Navigation.PushModalAsync(main);
                }
                else
                {
                    await DisplayAlert("Не правильный логин и пароль", "Попробуйте еще раз", "Ок");

                    entry_password.Text = "";
                }
            }
            else
            {
                await DisplayAlert("Ошибка", "Введите логин и пароль", "Ок");

                entry_password.Text = "";
            }
        }