示例#1
0
        public static ToastOverlay ShowToast(UIViewController controller, ToastOverlay currentToast, string loadingMessage)
        {
            if (currentToast != null)
            {
                currentToast.Remove();
            }

            var bounds = UIScreen.MainScreen.Bounds;

            if (UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeLeft || UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeRight)
            {
                bounds.Size = new CoreGraphics.CGSize(bounds.Size.Height, bounds.Size.Width);
            }

            nfloat labelHeight = 22;
            nfloat labelWidth  = bounds.Width;

            // derive the center x and y
            //nfloat centerX = bounds.Width / 2;
            nfloat centerY = bounds.Height / 2;

            var frameToSend = new CoreGraphics.CGRect(0f, centerY, labelWidth, labelHeight);

            ToastOverlay overlay = new ToastOverlay(frameToSend, loadingMessage);

            controller.View.Add(overlay);

            return(overlay);
        }
示例#2
0
 void btnPause_Clicked(object sender, EventArgs e)
 {
     if (paused)
     {
         paused = false;
         ResumeUpload();
         btnPause.Title = "Pause";
         currentToast   = Controls.ShowToast(this, currentToast, "Upload Resumed");
     }
     else
     {
         paused = true;
         PauseUpload();
         btnPause.Title = "Resume";
         currentToast   = Controls.ShowToast(this, currentToast, "Upload Paused");
     }
 }