示例#1
0
        public override async void ViewDidLoad()
        {
            try
            {
                await goods.GetNext();

                await OrderController.GetInstance();

                source = new GoodsSource(goods.List);
                source.RemoveKeyboard += Source_RemoveKeyboard;
                GoodsTableView.Source  = source;
                GoodsTableView.ReloadData();
                ActivityIndicator.StopAnimating();
                this.source.UploadNextItems += async(s, e) =>
                {
                    if (isAsyncUpdateAlowed)
                    {
                        isAsyncUpdateAlowed = false;
                        ActivityIndicator.StartAnimating();

                        if (await goods.GetNext())
                        {
                            GoodsTableView.ReloadData();
                        }

                        ActivityIndicator.StopAnimating();

                        isAsyncUpdateAlowed = true;
                    }
                };

                this.DrugSearchBar.SearchButtonClicked += async(object sender, EventArgs e) =>
                {
                    ActivityIndicator.StartAnimating();
                    this.DrugSearchBar.ResignFirstResponder();
                    List <Goods> search = await goods.Search((sender as UISearchBar).Text);

                    ActivityIndicator.StopAnimating();
                    GoodsSource sou = new GoodsSource(search);
                    sou.RemoveKeyboard   += Source_RemoveKeyboard;
                    GoodsTableView.Source = sou;
                    GoodsTableView.ReloadData();
                };

                this.DrugSearchBar.TextChanged += (object sender, UISearchBarTextChangedEventArgs e) =>
                {
                    if (String.IsNullOrWhiteSpace(e.SearchText))
                    {
                        this.DrugSearchBar.ResignFirstResponder();
                        GoodsTableView.Source = source;
                        GoodsTableView.ReloadData();
                    }
                };
            }
            catch
            {
                ActivityIndicator.StopAnimating();
                PresentViewController(GetAlertsClass.GetAlert("Не удалось подключиться к серверу"), true, null);
            }
        }
示例#2
0
        void Reload()
        {
            bool    updateEnabled = false;
            DBError error;

            if (File.Status.Cached)
            {
                if (!TextViewLoaded)
                {
                    TextViewLoaded = true;
                    string contents = File.ReadString(out error);
                    TextView.Text = contents;
                }
                ActivityIndicator.StopAnimating();
                TextView.Hidden = false;

                if (File.NewerStatus != null && File.NewerStatus.Cached)
                {
                    updateEnabled = true;
                }
            }
            else
            {
                ActivityIndicator.StartAnimating();
                TextView.Hidden = true;
            }
            NavigationItem.RightBarButtonItem.Enabled = updateEnabled;
        }
        public override void ViewDidLoad()
        {
            _didShowNotificationObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, KeyBoardDidShow, this);

            _willHideNotificationObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, KeyBoardWillHide, this);

            ActivityIndicator.StopAnimating();

            this.LoginField.ShouldReturn       += (textField) => textField.ResignFirstResponder();
            this.PasswordField.ShouldReturn    += (textField) => textField.ResignFirstResponder();
            this.AdressField.ShouldReturn      += (textField) => textField.ResignFirstResponder();
            this.PhoneNumberField.ShouldReturn += (textField) => textField.ResignFirstResponder();

            this.View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                LoginField.ResignFirstResponder();
                PasswordField.ResignFirstResponder();
                AdressField.ResignFirstResponder();
                PhoneNumberField.ResignFirstResponder();
            }));

            RegistrationButton.TouchUpInside += async(sender, e) =>
            {
                Customers registrationFieldsForAsync = new Customers()
                {
                    Name = LoginField.Text, Password = PasswordField.Text, Adress = AdressField.Text, PhoneNumber = PhoneNumberField.Text
                };
                ActivityIndicator.StartAnimating();
                try
                {
                    RegistrationButton.Enabled = false;
                    LoginAndPasswordCheck.LoginCheck(registrationFieldsForAsync.Name);
                    LoginAndPasswordCheck.PasswordCheck(registrationFieldsForAsync.Password);
                    LoginAndPasswordCheck.AdressCheck(registrationFieldsForAsync.Adress);
                    LoginAndPasswordCheck.PhoneCheck(registrationFieldsForAsync.PhoneNumber);
                    await UsersCheckClass.TryToRegister(registrationFieldsForAsync);

                    AppDelegate.UserName = registrationFieldsForAsync.Name;
                    PerformSegue("RegistrationSegue", null);
                }
                catch (FiledsCheckException e1)
                {
                    ActivityIndicator.StopAnimating();
                    RegistrationButton.Enabled = true;
                    PresentViewController(GetAlertsClass.GetAlert(e1.Message), true, null);
                }
                catch (UserCheckClassException e1)
                {
                    ActivityIndicator.StopAnimating();
                    RegistrationButton.Enabled = true;
                    PresentViewController(GetAlertsClass.GetAlert(e1.Message), true, null);
                }
                catch
                {
                    ActivityIndicator.StopAnimating();
                    RegistrationButton.Enabled = true;
                    PresentViewController(GetAlertsClass.GetAlert("Не удалось подключиться к серверу"), true, null);
                }
            };
        }
