/// <summary> /// Set the data and style to the view /// </summary> public override void SetDataAndStyleToView() { //Initialise all strings InitialiseAllStrings(); // set up title and content if (!App.Locator.Alert.IsNew) { AlertTitleTextField.Text = App.Locator.Alert.TitleAlert; AlertMessageTextField.Text = App.Locator.Alert.ContentAlert; MaxSizeMessageLabel.Text = string.Format(Application.LocalizedString("MessageLength"), AlertMessageTextField.Text.Length); } else { var nav = (NavigationService)GalaSoft.MvvmLight.Ioc.SimpleIoc.Default.GetInstance <GalaSoft.MvvmLight.Views.INavigationService>(); //if (nav.GetLastEntry() is ModeDontMoveSecondView) //{ // AlertTitleTextField.Text = string.Format(Application.LocalizedString("AlertSeekiosMovedTitle"), App.Locator.DetailSeekios.SeekiosSelected.SeekiosName); // AlertMessageTextField.Text = string.Format(Application.LocalizedString("AlertSeekiosMovedContent"), App.Locator.DetailSeekios.SeekiosSelected.SeekiosName); //} //else if (nav.GetLastEntry() is ModeZoneSecondView) //{ // AlertTitleTextField.Text = string.Format(Application.LocalizedString("AlertSeekiosOutOfZoneTitle"), App.Locator.DetailSeekios.SeekiosSelected.SeekiosName); // AlertMessageTextField.Text = string.Format(Application.LocalizedString("AlertSeekiosOutOfZoneContent"), App.Locator.DetailSeekios.SeekiosSelected.SeekiosName); //} } // set up list of recipient if (App.Locator.ModeZone.EditingAlerts) { foreach (var recipient in App.Locator.Alert.LsRecipients) { CreateContactContainerUI(recipient); } } // round buttons for the contacts container var profileImageCircle = AddRecipientButton.Layer; profileImageCircle.CornerRadius = AddRecipientButton.Frame.Size.Width / 2; AddRecipientButton.ClipsToBounds = true; var profileImageCircle1 = AddRecipientFromContactBookButton.Layer; profileImageCircle1.CornerRadius = AddRecipientFromContactBookButton.Frame.Size.Width / 2; AddRecipientFromContactBookButton.ClipsToBounds = true; // display empty list if the list is empty if (App.Locator.Alert.LsRecipients.Count == 0) { EmptyDataButton.Hidden = false; } else { EmptyDataButton.Hidden = true; } // set up the border of the contact container ViewBehindScrollView.Layer.BorderWidth = 1f; ViewBehindScrollView.Layer.CornerRadius = 4; ViewBehindScrollView.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; // set up the border of the alert title AlertTitleTextField.Layer.BorderWidth = 1f; AlertTitleTextField.Layer.CornerRadius = 4; AlertTitleTextField.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; AlertTitleTextField.ShouldReturn += (textField) => { AlertTitleTextField.ResignFirstResponder(); return(true); }; AlertTitleTextField.EditingChanged += (o, s) => { AlertTitleTextField.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; }; // set up the border of the alert body AlertMessageTextField.Layer.BorderWidth = 1f; AlertMessageTextField.Layer.CornerRadius = 4; AlertMessageTextField.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; AlertMessageTextField.ShouldBeginEditing += (UITextView) => { // set up the scroll the view up or down AnimationView.StartAnimatinon(0.3); var frame = (RectangleF)View.Frame; frame.Y -= 150; View.Frame = frame; AnimationView.StopAnimatinon(); return(true); }; AlertMessageTextField.ShouldChangeText += (UITextView textView, NSRange range, string text) => { AlertMessageTextField.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; // set up the Maximum Character Length for Alert Message if (text.Length > 1000) { AlertMessageTextField.Text = _priviousMessage; } else { _priviousMessage = textView.Text; MaxSizeMessageLabel.Text = string.Format(Application.LocalizedString("MessageLength"), textView.Text.Length); return(true); } return(false); }; AlertMessageTextField.ShouldEndEditing += (UITextView) => { // set up the scroll the view up or down AnimationView.StartAnimatinon(0.3); var frame = (RectangleF)View.Frame; frame.Y += 150; View.Frame = frame; AnimationView.StopAnimatinon(); return(true); }; }
/// <summary> /// Set the data and style to the view /// </summary> public override void SetDataAndStyleToView() { InitialiseAllStrings(); // Display empty list if the list is empty if (App.Locator.AlertSOS.LsRecipients.Count == 0) { EmptyDataButton.Hidden = false; } else { EmptyDataButton.Hidden = true; } // Save button corner SaveButton.Layer.CornerRadius = 4; SaveButton.Layer.MasksToBounds = true; // Set up the border of the contact container ViewBehindScrollView.Layer.BorderWidth = 1f; ViewBehindScrollView.Layer.CornerRadius = 4; ViewBehindScrollView.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; // Set up the border of the alert title AlertTitleTextField.Layer.BorderWidth = 1f; AlertTitleTextField.Layer.CornerRadius = 4; AlertTitleTextField.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; AlertTitleTextField.ShouldReturn += (textField) => { AlertTitleTextField.ResignFirstResponder(); return(true); }; AlertTitleTextField.EditingChanged += (o, s) => { AlertTitleTextField.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; SaveButton.Enabled = true; }; // Set up the border of the alert body AlertMessageTextField.Layer.BorderWidth = 1f; AlertMessageTextField.Layer.CornerRadius = 4; AlertMessageTextField.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; AlertMessageTextField.Changed += (o, s) => { SaveButton.Enabled = true; }; // Set up list of recipientt var alert = App.Locator.AlertSOS.CurrentAlertSOS; if (alert != null) { UpdateScrollViewUI(); AlertTitleTextField.Text = alert.Title; AlertMessageTextField.Text = alert.Content; foreach (var contact in App.CurrentUserEnvironment.LsAlertRecipient.Where(w => w.IdAlert == alert.IdAlert)) { App.Locator.AlertSOS.LsRecipients.Add(new Model.DTO.AlertRecipientDTO { DisplayName = contact.DisplayName, Email = contact.Email, EmailType = contact.EmailType, PhoneNumber = contact.PhoneNumber, PhoneNumberType = contact.PhoneNumberType, IdAlert = contact.IdAlert, IdRecipient = contact.IdRecipient }); CreateContactContainerUI(contact); } } }