Exemplo n.º 1
0
        private async void GoSetting_Clicked(object sender, EventArgs e)
        {
            if (!task)
            {
                task = true;

                var popup = new ProfileSettingPopup();

                popup.OnPopupSaved += async(s, arg) =>
                {
                    if (arg.Result)
                    {
                        var controller = new JsonController("setting");
                        var read       = controller.Read();

                        if (read != null)
                        {
                            try
                            {
                                var dict = new Dictionary <string, object>
                                {
                                    { "Grade", arg.Grade },
                                    { "Class", arg.Class },
                                    { "Number", arg.Number },
                                    { "Name", arg.Name },
                                    { "BirthMonth", arg.BirthMonth },
                                    { "BirthDay", arg.BirthDay }
                                };
                                controller.Add(dict);
                            }
                            catch (Exception ex)
                            {
                                await DisplayAlert("설정", "설정을 완료하는 도중 오류가 발생했습니다.\n" + ex.Message, "확인");
                            }
                        }
                        else
                        {
                            var jsonObj = new JObject(
                                new JProperty("Grade", arg.Grade),
                                new JProperty("Class", arg.Class),
                                new JProperty("Number", arg.Number),
                                new JProperty("Name", arg.Name),
                                new JProperty("BirthMonth", arg.BirthMonth),
                                new JProperty("BirthDay", arg.BirthDay));
                            await controller.Write(jsonObj);
                        }

                        App.Grade      = arg.Grade;
                        App.Class      = arg.Class;
                        App.Number     = arg.Number;
                        App.Name       = arg.Name;
                        App.BirthMonth = arg.BirthMonth;
                        App.BirthDay   = arg.BirthDay;

                        DependencyService.Get <IToastMessage>().Longtime("입력된 정보가 저장되었습니다.");

                        Page2Label2.Text  = "프로필 다시 설정하기";
                        Forward.IsVisible = true;

                        Page2Label3.IsVisible = true;
                        Page2Label3.Opacity   = 0;

                        await Page2Label3.FadeTo(1, 1000, Easing.SpringIn);
                    }
                };

                await PopupNavigation.Instance.PushAsync(popup, App.Animation);

                task = false;
            }
        }
Exemplo n.º 2
0
        private async void ProfileButton_Clicked(object sender, EventArgs e)
        {
            if (!task)
            {
                task = true;

                var popup = new ProfileSettingPopup();

                popup.OnPopupSaved += async(s, arg) =>
                {
                    if (arg.Result)
                    {
                        var controller = new JsonController("setting");
                        var read       = controller.Read();

                        if (read != null)
                        {
                            try
                            {
                                var dict = new Dictionary <string, object>
                                {
                                    { "Grade", arg.Grade },
                                    { "Class", arg.Class },
                                    { "Number", arg.Number },
                                    { "Name", arg.Name },
                                    { "BirthMonth", arg.BirthMonth },
                                    { "BirthDay", arg.BirthDay }
                                };
                                controller.Add(dict);
                            }
                            catch (Exception ex)
                            {
                                await MainPage.GetInstance().ErrorAlert("설정", "설정을 완료하는 도중 오류가 발생했습니다.\n" + ex.Message);
                            }
                        }
                        else
                        {
                            var jsonObj = new JObject(
                                new JProperty("Grade", arg.Grade),
                                new JProperty("Class", arg.Class),
                                new JProperty("Number", arg.Number),
                                new JProperty("Name", arg.Name),
                                new JProperty("BirthMonth", arg.BirthMonth),
                                new JProperty("BirthDay", arg.BirthDay));
                            await controller.Write(jsonObj);
                        }

                        App.Grade      = arg.Grade;
                        App.Class      = arg.Class;
                        App.Number     = arg.Number;
                        App.Name       = arg.Name;
                        App.BirthMonth = arg.BirthMonth;
                        App.BirthDay   = arg.BirthDay;

                        TabbedHomePage.GetInstance().MyInfoUpdate();
                        MainPage.GetInstance().GetTimetable();
                        _ = TabbedSchedulePage.GetInstance().ViewScheduleAnimation();

                        DependencyService.Get <IToastMessage>().Longtime("입력된 정보가 저장되었습니다.");
                    }
                };

                await PopupNavigation.Instance.PushAsync(popup, App.Animation);

                task = false;
            }
        }