示例#4
0
        private void OnGoButtonTapped(object sender, EventArgs args)
        {
            GoButton.Hidden = true;
            FacebookButton.UserInteractionEnabled = false;
            TwitterButton.UserInteractionEnabled  = false;
            ActivityIndicator.Alpha = 1;
            ActivityIndicator.StartAnimating();

            ViewModel.GoCommand.Execute(null);
        }
 private async Task PerformSearch()
 {
     try
     {
         ActivityIndicator.StartAnimating();
         Grid.BecomeFirstResponder();
         await _dataCollection.SearchAsync(SearchField.Text);
     }
     finally
     {
         ActivityIndicator.StopAnimating();
     }
 }
 partial void StartStopAction(Foundation.NSObject sender)
 {
     // Take action based on the Activity Indicator state
     if (ActivityIndicator.IsAnimating)
     {
         StartStopButton.SetTitle("Start", UIControlState.Normal);
         ActivityIndicator.StopAnimating();
     }
     else
     {
         StartStopButton.SetTitle("Stop", UIControlState.Normal);
         ActivityIndicator.StartAnimating();
     }
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ActivityIndicator.Hidden = true;

            // Perform any additional setup after loading the view, typically from a nib.
            LoginButton.TouchUpInside += async(s, e) => {
                LoginButton.Hidden       = true;
                ActivityIndicator.Hidden = false;
                ActivityIndicator.StartAnimating();

                var authorization = new LocalBoxAuthorization(PleioUrl);

                var result = await authorization.Authorize(LoginField.Text, PasswordField.Text);

                if (result)
                {
                    var business = new BusinessLayer();

                    if (DataLayer.Instance.GetLocalBoxesSync().Count == 0)
                    {
                        await business.RegisterLocalBox(PleioUrl);

                        this._home.InitialiseMenuAfterRegistration();
                    }

                    this.View.RemoveFromSuperview();

                    // show (second) site-selection screen
                    if (_introduction)
                    {
                        var sites = new AddSitesViewController(_home, true);
                        sites.View.BackgroundColor = UIColor.FromRGB(14, 94, 167);
                        _home.View.Add(sites.View);
                        _home.AddChildViewController(sites);
                    }
                }
                else
                {
                    LoginButton.Hidden       = false;
                    ActivityIndicator.Hidden = true;
                    ActivityIndicator.StopAnimating();

                    var alert = UIAlertController.Create("Fout", "Gebruikersnaam of wachtwoord is onjuist.", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, null));
                    PresentViewController(alert, animated: true, completionHandler: null);
                }
            };
        }
        public override async void ViewDidAppear(bool didAppear)
        {
            ActivityIndicator.Hidden = false;
            ActivityIndicator.StartAnimating();

            // Perform any additional setup after loading the view, typically from a nib.
            if (DataLayer.Instance.GetLocalBoxesSync().Count > 0)
            {
                var remoteExplorer = new RemoteExplorer();

                try {
                    List <Site> sites = await remoteExplorer.GetSites();

                    foreach (LocalBox box in DataLayer.Instance.GetLocalBoxesSync())
                    {
                        for (int i = 0; i < sites.Count; i++)
                        {
                            if (box.BaseUrl == sites [i].Url)
                            {
                                sites.RemoveAt(i);
                                break;
                            }
                        }
                    }

                    ActivityIndicator.StopAnimating();
                    ActivityIndicator.Hidden = true;

                    _tableSource     = new TableSource(sites);
                    TableView.Source = _tableSource;
                    TableView.ReloadData();

                    if (sites.Count == 0)
                    {
                        GeenSites.Hidden = false;

                        if (_introduction)
                        {
                            ToevoegenButton.SetTitle("Verder", UIControlState.Normal);
                        }
                    }
                } catch (Exception ex) {
                    Insights.Report(ex);
                    DialogHelper.ShowErrorDialog("Fout", "Er is een fout opgetreden tijdens het ophalen van de sites.");
                }
            }
        }
