示例#1
0
 Section CreateFlightSection()
 {
     return(new Section("Flight")
     {
         (date = new FlightDateEntryElement("Date", Flight.Date)),
         (aircraft = new AircraftEntryElement(Flight.Aircraft)),
         (departed = new AirportEntryElement("Departed", Flight.AirportDeparted)),
         (visited1 = new AirportEntryElement("Visited", Flight.AirportVisited1)),
         (visited2 = new AirportEntryElement("Visited", Flight.AirportVisited2)),
         (visited3 = new AirportEntryElement("Visited", Flight.AirportVisited3)),
         (arrived = new AirportEntryElement("Arrived", Flight.AirportArrived)),
     });
 }
示例#2
0
        void OnVisitedAirportEdited(object sender, EventArgs e)
        {
            var airport = (AirportEntryElement)sender;
            int index   = visited.IndexOf(airport);
            int last    = visited.Count - 1;

            using (var path = airport.IndexPath) {
                if (!string.IsNullOrEmpty(airport.Value) && index == last)
                {
                    // Add another Visited entry element...
                    airport = new AirportEntryElement("Visited", string.Empty);
                    airport.EditingCompleted += OnVisitedAirportEdited;
                    Root[path.Section].Insert(path.Row + 1, UITableViewRowAnimation.Automatic, new Element[] { airport });
                    visited.Add(airport);
                }
            }
        }
示例#3
0
        Section CreateFlightSection()
        {
            AirportEntryElement airport;

            date     = new DateEntryElement("Date", Flight.Date);
            aircraft = new AircraftEntryElement(Flight.Aircraft)
            {
                AutoComplete = true
            };
            departed = new AirportEntryElement("Departed", Flight.AirportDeparted);
            arrived  = new AirportEntryElement("Arrived", Flight.AirportArrived);

            visited = new List <AirportEntryElement> (3);

            var section = new Section("Flight");

            section.Add(date);
            section.Add(aircraft);
            section.Add(departed);

            string str = Flight.AirportVisited;

            if (!string.IsNullOrEmpty(str))
            {
                foreach (var via in str.Split(new char[] { ',' }))
                {
                    airport = new AirportEntryElement("Visited", via.Trim());
                    airport.EditingCompleted += OnVisitedAirportEdited;
                    section.Add(airport);
                    visited.Add(airport);
                }
            }

            airport = new AirportEntryElement("Visited", string.Empty);
            airport.EditingCompleted += OnVisitedAirportEdited;
            section.Add(airport);
            visited.Add(airport);

            section.Add(arrived);

            return(section);
        }
示例#4
0
            public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
            {
                var section = Root[indexPath.Section];
                var element = section[indexPath.Row];
                AirportEntryElement airport;
                int row = indexPath.Row;

                switch (editingStyle)
                {
                case UITableViewCellEditingStyle.Insert:
                    if (element == Visited[0])
                    {
                        if (Visited.Count >= 3)
                        {
                            return;
                        }

                        row += Visited.Count;

                        airport = new AirportEntryElement("Visited", "");
                        Visited.Add(airport);

                        section.Insert(row, UITableViewRowAnimation.Automatic, airport);
                    }
                    break;

                case UITableViewCellEditingStyle.Delete:
                    if (element is AirportEntryElement)
                    {
                        airport = (AirportEntryElement)element;
                        if (Visited.Contains(airport))
                        {
                            section.RemoveRange(row, 1, UITableViewRowAnimation.Automatic);
                            Visited.Remove(airport);
                        }
                    }
                    break;

                default:
                    break;
                }
            }
 Section CreateFlightSection()
 {
     return new Section ("Flight") {
         (date = new FlightDateEntryElement ("Date", Flight.Date)),
         (aircraft = new AircraftEntryElement (Flight.Aircraft) { AutoComplete = true }),
         (departed = new AirportEntryElement ("Departed", Flight.AirportDeparted)),
         (visited1 = new AirportEntryElement ("Visited", Flight.AirportVisited1)),
         (visited2 = new AirportEntryElement ("Visited", Flight.AirportVisited2)),
         (visited3 = new AirportEntryElement ("Visited", Flight.AirportVisited3)),
         (arrived = new AirportEntryElement ("Arrived", Flight.AirportArrived)),
     };
 }
            public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
            {
                var section = Root[indexPath.Section];
                var element = section[indexPath.Row];
                AirportEntryElement airport;
                int row = indexPath.Row;

                switch (editingStyle) {
                case UITableViewCellEditingStyle.Insert:
                    if (element == Visited[0]) {
                        if (Visited.Count >= 3)
                            return;

                        row += Visited.Count;

                        airport = new AirportEntryElement ("Visited", "");
                        Visited.Add (airport);

                        section.Insert (row, UITableViewRowAnimation.Automatic, airport);
                    }
                    break;
                case UITableViewCellEditingStyle.Delete:
                    if (element is AirportEntryElement) {
                        airport = (AirportEntryElement) element;
                        if (Visited.Contains (airport)) {
                            section.RemoveRange (row, 1, UITableViewRowAnimation.Automatic);
                            Visited.Remove (airport);
                        }
                    }
                    break;
                default:
                    break;
                }
            }
        void OnVisitedAirportEdited(object sender, EventArgs e)
        {
            var airport = (AirportEntryElement) sender;
            int index = visited.IndexOf (airport);
            int last = visited.Count - 1;

            using (var path = airport.IndexPath) {
                if (!string.IsNullOrEmpty (airport.Value) && index == last) {
                    // Add another Visited entry element...
                    airport = new AirportEntryElement ("Visited", string.Empty);
                    airport.EditingCompleted += OnVisitedAirportEdited;
                    Root[path.Section].Insert (path.Row + 1, UITableViewRowAnimation.Automatic, new Element[] { airport });
                    visited.Add (airport);
                }
            }
        }
        Section CreateFlightSection()
        {
            AirportEntryElement airport;

            date = new DateEntryElement ("Date", Flight.Date);
            aircraft = new AircraftEntryElement (Flight.Aircraft) { AutoComplete = true };
            departed = new AirportEntryElement ("Departed", Flight.AirportDeparted);
            arrived = new AirportEntryElement ("Arrived", Flight.AirportArrived);

            visited = new List<AirportEntryElement> (3);

            var section = new Section ("Flight");
            section.Add (date);
            section.Add (aircraft);
            section.Add (departed);

            string str = Flight.AirportVisited;
            if (!string.IsNullOrEmpty (str)) {
                foreach (var via in str.Split (new char[] { ',' })) {
                    airport = new AirportEntryElement ("Visited", via.Trim ());
                    airport.EditingCompleted += OnVisitedAirportEdited;
                    section.Add (airport);
                    visited.Add (airport);
                }
            }

            airport = new AirportEntryElement ("Visited", string.Empty);
            airport.EditingCompleted += OnVisitedAirportEdited;
            section.Add (airport);
            visited.Add (airport);

            section.Add (arrived);

            return section;
        }