Exemple #1
0
        public override void LoadView()
        {
            base.LoadView();

            if (Aircraft == null)
            {
                Aircraft = new Aircraft();
                exists   = false;
            }

            Title = exists ? Aircraft.TailNumber : "New Aircraft";

            profile            = new EditAircraftProfileView(View.Bounds.Width);
            profile.Photograph = PhotoManager.Load(Aircraft.TailNumber, false);
            profile.TailNumber = Aircraft.TailNumber;
            profile.Model      = Aircraft.Model;
            profile.Make       = Aircraft.Make;

            Root.Add(CreateAircraftTypeSection());
            Root.Add(new Section("Notes")
            {
                (notes = new LimitedEntryElement(null, "Enter any additional notes about the aircraft here.",
                                                 Aircraft.Notes, 140)),
            });

            Root[0].HeaderView = profile;

            cancel = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, OnCancelClicked);
            NavigationItem.LeftBarButtonItem = cancel;

            save = new UIBarButtonItem(UIBarButtonSystemItem.Save, OnSaveClicked);
            NavigationItem.RightBarButtonItem = save;
        }
Exemple #2
0
			public override void Draw (RectangleF rect)
			{
				CGContext ctx = UIGraphics.GetCurrentContext ();
				bool highlighted = cell.Selected;
				UIColor textColor, tailColor;
				
				var bounds = Bounds;
				var midx = bounds.Width / 2;
				
				if (highlighted) {
					UIColor.FromRGB (4, 0x79, 0xef).SetColor ();
					ctx.FillRect (bounds);
					//Images.MenuShadow.Draw (bounds, CGBlendMode.Normal, 0.5f);
					tailColor = textColor = UIColor.White;
				} else {
					UIColor.White.SetColor ();
					ctx.FillRect (bounds);
					ctx.DrawLinearGradient (BottomGradient, new PointF (midx, bounds.Height - 17), new PointF (midx, bounds.Height), 0);
					ctx.DrawLinearGradient (TopGradient, new PointF (midx, 1), new PointF (midx, 3), 0);
					tailColor = TailNumberColor;
					textColor = UIColor.Black;
				}
				
				// Compute the bounds for each line of text...
				var tailXOffset = bounds.X + bounds.Width - TailNumberWidth - TextPadding;
				var textXOffset = PhotoAreaWidth + TextPadding;
				
				var modelWidth = bounds.Width - PhotoAreaWidth - TailNumberWidth - (TextPadding * 2);
				var makeWidth = bounds.Width - PhotoAreaWidth - (TextPadding * 2);
				var timeWidth = makeWidth;
				
				var modelBounds = new RectangleF (textXOffset, bounds.Y + AircraftModelYOffset, modelWidth, AircraftModelFontSize);
				var makeBounds = new RectangleF (textXOffset, bounds.Y + AircraftMakeYOffset, makeWidth, AircraftModelFontSize);
				var tailBounds = new RectangleF (tailXOffset, bounds.Y + TailNumberYOffset, TailNumberWidth, TailNumberFontSize);
				var timeBounds = new RectangleF (textXOffset, bounds.Y + FlightTimeYOffset, timeWidth, FlightTimeFontSize);
				
				tailColor.SetColor ();
				DrawString (aircraft.TailNumber, tailBounds, TailNumberFont, UILineBreakMode.Clip, UITextAlignment.Left);
				
				textColor.SetColor ();
				DrawString (aircraft.Model ?? "", modelBounds, AircraftModelFont, UILineBreakMode.TailTruncation, UITextAlignment.Left);
				DrawString (aircraft.Make ?? "", makeBounds, AircraftMakeFont, UILineBreakMode.TailTruncation, UITextAlignment.Left);
				
				var logged = FormatFlightTime (Aircraft.TotalFlightTime, Aircraft.IsSimulator);
				DrawString (logged, timeBounds, FlightTimeFont, UILineBreakMode.TailTruncation);
				
				var photo = PhotoManager.Load (aircraft.TailNumber, true) ?? DefaultPhoto;
				
				photo.Draw (new RectangleF (PhotoXPad, PhotoYPad, PhotoWidth, PhotoHeight));
			}
Exemple #3
0
        void UpdateDetails()
        {
            Title = Aircraft.TailNumber;

            profile.Photograph = PhotoManager.Load(Aircraft.TailNumber, false);
            profile.Make       = Aircraft.Make;
            profile.Model      = Aircraft.Model;
            profile.Remarks    = Aircraft.Notes;

            category.Value          = Aircraft.Category.ToHumanReadableName();
            classification.Value    = Aircraft.Classification.ToHumanReadableName();
            isComplex.Value         = Aircraft.IsComplex ? "Yes" : "No";
            isHighPerformance.Value = Aircraft.IsHighPerformance ? "Yes" : "No";
            isTailDragger.Value     = Aircraft.IsTailDragger ? "Yes" : "No";
            isSimulator.Value       = Aircraft.IsSimulator ? "Yes" : "No";

            foreach (var section in Root)
            {
                Root.Reload(section, UITableViewRowAnimation.None);
            }
        }