public void RefreshDisplayedCreditCount() { if (_seekiosSelected == null) { return; } var seekios = App.CurrentUserEnvironment.LsSeekios.FirstOrDefault(el => el.UIdSeekios == _seekiosSelected.UIdSeekios); // If there is any free credit on the seekios we display freeCredit if (CreditsLabel != null) { CreditsLabel.Text = SeekiosApp.Helper.CreditHelper.TotalCredits; var firstAttributes = new UIStringAttributes { ForegroundColor = UIColor.FromRGB(98, 218, 115) }; var resultTuple = SeekiosApp.Helper.StringHelper.GetStartAndEndIndexOfStringInString(Application.LocalizedString("CreditOfferedAmount"), SeekiosApp.Helper.CreditHelper.CreditsOffered); var offeredCreditsText = new NSMutableAttributedString(string.Format(Application.LocalizedString("CreditOfferedAmount") , SeekiosApp.Helper.CreditHelper.CreditsOffered)); offeredCreditsText.SetAttributes(firstAttributes.Dictionary , new NSRange(resultTuple.Item1, SeekiosApp.Helper.CreditHelper.CreditsOffered.Length)); CreditsFreeLabel.AttributedText = offeredCreditsText; } if (Tableview != null) { Tableview.BeginUpdates(); Tableview.ReloadSections(Foundation.NSIndexSet.FromIndex(1), UITableViewRowAnimation.None); Tableview.EndUpdates(); } }
public override void ViewWillAppear(bool animated) { Title = Application.LocalizedString("SeekiosHelp"); base.ViewWillAppear(animated); Tableview.Source = new ListTutorialSource(); Tableview.ReloadData(); }
public void RefreshTable() { if (App.Locator.TransactionHistoric.LsOperation.Count > 0) { Tableview.Hidden = false; Tableview.ReloadData(); } else { Tableview.Hidden = true; } }
public void UpdateAlertData() { if (App.Locator.ModeZone.LsAlertsModeZone?.Count > 0) { Tableview.ReloadData(); Tableview.Hidden = false; } else { Tableview.Hidden = true; } InitialiseAllStrings(); }
public void SetDataAndStyleToView() { DefaultListSeekiosText.SetTitle(Application.LocalizedString("NoSeekios"), UIControlState.Normal); App.Locator.BaseMap.InitialiseLsAlertState(); if (App.CurrentUserEnvironment.LsSeekios.Count > 0) { Tableview.Hidden = false; Tableview.DataSource = new ListSeekiosSource(this); Tableview.Delegate = new ListSeekiosTableDelegate(this); Tableview.ReloadData(); } else { Tableview.Hidden = true; } }
private void App_SeekiosChanged(object sender, int e) { InvokeOnMainThread(() => { _seekiosSelected = App.CurrentUserEnvironment.LsSeekios.FirstOrDefault(f => f.UIdSeekios == App.Locator.DetailSeekios.SeekiosSelected.UIdSeekios); if (_seekiosSelected.LastKnownLocation_latitude == App.DefaultLatitude && _seekiosSelected.LastKnownLocation_longitude == App.DefaultLongitude) { _firstInitialise = true; } else { _firstInitialise = false; } if (_firstInitialise) { _firstInitialise = false; Tableview.Source = new DetailSeekiosSource(this, _seekiosSelected); Tableview.ReloadData(); if (_seekiosSelected.LastKnownLocation_dateLocationCreation.HasValue && _seekiosSelected.LastKnownLocation_dateLocationCreation.Value.Year != 1) { SeekiosLastPositionLabel.Text = _seekiosSelected.LastKnownLocation_dateLocationCreation.Value.FormatDateFromNow(); } else { Tableview.ScrollToRow(NSIndexPath.FromRowSection(0, 0) , UITableViewScrollPosition.Top, false); SeekiosLastPositionLabel.Text = Application.LocalizedString("NoPosition"); } } SetDataAndStyleToView(); UpdateBatteryView(); }); }
private void InitializeSeekiosInformation() { // Seekios picture if (string.IsNullOrEmpty(_seekiosSelected.SeekiosPicture)) { SeekiosImageView.Image = UIImage.FromBundle("DefaultSeekios"); } else { using (var dataDecoded = new NSData(_seekiosSelected.SeekiosPicture , NSDataBase64DecodingOptions.IgnoreUnknownCharacters)) { SeekiosImageView.Image = new UIImage(dataDecoded); } } // Seekios name SeekiosNameLabel.Text = _seekiosSelected.SeekiosName; // Seekios need update ? if (App.CurrentUserEnvironment.LastVersionEmbedded != null && _seekiosSelected.VersionEmbedded_idversionEmbedded != App.CurrentUserEnvironment.LastVersionEmbedded.IdVersionEmbedded && !App.CurrentUserEnvironment.LastVersionEmbedded.IsBetaVersion) { if (_seekiosSelected.IsInPowerSaving) { using (var constraintY = NSLayoutConstraint.Create(NeedUpdateButton , NSLayoutAttribute.CenterY , NSLayoutRelation.Equal , SeekiosImageView , NSLayoutAttribute.CenterY , 1, 3)) { constraintY.Active = true; NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { constraintY }); } } NeedUpdateButton.Hidden = false; } // Display or not power saving picture if (_seekiosSelected.IsInPowerSaving) { PowerSavingImage.Hidden = false; } else { PowerSavingImage.Hidden = true; } // Seekios last position if (_firstInitialise) { Tableview.ScrollToRow(NSIndexPath.FromRowSection(0, 0), UITableViewScrollPosition.Top, false); // Display statement to say there is no position SeekiosLastPositionLabel.Text = Application.LocalizedString("FirstPosition"); } else { if (_seekiosSelected.LastKnownLocation_dateLocationCreation.HasValue && _seekiosSelected.LastKnownLocation_dateLocationCreation.Value.Year != 1) { if (_seekiosSelected.IsOnDemand) { // Display on refresh state (OnDemand) var textToDisplay = Application.LocalizedString("RefreshPosition"); var _seekiosOnDemand = App.Locator.Map.LsSeekiosOnDemand.FirstOrDefault(x => x.Seekios.Idseekios == _seekiosSelected.Idseekios); if (_seekiosOnDemand != null) { int minutes = (int)_seekiosOnDemand.Timer.CountDown / 60; int seconds = (int)_seekiosOnDemand.Timer.CountDown - (minutes * 60); SeekiosLastPositionLabel.Text = textToDisplay + string.Format(" {00:00}:{01:00}", minutes, seconds); _seekiosOnDemand.Timer.UpdateUI = () => { minutes = (int)_seekiosOnDemand.Timer.CountDown / 60; seconds = (int)_seekiosOnDemand.Timer.CountDown - (minutes * 60); SeekiosLastPositionLabel.Text = textToDisplay + string.Format(" {00:00}:{01:00}", minutes, seconds); }; // Hidden the count down, specific UI when it's the first location _seekiosOnDemand.Timer.Stopped = () => { SeekiosLastPositionLabel.Text = App.CurrentUserEnvironment.LsSeekios.FirstOrDefault(f => f.UIdSeekios == App.Locator.DetailSeekios.SeekiosSelected.UIdSeekios).LastKnownLocation_dateLocationCreation.Value.FormatDateFromNow(); }; } else { SeekiosLastPositionLabel.Text = Application.LocalizedString("RefreshPosition"); } } else { // Display date of the last position SeekiosLastPositionLabel.Text = _seekiosSelected.LastKnownLocation_dateLocationCreation.Value.FormatDateFromNow(); } } else { // Display no position Tableview.ScrollToRow(NSIndexPath.FromRowSection(0, 0), UITableViewScrollPosition.Top, false); SeekiosLastPositionLabel.Text = Application.LocalizedString("NoPosition"); } } }