/// <summary> /// Initializes a new instance of the <see cref="UI.UITextDatum"/> class. /// </summary> /// <param name="handle">Handle.</param> public UITextDatum (IntPtr handle) : base (handle) { this.EditingDidBegin+= (object sender, EventArgs e) => { this.ResignFirstResponder(); // This object is becoming the observer of the Popover control _popoverContentDate = new PopoverContentDateTime(this); // Set the size, the parentframe and the type and let the magic run DateTime tempDate; DateTime dt = (this.Text.Trim() != "" && DateTime.TryParseExact(this.Text , "dd/MM/yyyy",null, System.Globalization.DateTimeStyles.None,out tempDate) == true) ? DateTime.ParseExact(this.Text, "dd.MM.yyyy",null) : DateTime.Now; _popoverContentDate.Initialize(this.Frame,this.Superview.Superview, UIDatePickerMode.Date,dt); }; }
/// <summary> /// Purpose: Run the PopoverContentDateTime view to select a date /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">EventArgs.</param> private void TxtGeneralSperrDatum_TouchDown(object sender, EventArgs e) { TxtGeneralSperrdatum.ResignFirstResponder(); if (IsEditMode()) { // This object is becoming the observer of the Popover control _popoverContentDate = new PopoverContentDateTime(this); // Set the size, the parentframe and the type and let the magic run DateTime tempDate; DateTime dt = (TxtGeneralSperrdatum.Text.Trim() != "" && DateTime.TryParseExact(TxtGeneralSperrdatum.Text , "dd.MM.yyyy",null, System.Globalization.DateTimeStyles.None,out tempDate) == true) ? DateTime.ParseExact(TxtGeneralSperrdatum.Text, "dd.MM.yyyy",null) : DateTime.Now; _popoverContentDate.Initialize(this.TableView.VisibleCells[2].Frame, this.View, UIDatePickerMode.Date,dt); } }
// Purpose: According to the seleted row in the table, it shows a PopupViewController // - if the first row -> show VCSelectTask // Example Row = 0 + Section = 0 -> show VCSelectTask public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { if (indexPath.Section == 0) { switch (indexPath.Row) { case 0: { // Show all Tasks // Show the PopContentViewController // First create our UI Control with the Table view if (_person == null) return; if(_task != null) _tasks = BusinessLayer.Task.GetTasks(_person.ID, ref Application._user); // Open the VCSelectTask Dialog addItemController = Storyboard.InstantiateViewController<VCSelectTask>(); addItemController._container = this; addItemController._tasks = _tasks; PresentViewController (addItemController, true, null); break; } } } else if (indexPath.Section == 1) { if (controlsEnabled == false) return; switch (indexPath.Row) { case 0: // Show all Ansprechpartnern // Show the PopContentViewController // First create our UI Control with the Table view if (_person == null) return; var taskAnsprechpartnern = BusinessLayer.Ansprechpartner.GetAnsprechpartnern(_person.ID, NSLocale.CurrentLocale.LanguageCode.ToUpper(),ref Application._user); var contentAnsprechpartner = new PopoverContentTaskAnsprechpartner(taskAnsprechpartnern); // Then the PopoverControl DetailViewPopover = new UIPopoverController(contentAnsprechpartner); DetailViewPopover.PopoverContentSize = new CGSize(320, 320); DetailViewPopover.PresentFromRect(tableView.CellAt(indexPath).Frame, View, UIPopoverArrowDirection.Any, true); // Pass a reference of the PopoverControl to the UI Control -> It needs this the control to close it when a row is selected contentAnsprechpartner._container = this; // Last but not least we need to handle the row that is selected break; case 1: // Deselect the row, so we can give full focus the TxtTaskText tableView.DeselectRow(indexPath, true); TxtTaskText.BecomeFirstResponder(); break; case 2: // Show all Types // Show the PopContentViewController // First create our UI Control with the Table view // get the data if (_taskTyps == null) _taskTyps = BusinessLayer.Task.GetTaskTyps(ref Application._user); var content = new PopoverContentTaskTypes(_taskTyps); // Then the PopoverControl DetailViewPopover = new UIPopoverController(content); DetailViewPopover.PopoverContentSize = new CGSize(320, 320); DetailViewPopover.PresentFromRect(tableView.CellAt(indexPath).Frame, View, UIPopoverArrowDirection.Any, true); // Pass a reference of the PopoverControl to the UI Control -> It needs this the control to close it when a row is selected content._container = this; // Last but not least we need to handle the row that is selected break; case 3: // Show all Arts // Show the PopContentViewController // First create our UI Control with the Table view if (_taskArts == null) _taskArts = BusinessLayer.Task.GetTaskArts(ref Application._user); var contentArt = new PopoverContentTaskArt(_taskArts); // Then the PopoverControl DetailViewPopover = new UIPopoverController(contentArt); DetailViewPopover.PopoverContentSize = new CGSize(320, 320); DetailViewPopover.PresentFromRect(tableView.CellAt(indexPath).Frame, View, UIPopoverArrowDirection.Any, true); // Pass a reference of the PopoverControl to the UI Control -> It needs this the control to close it when a row is selected contentArt._container = this; // Last but not least we need to handle the row that is selected break; case 4: // Show all Status // Show the PopContentViewController // First create our UI Control with the Table view List<string> statusList = new List<string>(); statusList.Add("0"); statusList.Add("1"); var contentStatus = new PopoverContentTaskStatus(statusList); // Then the PopoverControl DetailViewPopover = new UIPopoverController(contentStatus); DetailViewPopover.PopoverContentSize = new CGSize(320, 100); DetailViewPopover.PresentFromRect(tableView.CellAt(indexPath).Frame, View, UIPopoverArrowDirection.Any, true); // Pass a reference of the PopoverControl to the UI Control -> It needs this the control to close it when a row is selected contentStatus._container = this; // Last but not least we need to handle the row that is selected break; case 5: // Show TelefonStart // Show User and Abteilung // Show the PopContentViewController // First create our UI Control with the Table view var taskMitarbeitern = BusinessLayer.Task.GetMitarbeitern(ref Application._user); var contentMitarbeiter = new PopoverContentTaskMitarbeiterAbteilung(taskMitarbeitern); // Then the PopoverControl DetailViewPopover = new UIPopoverController(contentMitarbeiter); DetailViewPopover.PopoverContentSize = new CGSize(320, 320); DetailViewPopover.PresentFromRect(tableView.CellAt(indexPath).Frame, View, UIPopoverArrowDirection.Any, true); // Pass a reference of the PopoverControl to the UI Control -> It needs this the control to close it when a row is selected contentMitarbeiter._container = this; // Last but not least we need to handle the row that is selected break; case 6: // Show Date and Time // Run the DateTime popover control and set this object as an observer DateTime dt; if (TxtTaskDate.Text.Trim() != "") { dt = Convert.ToDateTime(TxtTaskDate.Text + " " + TxtTaskTime.Text + ":00"); } else dt = DateTime.Now; _popoverContentDate = new PopoverContentDateTime(this); _popoverContentDate.Initialize(tableView.CellAt(indexPath).Frame, this.View, UIDatePickerMode.DateAndTime, dt); break; case 7: // Show TelefonDauer break; } } }