Esempio n. 1
0
        public async void InitMainPage()
        {
            try
            {
                var api      = new ApiService().HseSupporterApi;
                var mainPage = await api.GetMainPage();

                Notices.Clear();
                Events.Clear();
                MainQuestions.Clear();

                AllNotices = mainPage.Notices;

                Profile = mainPage.Profile;
                foreach (var notice in mainPage.Notices.Where(notice => !notice.IsImportant))
                {
                    Notices.Add(notice);
                }
                foreach (var eEvent in mainPage.Events)
                {
                    Events.Add(eEvent);
                }
                foreach (var mainQuestion in mainPage.MainQuestions)
                {
                    MainQuestions.Add(mainQuestion);
                }

                IsBusy = false;
                OnLoad();
            }
            catch (HttpRequestException e)
            {
                OnError(ErrorType.ServerError);
            }
            catch (Exception e)
            {
                OnError(ErrorType.UnknownError);
            }
        }