示例#1
0
        private void UploadMedia(UIImage image, NSUrl referenceUrl, NSUrl mediaUrl)
        {
            byte[] mediaByteArray;
            if (image != null)
            {
                ByteHelper.ImageToByteArray(image, out mediaByteArray);
            }
            else if (mediaUrl != null)
            {
                ByteHelper.VideoToByteArray(mediaUrl, out mediaByteArray);
            }
            else
            {
                Console.Out.WriteLine("No media to upload!");
                return;
            }

            LoadingView loading = new LoadingView();

            loading.Show("Uploading file, please wait ...");

            server.UploadFileAsync(
                referenceUrl.AbsoluteString,
                mediaByteArray,
                delegate {
                loading.Hide();
            }
                );
        }
示例#2
0
        public static UIImage GetImageFromWebPage(UIWebView webPage, LoadingView lv)
        {
            var oldFrame = webPage.Frame;

            try
            {
                lv.Show();
                var frame       = webPage.Frame;
                var fittingSize = webPage.SizeThatFits(new SizeF());
                frame.Size    = fittingSize;
                webPage.Frame = frame;

                UIGraphics.BeginImageContext(new SizeF(webPage.Bounds.Width, webPage.Bounds.Height));
                webPage.Layer.RenderInContext(UIGraphics.GetCurrentContext());

                var viewImage = UIGraphics.GetImageFromCurrentImageContext();

                UIGraphics.EndImageContext();

                return(viewImage);
            }
            finally
            {
                webPage.Frame = oldFrame;
                lv.Hide();
            }
        }
示例#3
0
 private void DismissLoading()
 {
     UIApplication.SharedApplication.InvokeOnMainThread(delegate {
         if (loadingView.Visible)
         {
             loadingView.Hide();
         }
     });
 }
示例#4
0
        private void BeginPrintingDailySummary(string pdfFileName)
        {
            ThreadStart tsPrinting = new ThreadStart(delegate {
                LoadingView printing = new LoadingView();
                printing.Show("Printing, please wait");

                var printSummaryDone = new ManualResetEvent(false);
                bool printSummaryOK  = false;

                ThreadStart tsPrintSummary = new ThreadStart(delegate {
                    printSummaryOK = MyConstants.PrintPDFFile(pdfFileName);
                    printSummaryDone.Set();
                });
                Thread tPrintSummary = new Thread(tsPrintSummary);
                tPrintSummary.Start();

                printSummaryDone.WaitOne(5000);
                if (tPrintSummary.ThreadState == ThreadState.Running)
                {
                    tPrintSummary.Abort();
                }

                if (!printSummaryOK)
                {
                    InvokeOnMainThread(delegate {
                        printing.Hide();
                        var printError = new UIAlertView("Failed to print summary", "We are sorry!", null, "OK");
                        printError.Show();
                    });
                }
                else
                {
                    InvokeOnMainThread(delegate { printing.Hide(); });
                }
            });

            Thread tPrinting = new Thread(tsPrinting);

            tPrinting.Start();
        }
示例#5
0
 private void SetupViews()
 {
     loadingView   = new LoadingView(GameObject.Find("Canvas/LoadingPanel"));
     mainView      = new MainMenuView(GameObject.Find("Canvas/MainMenuPanel"));
     splashView    = new SplashView(GameObject.Find("Canvas/SplashPanel"));
     mapEditorView = new MapEditorView(GameObject.Find("Canvas/MapEditorPanel"));
     gameView      = new GameView(GameObject.Find("Canvas/GamePanel"));
     //Hide all views
     loadingView.Hide();
     mainView.Hide();
     splashView.Hide();
     mapEditorView.Hide();
     gameView.Hide();
 }
示例#6
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            NavigationController.SetNavigationBarHidden(true, true);

            if (loginLoad != null)
            {
                loginLoad.Hide();
            }
            if (photoLoading != null)
            {
                photoLoading.Hide();
            }
            //UIView.Transition(this.View,  , 0.8f, UIViewAnimationOptions.TransitionFlipFromLeft, null);
        }