示例#9
0
        private void ToggleNotificationVisibility(bool showing)
        {
            InvokeOnMainThread(() =>
            {
                notificationShowing = showing;

                if (showing)
                {
                    ActivityIndicator.StartAnimating();
                }
                else
                {
                    ActivityIndicator.StopAnimating();
                }

                StatusLabelGroup.Hidden = !showing;
            });
        }
示例#10
0
        async Task <bool> Authenticate(string accessToken)
        {
            if (String.IsNullOrEmpty(accessToken))
            {
                return(false);
            }
            ActivityIndicator?.StartAnimating();
            //ProgressDialog progress;
            //progress = ProgressDialog.Show(this, Resources.GetString(Resource.String.Authenticating),
            //							   Resources.GetString(Resource.String.PleaseWait), true);
            var cliente = GitHubClientFactory.CreateClient(accessToken);
            var authed  = await _storage.SetClient(cliente);

            System.Diagnostics.Debug.WriteLine("Authenticate");
            if (authed)
            {
                await _storage.SaveToken(accessToken);
            }

            ActivityIndicator?.StopAnimating();
            return(authed);
        }
示例#11
0
        void InitUI()
        {
            // Adjust constraints as needed
            PhotoImageViewHeightConstraint.Constant = ViewModel.ShowImage ? _photoImageViewDefaultHeightConstraint : 0;

            // Map values to UI elements
            BodyTextView.Text = null;
            BodyTextView.Text = ViewModel.Text;
            BodyTextViewHeightConstraint.Constant = BodyTextView.SizeThatFits(new CGSize(BodyTextView.Frame.Width, nfloat.MaxValue)).Height;
            TimeLabel.Text = ViewModel.ShowDateTime ? ViewModel.DisplayDateTime : string.Empty;
            NameLabel.SetHighlightText(ViewModel.UserName, ViewModel.UserName.IndexOf("@"), UIColor.LightGray);

            LikeButton.SetTitle(ViewModel.LikeButtonText, UIControlState.Normal);
            LikeButton.SetTitleColor(ViewModel.LikeButtonTextColor.ToUIColor(), UIControlState.Normal);

            CommentButton.SetTitle(ViewModel.CommentButtonText, UIControlState.Normal);
            CommentButton.SetTitleColor(ViewModel.CommentButtonTextColor.ToUIColor(), UIControlState.Normal);

            ShareButton.SetTitle(ViewModel.ShareButtonText, UIControlState.Normal);
            ShareButton.SetTitleColor(ViewModel.ShareButtonTextColor.ToUIColor(), UIControlState.Normal);

            if (ViewModel.ShowImage)
            {
                ActivityIndicator.StartAnimating();
            }
            else
            {
                ActivityIndicator.StopAnimating();
            }

            SocialTypeImageView.Image  = UIImage.FromBundle(ViewModel.SocialMediaImage);
            SocialTypeImageView.Hidden = !ViewModel.ShowSocialMediaImage;
            UserImageView.SetImage(
                url: new NSUrl(ViewModel.UserImageUrl),
                placeholder: UIImage.FromBundle(ViewModel.UserImagePlaceholder)
                );

            if (ViewModel.ShowImage)
            {
                PhotoImageView.SetImage(
                    url: new NSUrl(ViewModel.ImageUrl),
                    completionHandler: ((UIImage image, NSError error, SDImageCacheType cacheType, NSUrl imageUrl) => {
                    ActivityIndicator.StopAnimating();
                })
                    );
            }
            else
            {
                PhotoImageView.Image = null;
            }

            if (ViewModel.ShowTimeline)
            {
                ContainerViewLeadingConstraint.Constant = _containerViewTimelineLeadingConstraint;
                TimelineView.Hidden = false;
            }
            else
            {
                ContainerViewLeadingConstraint.Constant = _containerViewDefaultLeadingConstraint;
                TimelineView.Hidden = true;
            }

            CommentButton.Hidden = !ViewModel.ShowCommentButton;
            ShareButton.Hidden   = !ViewModel.ShowShareButton;

            // TODO: Remove this when we're ready to support sharing
            ShareButton.Hidden = true;
        }
