protected virtual void Refresh()
        {
            if (!this.IsShowing)
            {
                return;
            }

            var   txt = this.Title;
            float p   = -1;

            if (this.IsDeterministic)
            {
                p = (float)this.PercentComplete / 100;
                if (!String.IsNullOrWhiteSpace(txt))
                {
                    txt += "... ";
                }
                txt += this.PercentComplete + "%";
            }

            if (this.cancelAction == null)
            {
                BTProgressHUD.Show(
                    this.Title,
                    p,
                    ProgressHUD.MaskType.Black
                    );
            }
            else
            {
                BTProgressHUD.Show(
                    this.cancelText,
                    this.cancelAction,
                    txt,
                    p,
                    ProgressHUD.MaskType.Black
                    );
            }
        }
示例#2
0
        async partial void BtnAnalyzeFace_Action(UIBarButtonItem sender)
        {
            if (CrossMedia.Current.IsPickPhotoSupported)
            {
                try
                {
                    var result = await CrossMedia.Current.PickPhotoAsync();

                    if (result == null)
                    {
                        return;
                    }
                    BTProgressHUD.Show($"{ResourcesTexts.Analyzing}");
                    var face = await Service.Instance.AnalyzeFace(result.GetStream());

                    if (face == null)
                    {
                        BTProgressHUD.Dismiss();
                        return;
                    }
                    BTProgressHUD.Dismiss();
                    await Task.Delay(1000);

                    var stringData = $"{ResourcesTexts.Gender}: {face.FaceAttributes.Gender}" + Environment.NewLine;
                    stringData += $"{ResourcesTexts.Age}: {face.FaceAttributes.Age}" + Environment.NewLine;
                    stringData += $"{ResourcesTexts.Glasses}: {face.FaceAttributes.Glasses.ToString()}" + Environment.NewLine;
                    stringData += $"{ResourcesTexts.Beard}: {face.FaceAttributes.FacialHair.Beard}" + Environment.NewLine;
                    stringData += $"{ResourcesTexts.Moustache}: {face.FaceAttributes.FacialHair.Moustache}" + Environment.NewLine;
                    stringData += $"{ResourcesTexts.Sideburns}: {face.FaceAttributes.FacialHair.Sideburns}" + Environment.NewLine;
                    stringData += $"{ResourcesTexts.Smile}: {face.FaceAttributes.Smile}";
                    new UIAlertView($"{ResourcesTexts.MSCS}", stringData, null, $"{ResourcesTexts.Ok}").Show();
                }
                catch
                {
                    BTProgressHUD.Dismiss();
                }
            }
        }
示例#3
0
            private void btnSyncExam_Clicked(object sender, EventArgs e)
            {
                AppSession.SelectedExam = null;
//				AppDelegate.m_flyoutMenuController.ExamTab.PopToRootViewController (false);
                AppDelegate.m_flyoutMenuController.ExamTab.SetViewControllers(new UIViewController[] { new ExamListView() }, false);

                BTProgressHUD.Show("Syncing");
                bool _syncSuccessful = true;

                Task.Factory.StartNew(() => {
                    try{
                        if (SyncManager.PushAllDoSyncData())
                        {
                            SyncManager.SyncExamDataFromServer();
                            SyncManager.SyncUserExamDataFromServer(AppSession.LoggedInUser);
                            SyncManager.SyncUserExamAccess(AppSession.LoggedInUser);
                            SyncManager.SyncUserQuestionAndAnswerFromServer(AppSession.LoggedInUser, true);
                        }
                        else
                        {
                            _syncSuccessful = false;
                        }
                    }
                    catch (Exception ex) {
                        Console.WriteLine(ex.ToString());
                        _syncSuccessful = false;
                    }
                }).ContinueWith(task1 => {
                    BTProgressHUD.Dismiss();
                    if (!_syncSuccessful)
                    {
                        UIAlertView _unsuccessfulSyncAlert = new UIAlertView("Sync Failed",
                                                                             "The sync process cannot be completed. Please try again later",
                                                                             null, "Ok", null);
                        _unsuccessfulSyncAlert.Show();
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
示例#4
0
        void OnViewModelPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            InvokeOnMainThread(() => {
                switch (e.PropertyName)
                {
                case SignUpViewModel.RegisterEnabledPropertyName:
                    ContinueBtn.Enabled = viewModel.RegisterEnabled;
                    SausageButtons.UpdateBackgoundColor(ContinueBtn);
                    break;

                case BaseViewModel.IsBusyPropertyName:
                    if (viewModel.IsBusy)
                    {
                        BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Black);
                    }
                    else
                    {
                        BTProgressHUD.Dismiss();
                    }
                    break;
                }
            });
        }
        void HandleGameSelected(object sender, GameViewModel e)
        {
            var gameplayViewController = AppDelegate.GameplayStoryboard.InstantiateViewController("GameplayViewController") as GameplayViewController;
            var gameplayViewModel      = new GameplayViewModel(AppDelegate.Repository, e.Model, this.View.Frame.Height, this.View.Frame.Width);

            BTProgressHUD.Show("Loading Game Data", -1, ProgressHUD.MaskType.Black);
            gameplayViewModel.InitializeAsync().ContinueWith(t => {
                InvokeOnMainThread(() => {
                    if (!t.IsFaulted && t.Result)
                    {
                        gameplayViewController.SetGameplayViewModel(gameplayViewModel);
                        this.TabBarController.TabBar.Hidden = true;
                        this.NavigationController.PushViewController(gameplayViewController, true);
                    }
                    else
                    {
                        // TODO error
                    }

                    BTProgressHUD.Dismiss();
                });
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            viewModel = ServiceContainer.Resolve <ExpensesViewModel>();

            viewModel.IsBusyChanged = (busy) =>
            {
                if (busy)
                {
                    BTProgressHUD.Show("Loading...");
                }
                else
                {
                    BTProgressHUD.Dismiss();
                }
            };

            TableView.Source = new ExpensesSource(viewModel, this);
            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Add, delegate
            {
                NavigationController.PushViewController(new ExpenseViewController(null), true);
            });
        }
        private void Process()
        {
            int ResponseCode = 0;

            try
            {
                BTProgressHUD.Show();
                Task.Factory.StartNew(
                    // tasks allow you to use the lambda syntax to pass wo
                    () =>
                {
                    ResponseCode = WebService.ChangePassword(StaticDataModel.UserName, txtCurrentPassword.Text, txtNewPassword.Text);
                }                        ///
                    ).ContinueWith(
                    t =>
                {
                    if (ResponseCode == 200)
                    {
                        BTProgressHUD.ShowToast("Password has been changed successfully.", false, 1000);
                        StudentList home = this.Storyboard.InstantiateViewController("StudentList") as StudentList;
                        if (home != null)
                        {
                            this.PresentModalViewController(home, false);
                        }
                    }
                    else
                    {
                        BTProgressHUD.ShowToast("Username or password does not match.", false, 1000);
                    }
                    BTProgressHUD.Dismiss();
                }, TaskScheduler.FromCurrentSynchronizationContext()
                    );
            }
            catch (Exception ex)
            {
            }
        }
        private async void PaymentSuccess(string nonce)
        {
            try
            {
                int?i = null;
                Console.WriteLine(i.Value.ToString());
            }
            catch (Exception ex)
            {
                Insights.Report(ex);
            }


            BTProgressHUD.Show("Contacting server!");
            this.PresentedViewController.DismissViewController(true, null);

            var endpoint = string.Format("{0}/payment/purchase", Constants.ServerApiAddress);
            var payload  = new PaymentRequest
            {
                Amount = 1,
                Price  = 10,
                Email  = this.UserEmail,
                Nonce  = nonce
            };

            var response = await HttpRequestHelper.Post <PaymentResponse>(endpoint, payload);

            if (response.IsSuccess)
            {
                BTProgressHUD.ShowSuccessWithStatus("Payment success!");
                LeanplumBindings.Leanplum.Track("Purchase success", 10);
            }
            else
            {
                BTProgressHUD.ShowErrorWithStatus("Oh noez!");
            }
        }
示例#9
0
        async partial void BtnVerifyFace_Action(UIBarButtonItem sender)
        {
            if (CrossMedia.Current.IsPickPhotoSupported)
            {
                try
                {
                    var result = await CrossMedia.Current.PickPhotoAsync();

                    if (result == null)
                    {
                        return;
                    }
                    BTProgressHUD.Show($"{ResourcesTexts.Searching}");
                    var persons = await Service.Instance.FindSimilarFace(result.GetStream());

                    BTProgressHUD.Dismiss();
                    if (persons == null || persons.Count == 0)
                    {
                        BTProgressHUD.Dismiss();
                        new UIAlertView($"{ResourcesTexts.MSCS}", $"{ResourcesTexts.NotFound}", null, $"{ResourcesTexts.Ok}").Show();
                        return;
                    }
                    await Task.Delay(1000);

                    string personsString = "";
                    foreach (var item in persons)
                    {
                        personsString += item.Name + ", \n";
                    }

                    new UIAlertView($"{ResourcesTexts.MSCS}", personsString, null, $"{ResourcesTexts.Ok}").Show();
                }
                catch (Exception e) {
                    BTProgressHUD.Dismiss();
                }
            }
        }
示例#10
0
        private void GetabsentPresent(string from, string to)
        {
            string response = string.Empty;

            try
            {
                BTProgressHUD.Show("Loading...");
                Task.Factory.StartNew(
                    // tasks allow you to use the lambda syntax to pass wor
                    () =>
                {
                    response = WebService.GetStudentPresentAbsent(StaticDataModel.StudentId, schoolid, from, to);
                }
                    ///
                    ).ContinueWith(
                    t =>
                {
                    if (!string.IsNullOrEmpty(response))
                    {
                        var data = response.Split(',');
                        tp1.Text = data[0];
                        ta1.Text = data[1];
                        th1.Text = data[2];
                    }


                    BTProgressHUD.Dismiss();
                }, TaskScheduler.FromCurrentSynchronizationContext()
                    );
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
示例#11
0
        private void SubmitAbsentReport(string dates, string reason)
        {
            int responseCode = 0;

            try
            {
                BTProgressHUD.Show("Fetching List...");
                Task.Factory.StartNew(
                    // tasks allow you to use the lambda syntax to pass wor
                    () =>
                {
                    responseCode = WebService.SubmitAbsentReport(SelectedStudentId, dates, reason);
                }
                    ///
                    ).ContinueWith(
                    t =>
                {
                    if (responseCode == 200)
                    {
                        BTProgressHUD.ShowToast("absent has been added successfully.", false, 1000);
                        this.DismissViewController(false, null);
                    }
                    else
                    {
                        BTProgressHUD.ShowToast("Failed to add absent, Please try again later!.", false, 1000);
                    }
                    BTProgressHUD.Dismiss();
                }, TaskScheduler.FromCurrentSynchronizationContext()
                    );
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
示例#12
0
        //set the Image at Starting Position
        private void placeImageAtInitianPosition(float X, float Y, UIImageView image)
        {
            try
            {
                Current_XPosition = X;
                Current_YPosition = Y;


                //check if the view out of screen

                if ((Current_XPosition <= 0 || Current_XPosition >= screenWidth - image.Frame.Size.Width) || (Current_YPosition <= 0 || Current_YPosition >= screenHight - image.Frame.Size.Height))
                {
                    setIntialPositionOfRobo();
                    BTProgressHUD.ShowToast("Intial Start X and Y values goes out the screen,Again I check the Position", true, 1000);
                    //Toast.MakeText(this, "Intial Start X and Y values goes out the screen,Again I check the Position", ToastLength.Short).Show();
                    return;
                }
                image.Image = UIImage.FromBundle("ic_robot.png");

                image.Frame = new CoreGraphics.CGRect(x: Current_XPosition, y: Current_YPosition, width: img_sweeper.Frame.Size.Width, height: img_sweeper.Frame.Size.Height);
            }
            catch (Exception ex)
            { }
        }
示例#13
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            BTProgressHUD.ForceiOS6LookAndFeel = true;
            BTProgressHUD.Show("Loading viewers...");

            Viewers = await TwitchViewerService.GetViewers();

            Mods = await TwitchViewerService.GetMods();

            ViewerCount = await TwitchViewerService.GetViewerCount();

            //TwitchViewerService.TestFollowersMethod ();

            if (ViewerCount.HasValue)
            {
                this.Title = $"Twitch Viewers - {ViewerCount.Value} online";
            }

            this.TableView.ReloadData();

            BTProgressHUD.Dismiss();
        }
示例#14
0
        async Task AddFace()
        {
            if (CrossMedia.Current.IsTakePhotoSupported)
            {
                await Task.Delay(500);

                try
                {
                    var result = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions {
                        PhotoSize     = PhotoSize.Medium,
                        DefaultCamera = CameraDevice.Front
                    });

                    if (result == null)
                    {
                        return;
                    }
                    BTProgressHUD.Show("Adding Face");
                    var face = await Service.Instance.AddFace(result.GetStream(), Service.Instance.People[_lastItemClicked.Row]);

                    if (!face)
                    {
                        BTProgressHUD.Dismiss();
                        return;
                    }
                    BTProgressHUD.Dismiss();
                    await Task.Delay(1000);

                    BTProgressHUD.ShowSuccessWithStatus("Face Added");
                }
                catch
                {
                    BTProgressHUD.Dismiss();
                }
            }
        }
示例#15
0
 private void GetAllNotificationsList()
 {
     model = new List <NotificationModel>();
     try
     {
         BTProgressHUD.Show("Fetching List...");
         Task.Factory.StartNew(
             // tasks allow you to use the lambda syntax to pass wor
             () =>
         {
             model = WebService.GetAllNotification();
         }
             ///
             ).ContinueWith(
             t =>
         {
             if (model != null)
             {
                 tblNotification.Source = new Notification_tableviewsource(model);
                 Add(tblNotification);
                 tblNotification.ReloadData();
             }
             else
             {
             }
             BTProgressHUD.Dismiss();
         }, TaskScheduler.FromCurrentSynchronizationContext()
             );
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
        private void BackTapped(object s, EventArgs e)
        {
            BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Clear);
            if (_currentStepIndex == 1)
            {
                if (CreateSurveyController.SurveyModel != null &&
                    CreateSurveyController.SurveyModel.question != null &&
                    !string.IsNullOrEmpty(CreateSurveyController.SurveyModel.question.text))
                {
                    CreateSurveyController._nextButton.SetTitleColor(UIColor.White, UIControlState.Normal);
                    CreateSurveyController._nextButton.BackgroundColor = UIColor.FromRGB(70, 230, 130);
                }
                else
                {
                    CreateSurveyController._nextButton.SetTitleColor(UIColor.FromRGB(220, 220, 220), UIControlState.Normal);
                    CreateSurveyController._nextButton.BackgroundColor = UIColor.White;
                }
            }

            var vcs = new UIViewController[] { Steps.ElementAt(_currentStepIndex - 1) as UIViewController };

            _pageViewController.SetViewControllers(vcs, UIPageViewControllerNavigationDirection.Reverse, true, null);
            BTProgressHUD.Dismiss();
        }
示例#17
0
        public void BindClicks(UIButton btnMan, UIButton btnSec, UIButton btnPP, UIView parentView)
        {
            try
            {
                btnMan.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //BTProgressHUD.Dismiss();//show spinner + text
                };
                btnPP.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show(LoggingClass.txtloading);

                    //BTProgressHUD.Dismiss();//show spinner + text
                };
                btnSec.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show(LoggingClass.txtloading);
                };
                btnMan.TouchUpInside += (sender, e) =>
                {
                    nfloat width = UIScreen.MainScreen.Bounds.Width;
                    width = width / 2 - 15;

                    UICollectionViewFlowLayout flowLayout;
                    flowLayout = new UICollectionViewFlowLayout()
                    {
                        ItemSize        = new CGSize(width, 325.0f),
                        SectionInset    = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                        ScrollDirection = UICollectionViewScrollDirection.Vertical
                    };
                    NavigationController.NavigationBar.TopItem.Title = "Locations";
                    NavigationController.PushViewController(new PhyCollectionView(flowLayout, 1), false);
                    LoggingClass.LogInfo("Entered into " + LoggingClass.txtstore1, screen);
                    BTProgressHUD.Dismiss();
                };
                btnSec.TouchUpInside += (sender, e) =>
                {
                    nfloat width = UIScreen.MainScreen.Bounds.Width;
                    width = width / 2 - 15;

                    UICollectionViewFlowLayout flowLayout;
                    flowLayout = new UICollectionViewFlowLayout()
                    {
                        ItemSize        = new CGSize(width, 325.0f),
                        SectionInset    = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                        ScrollDirection = UICollectionViewScrollDirection.Vertical
                    };
                    NavigationController.NavigationBar.TopItem.Title = "Locations";
                    NavigationController.PushViewController(new PhyCollectionView(flowLayout, 3), false);
                    LoggingClass.LogInfo("Entered into " + LoggingClass.txtstore3, screen);
                    BTProgressHUD.Dismiss();
                    //UIAlertView alert = new UIAlertView()
                    //{
                    //	Title = LoggingClass.txtstore3+" Store",
                    //	Message = "Coming Soon..."
                    //};
                    //LoggingClass.LogInfo("Clicked on "+LoggingClass.txtstore3, screen);
                    //alert.AddButton("OK");
                    //alert.Show();
                    //nfloat width = UIScreen.MainScreen.Bounds.Width;
                    //width = width / 2 - 15;
                    //					UICollectionViewFlowLayout flowLayout;
                    //flowLayout = new UICollectionViewFlowLayout()
                    //{
                    //	ItemSize = new CGSize(width, 325.0f),
                    //						SectionInset = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                    //						ScrollDirection = UICollectionViewScrollDirection.Vertical
                    //					};
                    //NavigationController.NavigationBar.TopItem.Title = "Locations";
                    //NavigationController.PushViewController(new PhyCollectionView(flowLayout, 3), false);
                    //LoggingClass.LogInfo("Entered into "+LoggingClass.txtstore3, screen);
                    //BTProgressHUD.Dismiss();
                };

                btnPP.TouchUpInside += (sender, e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //async (sender, e)
                    //ServiceWrapper svc = new ServiceWrapper();
                    //string ret = await svc.GetDataAsync();
                    //((UIButton)sender).SetTitle(ret, UIControlState.Normal);
                    nfloat width = UIScreen.MainScreen.Bounds.Width;
                    width = width / 2 - 15;

                    UICollectionViewFlowLayout flowLayout;
                    flowLayout = new UICollectionViewFlowLayout()
                    {
                        //HeaderReferenceSize = new CGSize(width, 275.0f),
                        ItemSize     = new CGSize(width, 325.0f),
                        SectionInset = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                        //SectionInset = new UIEdgeInsets(20, 20, 20, 20),
                        ScrollDirection = UICollectionViewScrollDirection.Vertical
                                          //MinimumInteritemSpacing = 50, // minimum spacing between cells
                                          //MinimumLineSpacing = 50 // minimum spacing between rows if ScrollDirection is Vertical or between columns if Horizontal
                    };
                    LoggingClass.LogInfo("Entered into Point Plesant", screen);
                    NavigationController.NavigationBar.TopItem.Title = "Locations";
                    NavigationController.PushViewController(new PhyCollectionView(flowLayout, 2), false);

                    BTProgressHUD.Dismiss();
                };
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
示例#18
0
 public void Show(string status)
 {
     BTProgressHUD.Show(status, -1, ProgressHUD.MaskType.Black);
 }
示例#19
0
 public void Dismiss()
 {
     BTProgressHUD.Dismiss();
 }
        public MyReviewCellView(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            try
            {
                btnBack = new UIButton();
                btnBack.BackgroundColor        = UIColor.FromRGB(63, 63, 63);
                btnBack.UserInteractionEnabled = false;
                SelectionStyle             = UITableViewCellSelectionStyle.Gray;
                imageView                  = new UIButton();
                imageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                imageView.ContentMode      = UIViewContentMode.Center;
                imageView.ClipsToBounds    = true;
                //imageView.TouchDown += (object sender, EventArgs e) =>
                //{
                //	BTProgressHUD.Show("Loading...");
                //};
                imageView.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show(LoggingClass.txtloading);
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                Review review = new Review();
                separator = new UIImageView();

                btnItemname = new UIButton();
                btnItemname.SetTitle("", UIControlState.Normal);
                btnItemname.SetTitleColor(UIColor.FromRGB(127, 51, 0), UIControlState.Normal);
                btnItemname.Font                = UIFont.FromName("Verdana-Bold", 13f);
                btnItemname.LineBreakMode       = UILineBreakMode.WordWrap;
                btnItemname.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
                btnItemname.TouchUpInside      += delegate
                {
                    BTProgressHUD.Show("Loading...");
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                ReviewDate = new UILabel()
                {
                    Font      = UIFont.FromName("AmericanTypewriter", 10f),
                    TextColor = UIColor.FromRGB(38, 127, 200),
                    //TextAlignment = UITextAlignment.Center,
                    BackgroundColor = UIColor.Clear
                };
                Comments = new UITextView()
                {
                    Font          = UIFont.FromName("AmericanTypewriter", 14f),
                    TextColor     = UIColor.FromRGB(55, 127, 0),
                    TextAlignment = UITextAlignment.Justified,
                    //TextAlignment = UITextAlignment.Natural,
                    BackgroundColor = UIColor.Clear,
                    //LineBreakMode = UILineBreakMode.WordWrap
                    Editable   = false,
                    Selectable = false
                };
                ReadMore = new UIButton()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    BackgroundColor = UIColor.White
                };
                Vintage = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    TextColor       = UIColor.FromRGB(127, 51, 100),
                    BackgroundColor = UIColor.Clear
                };
                decimal averageRating = 0.0m;
                var     ratingConfig  = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/star-silver2.png"),
                                                         filledImage: UIImage.FromBundle("Stars/star.png"),
                                                         chosenImage: UIImage.FromBundle("Stars/star.png"));
                stars   = new PDRatingView(new CGRect(110, 60, 60, 20), ratingConfig, averageRating);
                btnEdit = new UIButton();
                btnEdit.SetImage(UIImage.FromFile("edit.png"), UIControlState.Normal);
                btnEdit.TouchUpInside += (sender, e) =>
                {
                    PopupView yourController = new PopupView(WineIdLabel.Text, storeid);
                    yourController.NavController  = NavController;
                    yourController.parent         = Parent;
                    yourController.StartsSelected = stars.AverageRating;
                    yourController.Comments       = Comments.Text;
                    LoggingClass.LogInfo("Edited the review of " + wineId, screenid);


                    //yourController.WineId = Convert.ToInt32(WineIdLabel.Text);
                    yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                    //this.PresentViewController(yourController, true, null);
                    Parent.PresentModalViewController(yourController, false);
                };
                btnDelete = new UIButton();
                btnDelete.SetImage(UIImage.FromFile("delete.png"), UIControlState.Normal);
                btnDelete.TouchUpInside += (sender, e) =>
                {
                    UIAlertView alert = new UIAlertView()
                    {
                        Title   = "Delete Review ",
                        Message = LoggingClass.txtdeletereview,
                    };
                    alert.AddButton("Yes");
                    alert.AddButton("No");

                    alert.Clicked += async(senderalert, buttonArgs) =>
                    {
                        if (buttonArgs.ButtonIndex == 0)
                        {
                            review.Barcode      = WineIdLabel.Text;
                            review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
                            BTProgressHUD.Show("Deleting review");
                            await sw.DeleteReview(review);

                            LoggingClass.LogInfo("Deleting the review of " + wineId, screenid);
                            BTProgressHUD.ShowSuccessWithStatus("Done");
                            ((IPopupParent)Parent).RefreshParent();
                        }
                    };

                    alert.Show();
                };
                btnLike = new UIButton();
                btnLike.ClipsToBounds              = true;
                btnLike.Layer.BorderColor          = UIColor.White.CGColor;
                btnLike.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                btnLike.Tag = 0;
                //myItem = new Item();
                //bool count =Convert.ToBoolean( myItem.IsLike);
                //if (count == true)
                //{
                //btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);}
                //else
                //{
                //	btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                //}
                btnLike.TouchUpInside += async(object sender, EventArgs e) =>
                {
                    try
                    {
                        UIButton temp = (UIButton)sender;
                        if (temp.Tag == 0)
                        {
                            btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                            temp.Tag   = 1;
                            Data.Liked = 1;
                            //btnLike.Tag = 1;
                            LoggingClass.LogInfo("Liked Wine " + WineIdLabel.Text, screenid);
                        }
                        else
                        {
                            btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                            temp.Tag   = 0;
                            Data.Liked = 0;

                            LoggingClass.LogInfo("Unliked Wine " + WineIdLabel.Text, screenid);
                        }
                        SKULike like = new SKULike();
                        like.UserID  = Convert.ToInt32(CurrentUser.RetreiveUserId());
                        like.BarCode = WineIdLabel.Text;
                        like.Liked   = Convert.ToBoolean(temp.Tag);

                        Data.Liked = Convert.ToInt32(temp.Tag);
                        await sw.InsertUpdateLike(like);
                    }
                    catch (Exception ex)
                    {
                        LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
                    }
                };
                WineIdLabel = new UILabel();
                ContentView.AddSubviews(new UIView[] { btnBack, btnItemname, ReadMore, ReviewDate, Comments, stars, imageView, Vintage, separator, btnEdit, btnDelete, btnLike });
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }
示例#21
0
 public void Show()
 {
     BTProgressHUD.Show();
 }
示例#22
0
 public static void ShowErrorWithStatus(string status, double timeoutMs)
 {
     BTProgressHUD.ShowErrorWithStatus(status, timeoutMs);
 }
示例#23
0
        public override void ViewDidLoad()
        {
            BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Clear);
            base.ViewDidLoad();

            this.EdgesForExtendedLayout                         = UIRectEdge.None;
            this.ExtendedLayoutIncludesOpaqueBars               = false;
            this.AutomaticallyAdjustsScrollViewInsets           = false;
            this.NavigationController.NavigationBar.Translucent = false;

            UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes
            {
                ForegroundColor = UIColor.FromRGB(90, 89, 89)
            };

            this.RestrictRotation(UIInterfaceOrientationMask.Portrait);

            imageCache.RemoveAllObjects();

            profileImageView.Layer.MasksToBounds = true;
            profileImageView.Image = null;

            uploadButton.TouchUpInside       += btnUpload_TouchUpInside;
            nameButton.TouchUpInside         += btnName_TouchUpInside;
            emailButton.TouchUpInside        += btnEmail_TouchUpInside;
            ageButton.TouchUpInside          += btnAge_TouchUpInside;
            manButton.TouchUpInside          += btnMan_TouchUpInside;
            womanButton.TouchUpInside        += btnWoman_TouchUpInside;
            imagePicker.FinishedPickingMedia += Handle_FinishedPickingMedia;
            imagePicker.Canceled             += Handle_Canceled;

            emailText.EditingDidEnd += EmailText_EditingDidEnd;

            logoutBtn.TouchUpInside += LogoutBtn_TouchUpInside;

            deleteBtn.TouchUpInside += DeleteBtn_TouchUpInside;

            ageText.KeyboardType           = UIKeyboardType.NumberPad;
            ageText.ShouldChangeCharacters = (textField, range, replacement) =>
            {
                int number;
                return(replacement.Length == 0 || int.TryParse(replacement, out number));
            };

            uploadButton.Layer.BorderColor = UIColor.FromRGB(90, 89, 89).CGColor;
            uploadButton.Layer.BorderWidth = 1f;

            uploadButton.TintColor = UIColor.FromRGB(90, 89, 89);
            uploadButton.SetTitleColor(UIColor.FromRGB(90, 89, 89), UIControlState.Normal);

            logoutBtn.Layer.BorderColor  = UIColor.FromRGB(90, 89, 89).CGColor;
            logoutBtn.Layer.BorderWidth  = 1f;
            logoutBtn.Layer.CornerRadius = 5;


            logoutBtn.TintColor = UIColor.FromRGB(90, 89, 89);
            logoutBtn.SetTitle("   Logout   ", UIControlState.Normal);
            logoutBtn.SetTitleColor(UIColor.FromRGB(90, 89, 89), UIControlState.Normal);

            deleteBtn.Layer.BorderColor  = UIColor.Red.CGColor;
            deleteBtn.Layer.BorderWidth  = 1f;
            deleteBtn.Layer.CornerRadius = 5;

            deleteBtn.TintColor = UIColor.Red;
            deleteBtn.SetTitle("   Delete Account   ", UIControlState.Normal);
            deleteBtn.SetTitleColor(UIColor.Red, UIControlState.Normal);

            nameText.TextColor   = UIColor.FromRGB(90, 89, 89);
            emailText.TextColor  = UIColor.FromRGB(90, 89, 89);
            ageText.TextColor    = UIColor.FromRGB(90, 89, 89);
            genderText.TextColor = UIColor.FromRGB(90, 89, 89);

            nameText.Text  = LoginController.userModel.name;
            emailText.Text = LoginController.userModel.userName;
            ageText.Text   = LoginController.userModel.age.ToString();

            if ("male".Equals(LoginController.userModel.gender) || "female".Equals(LoginController.userModel.gender))
            {
                genderText.Text = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(LoginController.userModel.gender);
                UpdateGenderButtonStatus(LoginController.userModel.gender);
            }
            else
            {
                manButton.Alpha   = 0.3f;
                womanButton.Alpha = 0.3f;
            }

            if (LoginController.userModel.profilePicturePath != null)
            {
                fileName = LoginController.userModel.profilePicturePath;
                Utils.SetImageFromNSUrlSession(fileName, profileImageView, this, PictureType.Profile);
            }
            else
            {
                profileImageView.Image = UIImage.FromBundle("Profile");
            }
            BTProgressHUD.Dismiss();
        }
示例#24
0
        async partial void btnEnter_TouchUpInside(UIKit.UIButton sender)
        {
            BTProgressHUD.Show("Checking your credentials...", -1, ProgressHUD.MaskType.Clear);

            if (string.Empty.Equals(txtUsername.Text))
            {
                BTProgressHUD.Dismiss();
                UIAlertView alert = new UIAlertView()
                {
                    Title   = "E-mail",
                    Message = "Please fill in the E-mail"
                };
                alert.AddButton("OK");
                alert.Show();
            }
            else if (string.Empty.Equals(txtPassword.Text))
            {
                BTProgressHUD.Dismiss();
                var alert = UIAlertController.Create("Password", "Please fill in the Password", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                PresentViewController(alert, true, null);
            }
            else
            {
                try
                {
                    UserLoginModel userLoginModel = new UserLoginModel(txtUsername.Text, txtPassword.Text);

                    tokenModel = await loginManager.GetAuthorizationToken(userLoginModel);

                    userModel = await loginManager.GetUserById(tokenModel.access_token);

                    CredentialsService.SaveCredentials(tokenModel, userModel);

                    Login();
                }
                catch (Exception ex)
                {
                    if (ex.Message.Equals("901"))
                    {
                        var alert = UIAlertController.Create("Login", "The user name or password is incorrect.", UIAlertControllerStyle.Alert);
                        alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                        PresentViewController(alert, true, null);
                    }
                    else if (ex.Message.Equals("903"))
                    {
                        var alert = UIAlertController.Create("Login", "An error occurred while sending the e-mail confirmation.", UIAlertControllerStyle.Alert);
                        alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                        PresentViewController(alert, true, null);
                    }
                    else if (ex.Message.Equals("905"))
                    {
                        var alert = UIAlertController.Create("Login", "The user e-mail is not confirmed. A new e-mail confirmation has been sent to user.", UIAlertControllerStyle.Alert);
                        alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                        PresentViewController(alert, true, null);
                    }
                    else
                    {
                        Utils.HandleException(ex);
                    }

                    BTProgressHUD.Dismiss();
                }
            }
        }
示例#25
0
 public static void ShowToast(string message, bool centered = true, double timeoutMS = 1000)
 {
     BTProgressHUD.ShowToast(message, centered, timeoutMS);
 }
示例#26
0
        public override void LoadView()
        {
            base.LoadView();
            View.BackgroundColor = UIColor.LightGray;

            MakeButton("Run first - off main thread", () =>
            {
                //this must be the first one to run.
                // once BTProgressHUD.ANTYTHING has been called once on the UI thread,
                // it'll be setup. So this is an initial call OFF the main thread.
                // Should except in debug.
                var task = Task.Factory.StartNew(() =>
                {
                    try
                    {
                        BTProgressHUD.Show();
                        KillAfter();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                });
            });

            MakeButton("Show", () =>
            {
                BTProgressHUD.Show();
                KillAfter();
            });

            MakeButton("Cancel problem 3", () =>
                       BTProgressHUD.Show("Cancel", () => KillAfter(), "Cancel and text")
                       );

            MakeButton("Cancel problem 2", () =>
                       BTProgressHUD.Show("Cancel", () => KillAfter())
                       );

            MakeButton("Cancel problem", () =>
                       BTProgressHUD.Show("Cancel", () => KillAfter(), "This is a multilinetext\nSome more text\n more text\n and again more text")
                       );

            MakeButton("Show Message", () =>
            {
                BTProgressHUD.Show("Processing your image", -1, ProgressHUD.MaskType.Black);
                KillAfter();
            });

            MakeButton("Show Success", () =>
            {
                BTProgressHUD.ShowSuccessWithStatus("Great success!");
            });

            MakeButton("Show Fail", () =>
            {
                BTProgressHUD.ShowErrorWithStatus("Oh, thats bad");
            });

            MakeButton("Toast", () =>
            {
                BTProgressHUD.ShowToast("Hello from the toast", showToastCentered: false, timeoutMs: 1000);
            });


            MakeButton("Dismiss", () =>
            {
                BTProgressHUD.Dismiss();
            });

            MakeButton("Progress", () =>
            {
                progress = 0;
                BTProgressHUD.Show("Hello!", progress);
                if (timer != null)
                {
                    timer.Invalidate();
                }
                timer = NSTimer.CreateRepeatingTimer(0.5f, delegate
                {
                    progress += 0.1f;
                    if (progress > 1)
                    {
                        timer.Invalidate();
                        timer = null;
                        BTProgressHUD.Dismiss();
                    }
                    else
                    {
                        BTProgressHUD.Show("Hello!", progress);
                    }
                });
                NSRunLoop.Current.AddTimer(timer, NSRunLoopMode.Common);
            });

            MakeButton("Dismiss", () =>
            {
                BTProgressHUD.Dismiss();
            });
        }
示例#27
0
 public async Task ShowLoading(string message)
 {
     BTProgressHUD.Show(message, -1, ProgressHUD.MaskType.Black);
 }
示例#28
0
 public async Task HideLoading()
 {
     BTProgressHUD.Dismiss();
 }
示例#29
0
 public void ShowToast(string message)
 {
     BTProgressHUD.ShowToast(message, false, 4000);
 }
 public override void ShowSuccess(string message, int timeoutMillis)
 {
     //this.ShowWithOverlay(timeoutMillis, () => BTProgressHUD.ShowSuccessWithStatus(message, timeoutMillis));
     this.ShowWithOverlay(timeoutMillis, () => BTProgressHUD.ShowImage(ProgressHUD.Shared.SuccessImage, message, timeoutMillis));
 }