示例#7
0
        private void Share(IUIInfo selDest)
        {
            var lv = new LoadingView("Retrieving image");

            SelectedDestination = selDest;

            if (selDest is ISocialSharer)
            {
                var selSocialSharer = (ISocialSharer)selDest;
                selSocialSharer.Share(this);

                return;
            }

            // this is a mess
            if (selDest is IFileSharingUploader)
            {
                var selFileSharer = (IFileSharingUploader)selDest;
                var docs          = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                var myFilename    = Helpers.GetWebFileName(docs);
                selFileSharer.Upload(WebFilePath, myFilename, this);

                return;
            }

            if (selDest is IPhotoAlbumUploader)
            {
                var selPhotoSharer = (IPhotoAlbumUploader)selDest;
                lv.Show();
                var img = Helpers.GetImageFromWebPage(WebPage, lv);
                lv.Hide();
                selPhotoSharer.Upload(img, this);

                return;
            }

            if (selDest is DropboxUploader)
            {
                var selDropBox = (DropboxUploader)selDest;
                selDropBox.Upload(WebFilePath, this);

                return;
            }

            throw new ArgumentOutOfRangeException("Unsupported sharer: " + selDest.Name);
        }
示例#8
0
        public async Task DeleteLatestVideo()
        {
            try
            {
                this.RunOnUiThread(() => LoadingView.Show(this, "Deleting..."));
                var deleteResponse = await UserResponseAPI.DeleteResponse(selectedMedia.Id);

                TabbedMainActivity.GetInstance().MyChannelFragment.latestResponse.adpater.LatestResponse =
                    new ObservableCollection <AdminVideoResponse>(UserResponseAPI.GetAdminVideos().VideoResponse);
                this.RunOnUiThread(() => Toast.MakeText(this, "Deleted Successfully", ToastLength.Long));
            }
            catch (Exception ex)
            {
            }
            finally
            {
                this.RunOnUiThread(() => LoadingView.Hide());
                this.Finish();
            }
        }
示例#9
0
        public async System.Threading.Tasks.Task UploadRecordedResponse(string Description)
        {
            try
            {
                this.RunOnUiThread(() => LoadingView.Show(this, "Uploading..."));
                var binaryData = VideoManager.GetVideoData();
                if (VideoManager.IsRecorderStop && binaryData != null)
                {
                    string msg = string.Empty;
                    if (UserResponseType == UserResponse.Video)
                    {
                        msg = await UserResponseAPI.UploadUserResponse(videoId, binaryData, InputSelectedType.Recorded, Description);
                    }
                    else
                    {
                        msg = await UserResponseAPI.UploadAudioUserResponse(videoId, binaryData, InputSelectedType.Recorded, Description);
                    }
                    if (ResponseFragment != null)
                    {
                        await ResponseFragment.GetResponseList(videoId);

                        ResponseFragment.GetUserResponse(videoId);
                    }
                    if (msg.Contains("ok"))
                    {
                        this.RunOnUiThread(() => Toast.MakeText(this, "Response Uploaded successfully", ToastLength.Short).Show());
                    }
                    else
                    {
                        this.RunOnUiThread(() => Toast.MakeText(this, msg, ToastLength.Short).Show());
                    }
                }
            }
            catch (System.Exception ex)
            {
            }
            finally
            {
                this.RunOnUiThread(() => LoadingView.Hide());
            }
        }
示例#10
0
        private async void CollectGarbage()
        {
            loadingState = LoadingState.CollectingGarbage;
            //Toggle Views
            if (activeView != null)
            {
                activeView.Hide();
            }
            requestedView.Show();

            activeView    = requestedView;
            requestedView = null;
            //Cleanup States
            activeState    = requestedState;
            requestedState = null;

            loadingView.Hide();
            //Clear Garbage/Unused
            engineState  = EngineState.Active;
            loadingState = LoadingState.None;
        }
        public void LoadImageByName(string imgPath)
        {
            // first remove previous image view, if any
            var prevImgView = ViewWithTag(ZOOM_VIEW_TAG);

            if (null != prevImgView)
            {
                prevImgView.RemoveFromSuperview();
                prevImgView.Dispose();
            }
            prevImgView = null;

            var loader = new LoadingView("Loading ...");

            try
            {
                loader.Show();

                var image = UIImage.FromFile(imgPath);
                mDrawingImageView              = new DrawingImageView(image);
                mDrawingImageView.OnTouchDown += OnTouchDownInternal;
                mDrawingImageView.OnTouchUp   += OnTouchUpInternal;
                mDrawingImageView.Tag          = ZOOM_VIEW_TAG;
                AddSubview(mDrawingImageView);
                ContentSize = mDrawingImageView.Frame.Size;

                // choose minimum scale so image width fits screen
                var minScale = Frame.Size.Width / mDrawingImageView.Frame.Size.Width;
                MinimumZoomScale = minScale;
                ZoomScale        = minScale;
                ContentOffset    = PointF.Empty;
            }
            finally
            {
                loader.Hide();
            }
        }
 /// <summary>
 /// ローディングを非表示にする
 /// </summary>
 /// <returns></returns>
 public static async UniTask Hide()
 {
     await _view.Hide();
 }
