コード例 #1
0
        // 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;

                }
            }


        }
 public TableSource (List<BusinessLayer.TaskArt> taskArts, PopoverContentTaskArt parent)
 {
     _taskArts = taskArts;
     _parent = parent;
 }