示例#12
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     ActivityIndicator.StartAnimating();
 }
示例#13
0
        void InitializeDatabase()
        {
            //BusyIndicator.Hidden = false;
            ActivityIndicator.StartAnimating();
            TableSource.FlightList.Clear();
            tableView.ReloadData();


            var fireBaseHelper = new FireBaseHelper();

            fireBaseHelper.StartFlightFromStationObserver(UpdateTableData, DeleteTableDate,
                                                          ActiveStation.Key,
                                                          _startTime, _endTime);


            //var rootNode = Firebase.Database.Database.DefaultInstance.GetRootReference();
            //var childNode = rootNode.GetChild("station").GetChild(ActiveStation.Key).GetChild("flights");
            //                       /* .GetQueryOrderedByChild("EpochTime")
            //                        .GetQueryStartingAtValue(NSObject.FromObject(_startTime.GetUnixEpoch()))
            //                        .GetQueryEndingAtValue(NSObject.FromObject(_endTime.GetUnixEpoch()));*/

            //var referenceNode = childNode.ObserveEvent(DataEventType.ChildAdded, (snapshot, prevKey) =>
            //{
            //    var flightData = GetFlightDataFromSnapshot(snapshot);
            //    InvokeOnMainThread(() =>
            //    {
            //        TableSource.FlightList.Add(flightData);
            //        tableView.ReloadData();
            //        View.SetNeedsDisplay();
            //        ActivityIndicator.StopAnimating();
            //        Console.WriteLine("Flight added");
            //    });
            //});

            //var changeNode = childNode.ObserveEvent(DataEventType.Value, (snapshot, prevKey) =>
            //{
            //    if (snapshot == null || !snapshot.HasChildren)
            //    {
            //        InvokeOnMainThread(() =>
            //        {
            //            ActivityIndicator.StopAnimating();
            //            Console.WriteLine("Flight added");
            //        });
            //    }
            //});


            //var deleteNode = childNode.ObserveEvent(DataEventType.ChildRemoved, (snapshot, prevKey) =>
            //{
            //    var flightData = GetFlightDataFromSnapshot(snapshot);
            //    var index = TableSource.FlightList.FindIndex(x => x.Key == flightData.Key);
            //    InvokeOnMainThread(() =>
            //    {
            //        //TableSource.FlightList.RemoveAt(index);
            //        //tableView.BeginUpdates();
            //        tableView.ReloadData();
            //        View.SetNeedsDisplay();
            //        //tableView.EndUpdates();
            //        ActivityIndicator.StopAnimating();
            //        Console.WriteLine("Flight deleted");
            //    });

            //});
        }
示例#14
0
 // Temporarily replaces the 'Add' or 'Save' button with an activity indicator.
 void ShowActivityIndicator()
 {
     NavigationItem.RightBarButtonItem = new UIBarButtonItem(ActivityIndicator);
     ActivityIndicator.StartAnimating();
 }
示例#15
0
 public void ShowLoader()
 {
     ActivityIndicator.StartAnimating();
 }
示例#16
0
 void ViewModel_DidStartUpadateWeather()
 {
     ActivityIndicator.Hidden = false;
     ActivityIndicator.StartAnimating();
 }
 public override void PrepareForReuse()
 {
     base.PrepareForReuse();
     ActivityIndicator.StartAnimating();
 }