示例#13
0
//		void GetEmailRecepients (long CN, UIView view) {
//			// NOTE :: this does not work since iOS 6, because
//					// XPC infrastructure along with remote view controllers is used by mail composition
//					// we will have to collect email address before presenting the mail view controller
//			if (view is UITextField) {
//				if ((view as UITextField).Text.Contains ("@")) {
//					emailRecepients = (view as UITextField).Text;
//					return;
//				}
//			}
//
//			if (view.Subviews.Length > 0) {
//				foreach (UIView subView in view.Subviews) {
//					GetEmailRecepients (CN, subView);
//				}
//			}
//		}

        void BeginPrinting()
        {
            ThreadStart ts = new ThreadStart(delegate {
                LoadingView wait = new LoadingView();
                wait.Show("Printing, please wait");
                printOK = false;

                if (!Tabs._prePlumbView.IsDefault())
                {
                    if (Tabs._jobRunTable.CurrentCustomer.FilesToPrint != null)
                    {
                        this.Tabs._jobRunTable.CurrentCustomer.FilesToPrint.Add(Tabs._prePlumbView.pdfPrePlumbingFileName);
                    }

                    PrePlumbingPrintingDone.Reset();
                    ThreadStart tsPrintPreplumbing = new ThreadStart(delegate {
                        printOK = MyConstants.PrintPDFFile(Tabs._prePlumbView.pdfPrePlumbingFileName);
                        PrePlumbingPrintingDone.Set();
                    });
                    Thread tPrintPrePlumbing = new Thread(tsPrintPreplumbing);
                    tPrintPrePlumbing.Start();
                    PrePlumbingPrintingDone.WaitOne(5000);
                    if (tPrintPrePlumbing.ThreadState == ThreadState.Running)
                    {
                        tPrintPrePlumbing.Abort();
                    }
                }
                else
                {
                    printOK = true;
                }
                // WAS :: printOK = printOK && MyConstants.PrintPDFFile (Tabs._payment.pdfReceiptFileName);

                if (Tabs._jobRunTable.CurrentCustomer.FilesToPrint != null)
                {
                    this.Tabs._jobRunTable.CurrentCustomer.FilesToPrint.Add(Tabs._payment.pdfReceiptFileName);
                }

                bool printReceiptOK = false;
                ReceiptPrintingDone.Reset();
                ThreadStart tsPrintReceipt = new ThreadStart(delegate {
                    printReceiptOK = MyConstants.PrintPDFFile(Tabs._payment.pdfReceiptFileName);
                    ReceiptPrintingDone.Set();
                });
                Thread tPrintReceipt = new Thread(tsPrintReceipt);
                tPrintReceipt.Start();

                ReceiptPrintingDone.WaitOne(5000);
                if (tPrintReceipt.ThreadState == ThreadState.Running)
                {
                    tPrintReceipt.Abort();
                }

                printOK = printOK && printReceiptOK;

                InvokeOnMainThread(delegate()
                {
                    wait.Hide();
                    if (printOK)
                    {
                        Tabs._navWorkflow._finishWorkflow(null, null);
                    }
                    else                     // printing failed for some reason
                    {
                        UIAlertView printingError = new UIAlertView("Warning", "An error occurred during printing. What would you like to do?", null, "Try again", "Skip printing");
                        printingError.Dismissed  += HandlePrintingErrorDismissed;
                        printingError.Show();
                    }
                });
            });

            Thread t = new Thread(ts);

            t.Start();
        }
示例#14
0
 public void CloseMainView(object arg)
 {
     m_loadingView.Hide();
 }