Exemplo n.º 1
0
        private async void btn_Punch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                string results = await WebClientClass.PostResults(new Uri("https://picaapi.picacomic.com/users/punch-in"), "");

                PunchModel list = JsonConvert.DeserializeObject <PunchModel>(results);
                if (list.code == 200)
                {
                    btn_Punch.Visibility = Visibility.Collapsed;
                    messShow.Show("操作成功辣!", 3000);
                    GetProFile();
                }
                else
                {
                    messShow.Show(list.message, 3000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    messShow.Show("檢查你的網絡連接!", 3000);
                }
                else
                {
                    messShow.Show("操作失敗了,挂個VPN試試?", 3000);
                }
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
Exemplo n.º 2
0
        private async void Collect(bool iscollect)
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;

                string uri = "";

                uri = "https://picaapi.picacomic.com/comics/" + _id + "/favourite";

                string results = await WebClientClass.PostResults(new Uri(uri), "");

                CommentsModel info = JsonConvert.DeserializeObject <CommentsModel>(results);

                if (info.code == 200)
                {
                    if (iscollect)
                    {
                        btn_UnCollect.Visibility = Visibility.Visible;
                        btn_Collect.Visibility   = Visibility.Collapsed;
                    }
                    else
                    {
                        btn_UnCollect.Visibility = Visibility.Collapsed;
                        btn_Collect.Visibility   = Visibility.Visible;
                    }
                    messShow.Show("操作成功辣!", 3000);
                }
                else
                {
                    messShow.Show(info.message, 2000);
                }
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2147012867)
                {
                    messShow.Show("檢查你的網絡連接!", 3000);
                }
                else
                {
                    messShow.Show("操作失敗了,挂個VPN試試?", 3000);
                }
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }