示例#1
0
        private async void ReportCommentUser()
        {
            nint button = await Utils.ShowAlert("Report Comment User", "The user will be reported. Continue?", "Ok", "Cancel");

            try
            {
                if (button == 0)
                {
                    BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Clear);

                    await new UserManager().BlockUser(LoginController.userModel.id, comment.userId, LoginController.tokenModel.access_token);

                    //comments.Remove(comment);
                    comments = await new CommentManager().GetSurveyComments(this.userId + this.creationDate, LoginController.userModel.id, LoginController.tokenModel.access_token);

                    feed.Source   = new CommentsCollectionViewSource(comments, feedCell, this);
                    feed.Delegate = new CommentsCollectionViewDelegate((float)feedCell.Frame.Height);
                    feed.ReloadData();
                }

                BTProgressHUD.Dismiss();
            }
            catch (Exception ex)
            {
                BTProgressHUD.Dismiss();
                Utils.HandleException(ex);
            }
        }
示例#2
0
        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.ForgotPassword(txtEmail.Text);
                }                        ///
                    ).ContinueWith(
                    t =>
                {
                    if (ResponseCode == 200)
                    {
                        BTProgressHUD.ShowToast("A link was sent on your email address please check your inbox to change  your password.", false, 1000);
                    }
                    else
                    {
                        BTProgressHUD.ShowToast("Please enter a valid email.", false, 1000);
                    }
                    BTProgressHUD.Dismiss();
                }, TaskScheduler.FromCurrentSynchronizationContext()
                    );
            }
            catch (Exception ex)
            {
            }
        }
示例#3
0
        private void Process(SettingsModel sm)
        {
            int ResponseCode = 0;

            try
            {
                BTProgressHUD.Show();
                Task.Factory.StartNew(
                    // tasks allow you to use the lambda syntax to pass wo
                    () =>
                {
                    ResponseCode = WebService.SaveSettings(sm);
                }                        ///
                    ).ContinueWith(
                    t =>
                {
                    if (ResponseCode == 200)
                    {
                        SaveSettings(this, null);
                        BTProgressHUD.ShowToast("Settings Saved successfully.", false, 1000);
                        this.DismissModalViewController(false);
                    }
                    else
                    {
                        BTProgressHUD.ShowToast("Failed to save settings.", false, 1000);
                    }
                    BTProgressHUD.Dismiss();
                }, TaskScheduler.FromCurrentSynchronizationContext()
                    );
            }
            catch (Exception ex)
            {
            }
        }
示例#4
0
        private async void DeleteCommentSelector()
        {
            nint button = await Utils.ShowAlert("Delete Comment", "The comment will be deleted. Continue?", "Ok", "Cancel");

            try
            {
                if (button == 0)
                {
                    BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Clear);

                    await new CommentManager().DeleteSurveyComment(comment, LoginController.tokenModel.access_token);

                    comments.Remove(comment);

                    if (survey.totalComments > 0)
                    {
                        survey.totalComments--;
                    }

                    feedCell.updateTotalComments(survey.totalComments);

                    feed.Source   = new CommentsCollectionViewSource(comments, feedCell, this);
                    feed.Delegate = new CommentsCollectionViewDelegate((float)feedCell.Frame.Height);
                    feed.ReloadData();
                }

                BTProgressHUD.Dismiss();
            }
            catch (Exception ex)
            {
                BTProgressHUD.Dismiss();
                Utils.HandleException(ex);
            }
        }
示例#5
0
 private void GetAttendance()
 {
     try
     {
         BTProgressHUD.Show("Loading...");
         Task.Factory.StartNew(
             // tasks allow you to use the lambda syntax to pass wor
             () =>
         {
             WebService.GetStudentAttendance(StaticDataModel.StudentId);
         }
             ///
             ).ContinueWith(
             t =>
         {
             if (WebService.Holidaylist != null)
             {
                 CreateCalanderView();
             }
             else
             {
             }
             BTProgressHUD.Dismiss();
         }, TaskScheduler.FromCurrentSynchronizationContext()
             );
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
示例#6
0
        public async Task <CustomerResponse> UpdateMail(string email, string userid)
        {
            sw.Start();
            CustomerResponse output = null;

            try
            {
                BTProgressHUD.Show(LoggingClass.txtpleasewait);
                var    uri     = new Uri(ServiceURL + "UpdateEmailAddress/" + email + "/user/" + userid);
                var    content = JsonConvert.SerializeObject(email);
                var    cont    = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
                string Token   = CurrentUser.GetAuthToken();
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Token);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <CustomerResponse>(response);
                BTProgressHUD.Dismiss();
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo(userid + "user updated Service," + email, "Email Service,");
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Email Service,");
            return(output);
        }
示例#7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            locationSwitch.ValueChanged += delegate {
                if (locationSwitch.On)
                {
                    LocationHelper.Instance.StartLocationUpdates();
                    BTProgressHUD.Show("Tracking location");
                }
                else
                {
                    LocationHelper.Instance.StopLocationUpdates();
                    BTProgressHUD.Dismiss();

                    CreateSpreadsheet();
                }
            };

            emailButton.TouchUpInside += (sender, e) => {
                SendMail();
            };

            previewButton.TouchUpInside += (sender, e) => {
                ShowPreview();
            };
        }
示例#8
0
        public void InitializeMyGames()
        {
            BTProgressHUD.Show("Loading Games", -1, ProgressHUD.MaskType.Black);
            var repository = AppDelegate.Repository;

            if (repository != null)
            {
                this.viewModel = new MyGamesViewModel(AppDelegate.Repository);
                this.viewModel.InitializeAsync().ContinueWith((t) => {
                    if (!t.IsFaulted && t.Result)
                    {
                        BeginInvokeOnMainThread(() => {
                            LoadGameControllers();

                            gamesControllers[0].SetData(this.viewModel.MyTurnGames);
                            gamesControllers[1].SetData(this.viewModel.TheirTurnGames);
                            gamesControllers[2].SetData(this.viewModel.CompletedGames);

                            BTProgressHUD.Dismiss();
                        });
                    }

                    // TODO handle error
                });
            }
        }
示例#9
0
        private void PublicarPost()
        {
            BTProgressHUD.Show();

            byte[] Fotografia;
            if (ImagenPublicacion != null)
            {
                Fotografia = ImagenPublicacion?.AsPNG().ToArray();
            }
            else
            {
                Fotografia = new byte[0];
            }

            if (InternetConectionHelper.VerificarConexion())
            {
                if (new Controllers.EscritorioController().SetPost(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), txtPublicacion.Text, Fotografia))
                {
                    this.PostPublicadoDelegate.PostPublicado();
                    this.SendMessage();
                    this.DismissViewController(true, null);
                    BTProgressHUD.Dismiss();
                }
                else
                {
                    BTProgressHUD.Dismiss();
                    new MessageDialog().SendToast("No pudimos publicar tu mensaje, intenta de nuevo");
                }
            }
            else
            {
                BTProgressHUD.Dismiss();
                new MessageDialog().SendToast("No tienes conexión a internet, intenta de nuevo");
            }
        }
示例#10
0
using System;
using UIKit;
//using PerpetualEngine.Storage;
using WorklabsMx.Controllers;
using System.Collections.Generic;
using Foundation;
using System.Text.RegularExpressions;
using WorklabsMx.iOS.Helpers;
using BigTed;
using System.Threading.Tasks;
using Plugin.FirebasePushNotification;

namespace WorklabsMx.iOS
{
    public partial class LoginViewController : UIViewController
    {
        String EmailRegex = "";
        String PassWordRegex = "";

        String LongitudEmail = "";
        String LongitudPassword = "";

        //Constructor
        public LoginViewController(IntPtr handle) : base(handle)
        {
         
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.TestPush();
            UIView statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView;
            if (statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:")))
            {
                statusBar.BackgroundColor = UIColor.Black;
            }
            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
            this.txtEmail.AttributedPlaceholder = new NSAttributedString("Ingresa tu correo electrónico", null, UIColor.Clear.FromHex(0xFEEC64));
            this.txtPassword.AttributedPlaceholder = new NSAttributedString("Ingresa tu contraseña", null, UIColor.Clear.FromHex(0xFEEC64));

            NavigationItem.Title = "Iniciar Sesión";
            //var localStorage = SimpleStorage.EditGroup("Login");

            EmailRegex = KeyChainHelper.GetKey("EmailRegex");
            PassWordRegex = KeyChainHelper.GetKey("PasswordRegex");
            LongitudEmail = KeyChainHelper.GetKey("LongitudEmail");
            LongitudPassword = KeyChainHelper.GetKey("LongitudPassword");

            KeyChainHelper.DeleteKey("Usuario_Id");
            KeyChainHelper.DeleteKey("Usuario_Tipo");

            StyleHelper.Style(txtEmail.Layer);
            StyleHelper.Style(txtPassword.Layer);
            StyleHelper.Style(btnIniciarSesion.Layer);
            StyleHelper.Style(btnRegistro.Layer);
    
        }

        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            this.EventosTecladoTextfileds();
            this.LimiteCaracteresTextFields(this.txtEmail, int.Parse(LongitudEmail));
            this.LimiteCaracteresTextFields(this.txtPassword, int.Parse(LongitudPassword));
            this.btnRecuperar.Enabled = false;
            this.btnRecuperar.Hidden = true;
        }


        private void TestPush()
        {
            CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) =>
            {
                System.Diagnostics.Debug.WriteLine($"TOKEN : {p.Token}");
            };

            CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
            {

                System.Diagnostics.Debug.WriteLine("Received");

            };

            CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) =>
            {
                System.Diagnostics.Debug.WriteLine("Opened");
                foreach (var data in p.Data)
                {
                    System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}");
                }

                if (!string.IsNullOrEmpty(p.Identifier))
                {
                    System.Diagnostics.Debug.WriteLine($"ActionId: {p.Identifier}");
                }

            };
        }

        void NavigateToTabbed()
        {
            InvokeOnMainThread(() =>
                {
                    var app = (AppDelegate)UIApplication.SharedApplication.Delegate;
                    app.Window.RootViewController = UIStoryboard.FromName("Main", null)
                    .InstantiateViewController("NavEscritorio")
                    as UIViewController;
                });
        }

        /* Acciona eventos para los textfields de ocultar teclado en patalla cuando se presiona la tecla intro, y en le caso de el textfield de contraseña
         se procede a iniciar sesion cuando se presiona la tecla intro */
        private void EventosTecladoTextfileds() 
        {
           this.txtEmail.ShouldReturn += (textField) => {
             this.txtPassword.BecomeFirstResponder();
               return true;
           } ;

           this.txtPassword.ShouldReturn += (textField) => {
              this.AccionIniciarSesion();
                textField.ResignFirstResponder();
              return true;
           } ;
        }


        //Evento que se ejecuta cuando se toca la pantalla, despues procede a ocultar el teclado
       public override void TouchesBegan(NSSet touches, UIEvent evt)
       {
          base.TouchesBegan(touches, evt);
           UITouch touch = touches.AnyObject as UITouch;
          if (touch != null)
         {
              View.EndEditing(true);
         }
      }

        /* Metodo que realiza el inicio de sesion, se ejecuta cuando el usuario presiona el boton de iniciar sesion o cuando el usuario la tecla intro mientras esta posicionado
         en el cuadro de texto de la contraseñ */
        private async void AccionIniciarSesion()
        {
            View.EndEditing(true);
            BTProgressHUD.Show(status: "Iniciando sesión");
            await Task.Delay(2000);
            if (InternetConectionHelper.VerificarConexion())
            {
                List<string> MiembrosId =  new LoginController().MemberLogin(this.txtEmail.Text, this.txtPassword.Text);

                bool EmailEsValido = this.ElTextoEsValido(this.txtEmail, EmailRegex);
                bool PasswordEsValido = this.ElTextoEsValido(this.txtPassword, PassWordRegex);

                if (/*PasswordEsValido &&*/ EmailEsValido)
                {
                    if (MiembrosId.Count > 0)
                    {
                        KeyChainHelper.SetKey("Usuario_Id", MiembrosId[0]);
                        KeyChainHelper.SetKey("Usuario_Tipo", MiembrosId[1]);
                        MenuHelper.GetUsuarioInfo();
                        BTProgressHUD.Dismiss();
                        NavigateToTabbed();
                    }
                    else
                    {
                        BTProgressHUD.Dismiss();
                        new MessageDialog().SendToast("Asegurese de que el Correo y/o contraseña sean los correctos");
                    }
                }
                else
                {
                    BTProgressHUD.Dismiss();
                    new MessageDialog().SendToast("Asegurese de que el Correo y/o contraseña tengan el formato correcto");
                }

            }
            else
            {
                BTProgressHUD.Dismiss();
                new MessageDialog().SendToast("No tienes acceso a una conexión de Internet");
            }
      }

        //Define el limite de caracteres a escribir en cada cuadro de texto de esta pantalla
        private void LimiteCaracteresTextFields(UITextField TextField, int LongitudMaxima) 
        {
          TextField.ShouldChangeCharacters = (textField, range, replacementString) =>
            {
              var newLength = textField.Text.Length + replacementString.Length - range.Length;
               return newLength <= LongitudMaxima;
            } ;
        }

        private Boolean ElTextoEsValido(UITextField TextField, String RegularExpr) 
        {
            bool EsValido = Regex.IsMatch(TextField.Text, RegularExpr);
            return EsValido;
        }

        // Cuando se toca el boton iniciar sesion se desancadena este evento
        partial void BtnIniciarSesion_TouchUpInside(UIButton sender)
        {
            this.AccionIniciarSesion();
        }

        partial  void BtnRestaurar_TouchUpInside(UIButton sender)
        {

            string miembro = new LoginController().ValidateMember(txtEmailRecuperar.Text);
            if (miembro.Length > 0)
            {
                //var result = new Emails().SendMail(txtEmailRecuperar.Text, miembro, new PassSecurity().GeneraIdentifier());

            }
        }

        partial void BtnRegistro_TouchUpInside(UIButton sender) =>
            UIApplication.SharedApplication.OpenUrl(new NSUrl("http://worklabs.mx"));


    }
}


        private async Task RemoveFromBlackListAsync(long id)
        {
            try
            {
                BTProgressHUD.Show("UnBlocked Contacts", maskType: ProgressHUD.MaskType.Black);
                var model = new userdetails
                {
                    BlockUserID = id
                };

                var result = await new SettingService().PostUnBlockUserInterest(model);
                if (result.Status == 1)
                {
                    ChatConversationRepository.UpdateUnBlock(chatConversation.ChatId);
                    new UIAlertView("Blocked Contacts", result.Message, null, "OK", null).Show();
                    BTProgressHUD.Dismiss();
                }
                else
                {
                    new UIAlertView("Blocked Contacts", result.Message, null, "OK", null).Show();
                    BTProgressHUD.Dismiss();
                }

                BTProgressHUD.Dismiss();
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
                BTProgressHUD.Dismiss();
            }
        }
示例#12
0
 public void Hide()
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         BTProgressHUD.Dismiss();
     });
 }
示例#13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.Title = "Employee";

            var btnSave = new UIButton(UIButtonType.Custom);

            btnSave.SetBackgroundImage(UIImage.FromBundle("Save"), UIControlState.Normal);
            btnSave.Frame          = new CGRect(0, 0, 19, 19);
            btnSave.TouchUpInside += async(sender, e) =>
            {
                BTProgressHUD.Show("Loading", -1, ProgressHUD.MaskType.Black);
                EmployeeInfo emp = new EmployeeInfo();
                emp.Name = TxtEmployeeName.Text;
                emp.DOB  = Convert.ToDateTime(TxtEmployeeDOB.Text);
                emp.Age  = Convert.ToInt32(TxtEmployeeAge.Text);
                var azureService = new AzureService();
                await azureService.InsertEmployee(emp);

                this.NavigationController.PopViewController(true);
                BTProgressHUD.Dismiss();
            };
            this.NavigationItem.SetRightBarButtonItem(null, true);
            this.NavigationItem.SetRightBarButtonItem(
                new UIBarButtonItem(btnSave), true);
        }
        async void OnFetchDataTap(object sender, EventArgs e)
        {
            InitialiseChart();

            BTProgressHUD.Show("Fetching data");

            var data = await GetDataAsync();

            // set data source
            var barSeriesSource = new IGCategorySeriesDataSourceHelper();

            barSeriesSource.Values = data.ProductSales.ToArray();
            barSeriesSource.Labels = data.ProductName.ToArray();

            // Create axis types and add it to the chart
            var xAxisBar = new IGNumericXAxis("xAxis");
            var yAxisBar = new IGCategoryYAxis("yAxis");

            yAxisBar.LabelAlignment = IGHorizontalAlign.IGHorizontalAlignRight;

            chart.AddAxis(xAxisBar);
            chart.AddAxis(yAxisBar);

            // decide on what series need to be displayed on the chart
            var barSeries = new IGBarSeries("series");

            barSeries.XAxis = xAxisBar;
            barSeries.YAxis = yAxisBar;

            // set the appropriate data sources
            barSeries.DataSource = barSeriesSource;
            chart.AddSeries(barSeries);

            BTProgressHUD.Dismiss();
        }
示例#15
0
        public static IDisposable SubscribeStatus(this IObservable <bool> @this, string message)
        {
            var hud     = new Hud(null);
            var isShown = false;

            var d = @this.Subscribe(x => {
                if (x && !isShown)
                {
                    hud.Show(message);
                }
                else if (!x && isShown)
                {
                    hud.Hide();
                }
                isShown = x;
            }, err => {
                BTProgressHUD.ShowErrorWithStatus(err.Message);
                isShown = false;
            }, () => {
                if (isShown)
                {
                    BTProgressHUD.Dismiss();
                }
            });

            var d2 = Disposable.Create(() =>
            {
                if (isShown)
                {
                    BTProgressHUD.Dismiss();
                }
            });

            return(new CompositeDisposable(d, d2));
        }
示例#16
0
		public void AddNavigationButtons(UINavigationController nav)
		{
			UIImage profile = UIImage.FromFile("profile.png");
			profile = ResizeImage(profile, 25, 25);

			UIImage info = UIImage.FromFile("Info.png");
			info = ResizeImage(info, 25, 25);

			var topBtn = new UIBarButtonItem(profile, UIBarButtonItemStyle.Plain, (sender, args) =>
				{
					BTProgressHUD.Show("Loading,,,");
					//nav.PushViewController(new ProfileViewController(nav), false);
					nav.PushViewController(new proview(nav), false);
					nav.NavigationBar.TopItem.Title = "Profile";
					//BTProgressHUD.Dismiss();
				});
			var optbtn = new UIBarButtonItem(info, UIBarButtonItemStyle.Plain, (sender, args) =>
			{
				BTProgressHUD.Show("Loading,,,");
				nav.PushViewController(new AboutController1(nav), false);
				nav.NavigationBar.TopItem.Title = "About Us";
				BTProgressHUD.Dismiss();
			});
			nav.NavigationBar.TopItem.SetRightBarButtonItem(optbtn, true);
			nav.NavigationBar.TopItem.SetLeftBarButtonItem(topBtn, true);
		}
示例#17
0
        #pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        private async void geoCodeLocation(string location)
        #pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void

        {
            NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus();

            if (remoteHostStatus == NetworkStatus.NotReachable)
            {
                var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(alert, animated: true, completionHandler: null);

                return;
            }

            BTProgressHUD.Show("Searching Branches...", -1, ProgressHUD.MaskType.Black);

            //AsyncGeocodeLocation
            ServiceManager jobService = new ServiceManager();

            string latLong = await jobService.AsyncGeocodeLocation(location);

            Console.WriteLine(latLong);

            if (!string.IsNullOrEmpty(latLong))
            {
                // validate request first then start searching
                this.getBranchList();
            }
            else
            {
                BTProgressHUD.Dismiss();
            }
        }
示例#18
0
        async void Login(string username, string password)
        {
            BTProgressHUD.Show("Logging in...");

            var success = await WebService.Shared.Login(username, password);

            if (success)
            {
                var canContinue = await WebService.Shared.PlaceOrder(WebService.Shared.CurrentUser, true);

                if (!canContinue.Success)
                {
                    new UIAlertView("Sorry", "Only one shirt per person. Edit your cart and try again.", null, "OK").Show();
                    BTProgressHUD.Dismiss();
                    return;
                }
            }

            BTProgressHUD.Dismiss();

            if (success)
            {
                LoginSucceeded();
            }
            else
            {
                var alert = new UIAlertView("Could Not Log In", "Please verify your Xamarin account credentials and try again", null, "OK");
                alert.Show();
                alert.Clicked += delegate {
                    LoginView.PasswordField.SelectAll(this);
                    LoginView.PasswordField.BecomeFirstResponder();
                };
            }
        }
示例#19
0
        void OnViewModelPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            InvokeOnMainThread(() => {
                switch (e.PropertyName)
                {
                case SignUpViewModel.ValidatePinEnabledPropertyName:
                    ContinueBtn.Enabled = ViewModel.ValidatePinEnabled;
                    SausageButtons.UpdateBackgoundColor(ContinueBtn);
                    break;

                case BaseViewModel.IsBusyPropertyName:
                    if (ViewModel.IsBusy)
                    {
                        BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Black);
                    }
                    else
                    {
                        BTProgressHUD.Dismiss();
                    }
                    break;

                case SignUpViewModel.CanProgressPropertyName:
                    if (ViewModel.CanProgress)
                    {
                        GoToMainScreen();
                    }
                    break;
                }
            });
        }
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var azureService = new AzureService();
            var data         = await azureService.GetEmployee(Constants.Id);

            if (data != null)
            {
                TxtEmployeeName.Text = data.Name;
                TxtEmployeeDOB.Text  = data.DOB.ToShortDateString();
                TxtEmployeeAge.Text  = Convert.ToString(data.Age);
            }

            var btnUpdate = new UIButton(UIButtonType.Custom);

            btnUpdate.SetBackgroundImage(UIImage.FromBundle("Save"), UIControlState.Normal);
            btnUpdate.Frame          = new CGRect(0, 0, 19, 19);
            btnUpdate.TouchUpInside += async(sender, e) =>
            {
                BTProgressHUD.Show("Loading", -1, ProgressHUD.MaskType.Black);
                EmployeeInfo emp = new EmployeeInfo();
                emp.Id   = data.Id;
                emp.Name = TxtEmployeeName.Text;
                emp.DOB  = Convert.ToDateTime(TxtEmployeeDOB.Text);
                emp.Age  = Convert.ToInt32(TxtEmployeeAge.Text);
                await azureService.UpdateEmployee(emp);

                this.NavigationController.PopViewController(true);
                BTProgressHUD.Dismiss();
            };
            this.NavigationItem.SetRightBarButtonItem(null, true);
            this.NavigationItem.SetRightBarButtonItem(
                new UIBarButtonItem(btnUpdate), true);
        }
示例#21
0
        protected async void fetchTableItems()
        {
            try
            {
                fetchedTableItems = new List <ProfileTableItem>();

                if (ProfileType.ListFriends.Equals(profileType))
                {
                    var userFriends = await new FriendManager().GetFriends(LoginController.userModel.id, LoginController.tokenModel.access_token);

                    foreach (var user in userFriends)
                    {
                        fetchedTableItems.Add(new ProfileTableItem(user.id, user.name, user.profilePicture));
                    }
                }
                else if (ProfileType.ListGroups.Equals(profileType))
                {
                    var userGroups = await new UserGroupManager().GetGroups(LoginController.userModel.id, LoginController.tokenModel.access_token);

                    foreach (var group in userGroups)
                    {
                        fetchedTableItems.Add(new ProfileTableItem(group.userId + group.creationDate, group.name, group.profilePicture));
                    }
                }
                else if (ProfileType.ListGroupMembers.Equals(profileType))
                {
                    var groupMembers = await new UserGroupManager().GetGroupMembers(LoginController.tokenModel.access_token, groupId);

                    foreach (var member in groupMembers)
                    {
                        fetchedTableItems.Add(new ProfileTableItem(member.id, member.name, member.profilePicture));
                    }
                }

                tableItems = fetchedTableItems;
            }
            catch (Exception ex)
            {
                Utils.HandleException(ex);
            }

            BTProgressHUD.Dismiss();

            if (tableItems.Count > 0)
            {
                TableView.BackgroundView = null;
                TableView.ReloadData();
            }
            else
            {
                if (ProfileType.ListFriends.Equals(profileType))
                {
                    TableView.BackgroundView = Utils.GetSystemWarningImage("MyFriendsEmpty");
                }
                else if (ProfileType.ListGroups.Equals(profileType))
                {
                    TableView.BackgroundView = Utils.GetSystemWarningImage("MyGroupsEmpty");
                }
            }
        }
        public override void ViewWillAppear(bool animated)
        {
            InvokeOnMainThread(() =>
            {
                base.ViewWillAppear(animated);
                BTProgressHUD.Show("Loading Image", maskType: ProgressHUD.MaskType.Black);
                scrollView = new UIScrollView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
                View.AddSubview(scrollView);
                image     = ImageClass.FromUrl(filepath);
                imageView = new UIImageView(image);
                scrollView.ContentSize = imageView.Image.Size;
                scrollView.AddSubview(imageView);

                scrollView.MaximumZoomScale            = 3f;
                scrollView.MinimumZoomScale            = .1f;
                scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return(imageView); };

                UITapGestureRecognizer doubletap = new UITapGestureRecognizer(OnDoubleTap)
                {
                    NumberOfTapsRequired = 2 // double tap
                };

                scrollView.AddGestureRecognizer(doubletap); // detect when the scrollView is double-tapped
                scrollView.SetZoomScale(0.25f, true);

                BTProgressHUD.Dismiss();
            });
        }
示例#23
0
 private async void GetContactNo()
 {
     try
     {
         BTProgressHUD.Show();
         Task.Factory.StartNew(
             // tasks allow you to use the lambda syntax to pass wor
             () =>
         {
             ContactNo = WebService.GetContactNo();
         }).ContinueWith(
             t =>
         {
             if (ContactNo != string.Empty)
             {
             }
             else
             {
                 BTProgressHUD.ShowToast("Unable to fetch contact details.", false, 1000);
             }
             BTProgressHUD.Dismiss();
         }, TaskScheduler.FromCurrentSynchronizationContext()
             );
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
        public async void BlockContact(long id)
        {
            BTProgressHUD.Show("Block Contact", maskType: ProgressHUD.MaskType.Black);
            var model = new userdetails
            {
                BlockUserID = id
            };

            var result = await new SettingService().PostBlockUserInterest(model);

            if (result.Status == 1)
            {
                lblBlockUser.Text = "UnBlock";
                ChatConversationRepository.UpdateBlock(contactViewModel.ChatConvId);
                BTProgressHUD.Dismiss();
                new UIAlertView("Block Contact", result.Message, null, "OK", null).Show();
            }
            else
            {
                BTProgressHUD.Dismiss();
                new UIAlertView("Block Contact", result.Message, null, "OK", null).Show();
            }

            BTProgressHUD.Dismiss();
        }
示例#25
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("Searching");
                    var person = await Service.Instance.FindSimilarFace(result.GetStream());

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

                    BTProgressHUD.ShowSuccessWithStatus(person.Name);
                }
                catch {
                    BTProgressHUD.Dismiss();
                }
            }
        }
示例#26
0
        private void SendEventToServer(Feature eventObj)
        {
            Task.Run(async() =>
            {
                try
                {
                    Feature featureCreated;

                    if (EditFeature == null)
                    {
                        // Create Event
                        featureCreated = await AysaClient.Instance.CreateFeature(eventObj);
                    }
                    else
                    {
                        // Update Event
                        featureCreated = await AysaClient.Instance.UpdateFeature(EditFeature.Id, eventObj);
                    }

                    InvokeOnMainThread(() =>
                    {
                        if (EditFeature != null)
                        {
                            // Send filter to EventsViewController to get events by filter
                            if (_delegate != null)
                            {
                                Delegate?.FeatureWasUpdated(featureCreated);
                            }
                        }

                        string successMsj = EditFeature == null ? "La novedad ha sido creado con éxito" : "La novedad ha sido modificado con éxito";
                        BTProgressHUD.ShowImage(UIImage.FromBundle("ok_icon"), successMsj, 2000);
                        PerformSelector(new Selector("PopViewController"), null, 2.0f);
                    });
                }
                catch (HttpUnauthorized)
                {
                    InvokeOnMainThread(() =>
                    {
                        // Remove progress
                        BTProgressHUD.Dismiss();

                        ShowSessionExpiredError();
                    });
                }
                catch (Exception ex)
                {
                    InvokeOnMainThread(() =>
                    {
                        // Remove progress
                        BTProgressHUD.Dismiss();

                        ShowErrorAlert(ex.Message);

                        CountAttachmentsUploaded = 0;
                    });
                }
            });
        }
示例#27
0
        public override void LoadView()
        {
            base.LoadView();
            View.BackgroundColor = UIColor.LightGray;

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

            MakeButton("Show Message", () => {
                BTProgressHUD.Show(status: "Processing your image");
                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);
            });


            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();
            });
        }
示例#28
0
 public void ShowSearch()
 {
     BTProgressHUD.Dismiss ();
     search = new SearchScreen ();
     RootController.NavigationBarHidden = true;
     RootController.ToolbarHidden = true;
     RootController.PushViewController (search, true);
 }
示例#29
0
 public void ShowForgotPassword()
 {
     BTProgressHUD.Dismiss ();
     forgot = new PasswordResetController ();
     RootController.NavigationBarHidden = true;
     RootController.ToolbarHidden = true;
     RootController.PushViewController (forgot, true);
 }
示例#30
0
 public void ShowPriceEdmunds(Pricing price)
 {
     BTProgressHUD.Dismiss ();
     priceTab = new PriceTabController (price);
     RootController.NavigationBarHidden = false;
     RootController.ToolbarHidden = true;
     RootController.PushViewController (priceTab, true);
 }