private void parseNotifications(RequestCompletedArgs result)
 {
     if (result.Success)
     {
         int unreadCount = (int)result.ResponseObject[0][1][1];
         if (unreadCount > 0)
         {
             new ToastPrompt {
                 Title = "You have {0} new notificaion{1}.".FormatWith(unreadCount, unreadCount > 1 ? "s" : "")
             }
         }
Пример #2
0
        private void finishUploadImage(Stream imageStream, RequestCompletedArgs result)
        {
            App.Progress.IsVisible = false;

            uploadImageObject = (JObject)JObject.Parse(result.RawData)["sessionStatus"]["additionalInfo"]["uploader_service.GoogleRupioAdditionalInfo"]["completionInfo"]["customerSpecificInfo"];
            PreviewBitmap.SetSource(imageStream);
            appbarShare.IsEnabled    = true;
            appbarAddPhoto.IconUri   = new Uri("//Images/appbar.delete.rest.png", UriKind.Relative);
            appbarAddPhoto.Text      = "Delete Photo";
            appbarAddPhoto.IsEnabled = true;
            appbarAddLink.IsEnabled  = false;
        }
 private void parseNewPosts(RequestCompletedArgs result)
 {
     if (result.Success)
     {
         posts.Clear();
         list = (JArray)result.ResponseObject[0][1][1][0];
         addPosts();
         App.Progress.IsVisible  = false;
         appbar.IsVisible        = true;
         appbarRefresh.IsEnabled = true;
         App.Settings.AddOrUpdateValue("LastUpdate", DateTime.Now);
     }
     else
     {
         MessageBox.Show("Please check your network", "Can't reach Google", MessageBoxButton.OK);
         throw new Exception("ExitAppException");
     }
 }
Пример #4
0
        private void initUploadImageCallback(Stream imageStream, RequestCompletedArgs result)
        {
            JObject obj = JObject.Parse(result.RawData);

            if (obj["sessionStatus"]["upload_id"].Type != JTokenType.Undefined)
            {
                new Request("POST", APIs.UploadImage.Replace("{UPLOAD_ID}", (string)obj["sessionStatus"]["upload_id"]), result2 =>
                {
                    if (result2.Success)
                    {
                        finishUploadImage(imageStream, result2);
                    }
                    else
                    {
                        MessageBox.Show("Please check your network", "Can't reach Google", MessageBoxButton.OK);
                    }
                }, imageStream);
            }
        }
        private void parseNotifications(RequestCompletedArgs result)
        {
            if (result.Success)
            {
                JArray array = (JArray)JArray.Parse(result.RawData.Substring(6))[0][1][1];

                new Request("POST", APIs.UpdateLastReadTime, result2 => { }, new UpdateLastReadTimeObject((long)(float)array[2]));

                int unreadCount = (int)array[7];
                ((MainViewModel)DataContext).Notifications.Clear();
                for (int i = 0; i < ((JArray)array[0]).Count; i++)
                {
                    JToken       notification = array[0][i];
                    Notification n            = new Notification(notification, i < unreadCount);
                    ((MainViewModel)DataContext).Notifications.Add(n);
                }
                App.Progress.IsVisible = false;
            }
            else
            {
                MessageBox.Show("Please check your network", "Can't reach Google", MessageBoxButton.OK);
                throw new Exception("ExitAppException");
            }
        }