public void Webview_Main_LoadStarted(object sender, EventArgs e)
        {
            var bounds = UIScreen.MainScreen.Bounds;

            // show the loading overlay on the UI thread using the correct orientation sizi
            loadingOverlay = new LoadingOverlay(bounds);
            View.Add(loadingOverlay);
        }
Example #2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            var bounds = UIScreen.MainScreen.Bounds;

            loading = new LoadingOverlay(bounds, "Updating Signature");

            this.SetToolbarItems(new UIBarButtonItem[] {
                new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (s, e) => {
                    DismissViewController(true, null);


                    Console.WriteLine("Cancel clicked");
                })
                , new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace)
                {
                    Width = 50
                }
                , new UIBarButtonItem(UIBarButtonSystemItem.Save, async(s, e) => {
                    //var detail = this.Storyboard.InstantiateViewController("IndigentApplicantsViewController") as IndigentApplicantsViewController;


                    //NavigationController.PopViewController(true);

                    var img = signature.GetImage();


                    try
                    {
                        // show the loading overlay on the UI thread using the correct orientation sizi

                        View.Add(loading);


                        using (NSData imageData = img.AsPNG())
                        {
                            Byte[] myByteAray = new Byte[imageData.Length];
                            System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, myByteAray, 0, Convert.ToInt32(imageData.Length));


                            await Task.Delay(1000);
                            bool upload = uploadSignature(myByteAray);
                            loading.Hide();
                        }

                        new UIAlertView("Sucess", "Signature Updated", null, "Ok", null).Show();
                    }
                    catch (Exception ex)
                    {
                        new UIAlertView("Error", ex.Message, null, "Ok", null).Show();

                        //new Android.Support.V7.App.AlertDialog.Builder(Activity).SetTitle("Indigent App Error").SetMessage("Upload failed: " + ex.Message + "\n \nPlease try again later").SetCancelable(true).Show();
                    }

                    backFromsign = true;
                    DismissViewController(true, null);

                    Console.WriteLine("Save clicked");
                })
            }, false);

            this.NavigationController.ToolbarHidden = false;
        }