Ejemplo n.º 1
0
 void RunDebugUi2()
 {
     var b = new ProgressHud ("Uploading image ", "Stop");
     b.Progress = .5f;
     window.BringSubviewToFront (b);
     window.AddSubview (b);
 }
Ejemplo n.º 2
0
 public Uploader UploadPicture(Stream source, Action<string> completed, ProgressHud progressHud)
 {
     return new Uploader (this) {
         SourceStream = source,
         UploadCompletedCallback = completed,
         ProgressHudView = progressHud
     };
 }
Ejemplo n.º 3
0
                void Save()
                {
                    userElement.FetchValue ();
                    passwordElement.FetchValue ();

                    hud = new ProgressHud (Locale.GetText ("Authenticating"), Locale.GetText ("Cancel"));
                    hud.ButtonPressed += delegate { DestroyHud (); };
                    dvc.View.AddSubview (hud);

                    // Send an incomplete request with login/password, if this returns 403, we got the wrong password
                    ThreadPool.QueueUserWorkItem ((x) => {
                        bool ok = false;
                        try {
                            ok = ValidateCredentials ();
                        } catch (Exception e){
                            Util.ReportError (this, e, "While validating credentials");
                        }
                        BeginInvokeOnMainThread (delegate {
                            DestroyHud ();
                            if (ok)
                                Close (true);
                        });
                    });
                }
Ejemplo n.º 4
0
 void DestroyHud()
 {
     hud.RemoveFromSuperview ();
     hud = null;
 }
Ejemplo n.º 5
0
        void PostCallback(object sender, EventArgs a)
        {
            sendItem.Enabled = false;

            if (Picture == null){
                Post ();
                return;
            }

            var jpeg = Picture.AsJPEG ();
            Stream stream;
            unsafe { stream = new UnmanagedMemoryStream ((byte*) jpeg.Bytes, jpeg.Length); }

            progressHud = new ProgressHud (Locale.GetText ("Uploading Image"), Locale.GetText ("Stop"));
            var uploader = TwitterAccount.CurrentAccount.UploadPicture (stream, PicUploadComplete, progressHud);

            progressHud.ButtonPressed += delegate {
                uploader.Cancel ();
                DestroyProgressHud ();
            };
            View.AddSubview (progressHud);
            ThreadPool.QueueUserWorkItem (delegate {
                uploader.Upload ();

                // This captures the variable and handle of jpeg, and then we clear it
                // to release it
                jpeg = null;
            });
        }
Ejemplo n.º 6
0
 void DestroyProgressHud()
 {
     progressHud.RemoveFromSuperview ();
     progressHud = null;
 }