Ejemplo n.º 1
1
		public override UITableViewCell GetCell(UITableView tv)
		{
			RectangleF frame;
			if (datePicker == null)
			{
				label = new UILabel
				{
					Text = Caption
				};
				label.SizeToFit();
				frame = label.Frame;
				frame.X = 15;
				frame.Y = 5;
				label.Frame = frame;

				datePicker = CreatePicker();
				
			}
			if(datePicker.Date != DateValue)
				datePicker.Date = DateValue;

			frame = datePicker.Frame;
			frame.Y = frame.X = 0;
			datePicker.Frame = frame;
			var cell = tv.DequeueReusableCell("datePicker") ?? new UITableViewCell(UITableViewCellStyle.Default, "datePicker") { Accessory = UITableViewCellAccessory.None };
			cell.ContentView.Add(label);
			if(cell.ContentView != datePicker.Superview)
				cell.ContentView.Add(datePicker);
			
			return cell;
		}
		public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
		{
			tableView.DeselectRow(indexPath, true);
			if (RowSelectedAction != null) {
				RowSelectedAction(tableView, indexPath);
			}
		}
		public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
		{
			var dsViewController = (DispatchSourceViewController)Storyboard.InstantiateViewController ("DSViewController");
			dsViewController.SelectedDispatchSource = (DispatchSourceType)indexPath.Row;

			NavigationController.PushViewController (dsViewController, true);
		}
		public override nint RowsInSection (UITableView tableview, nint section)
		{
			if (nearables == null)
				return 0;
			else
				return nearables.Length;
		}
Ejemplo n.º 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            var list = new List<NewsModel>();
            var table = new UITableView (new RectangleF (0, 0, View.Bounds.Width, View.Bounds.Height));
            View.Add (table);

            try{
                var request = WebRequest.Create("http://api.bbcnews.appengine.co.uk/stories/"+_category);
                var response = request.GetResponse ();
                using(var stream = new StreamReader(response.GetResponseStream())){
                    var json = stream.ReadToEnd ();
                    var jsonVal = JsonValue.Parse (json);
                    for(var i=0; i<jsonVal["stories"].Count; i++){
                        list.Add (new NewsModel () {
                            Title = jsonVal["stories"][i]["title"],
                            Description = jsonVal["stories"][i]["description"],
                            Thumbnail = jsonVal["stories"][i]["thumbnail"],
                            Link = jsonVal["stories"][i]["link"]
                        });
                    }
                };
                response.Close ();
            }catch{
            }
            table.Source = new NewsTableSource(list.ToArray(), NavigationController);
            // Perform any additional setup after loading the view, typically from a nib.
        }
Ejemplo n.º 6
0
		public override nfloat GetHeightForRow (UITableView tableView, Foundation.NSIndexPath indexPath)
		{
			if (!data.IsList && indexPath.Section == 0) {
				return indexPath.Row == 0 ? 66.0f : 22.0f;
			}
			return 44.0f;
		}
Ejemplo n.º 7
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell (Key);
            if (cell == null){
                cell = new UITableViewCell (UITableViewCellStyle.Default, Key);
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                cell.Frame = new RectangleF(cell.Frame.X, cell.Frame.Y, tv.Frame.Width, cell.Frame.Height);
            } else {
                RemoveTag (cell, 1);
            }

            if (button == null) {

                RectangleF frame = cell.Frame;
                frame.Inflate(-10, 0);

                button = new GlassButton(frame);
                button.TouchUpInside += (o, e) => tapped.Invoke();
                button.Font = UIFont.BoldSystemFontOfSize (22);
            } else {
                button.RemoveFromSuperview();
            }

            button.SetTitle(this.Caption, UIControlState.Normal);
            button.SetTitleColor(UIColor.White, UIControlState.Normal);
            button.BackgroundColor = UIColor.Clear;
            button.HighlightedColor = this.HighlightedColor;
            button.NormalColor = this.NormalColor;
            button.DisabledColor = this.DisabledColor;

            cell.Add(button);

            return cell;
        }
		private void TogglePicker(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var sectionAndIndex = GetMySectionAndIndex(dvc);
			if(sectionAndIndex.Key != null)
			{
				Section section = sectionAndIndex.Key;
				int index = sectionAndIndex.Value;

				var cell = tableView.CellAt(path);

				if(isPickerPresent)
				{
					// Remove the picker.
					cell.DetailTextLabel.TextColor = UIColor.Gray;
					section.Remove(datePickerContainer);
					isPickerPresent = false;
				} 
				else
				{
					// Show the picker.
					cell.DetailTextLabel.TextColor = UIColor.Red;
					datePickerContainer = new UIViewElement(string.Empty, datePicker, false);
					section.Insert(index + 1, UITableViewRowAnimation.Bottom, datePickerContainer);
					isPickerPresent = true;
				}
			}
		}
        public override void ViewDidLoad()
        {
            try
            {
                base.ViewDidLoad();
                this.Title = "Derby Games";

                View.Frame = UIScreen.MainScreen.Bounds;
                View.BackgroundColor = UIColor.White;
                View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
                table = new UITableView(new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height));

                Action<GamesJson> skaters = new Action<GamesJson>(UpdateAdapter);
                Game.PullCurrentGames(skaters);
                Action<GamesJson> skaters1 = new Action<GamesJson>(UpdateAdapter);
                Game.PullPastGames(PAGE_COUNT, lastPagePulled, skaters1);
                // Perform any additional setup after loading the view
                loading = new LoadingView();
                loading.ShowActivity("loading games");
                source = new GamesTableView(initialArray.Games, this.NavigationController, View);
                source.GotCell += source_GotCell;
                table.Source = source;
                table.RowHeight = 160;

                this.NavigationItem.BackBarButtonItem = new UIBarButtonItem();
                this.NavigationItem.BackBarButtonItem.Title = "Games";

                View.Add(table);
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.iPhone);
            }
        }
		public override UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath)
		{
			var item = Data[indexPath.Row];

			var cell = (ByInvestmentTableViewCell)tableView.DequeueReusableCell (investmentId);

			if (cell == null)
				cell = new ByInvestmentTableViewCell (investmentId, sourceNames);	

			//cell.SeparatorInset = new UIEdgeInsets (0, 0, 0, 10);

			cell.FundNameLabel.Text = item.FundName;
			cell.SelectionStyle = UITableViewCellSelectionStyle.None;

			var x = 0;

			foreach (var name in sourceNames) {
				cell.SourceAmounts [x].Item1.Text = name;

				var amount = 0.00;

				if (item.SourceAmounts.ContainsKey (name)) {
					amount = item.SourceAmounts [name];
				}
				cell.SourceAmounts [x].Item2.Text = String.Format ("{0:C}", amount);
				x++;
			}
			return cell;
		}
Ejemplo n.º 11
0
		void ReleaseDesignerOutlets ()
		{
			if (TableView != null) {
				TableView.Dispose ();
				TableView = null;
			}
		}
Ejemplo n.º 12
0
        public float GetHeightTitle(UITableView tableView)
        {
            var size2 = tableView.StringSize (_post.TitleDecoded, HeadingFont,
                                              new SizeF(tableView.Frame.Width - 24, 60));

            return size2.Height + 2;
        }
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			Value = !Value;
			var cell = tableView.CellAt (path);
			ConfigCell (cell);
			base.Selected (dvc, tableView, path);
		}
Ejemplo n.º 14
0
		public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			Value = !Value;
			InitializeCell(tableView);

			base.Selected(dvc, tableView, path);
		}
        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            var textField = new UITextField(new RectangleF(10, 10, 300, 40));
            Add(textField);

            var tableView = new UITableView(new RectangleF(0, 50, 320, 500), UITableViewStyle.Plain);
            Add(tableView);

			// choice here:
			//
			//   for original demo use:
            //     var source = new MvxStandardTableViewSource(tableView, "TitleText");
			//
			//   or for prettier cells from XIB file use:
			//     tableView.RowHeight = 88;
			//     var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);

			tableView.RowHeight = 88;
			var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);
			tableView.Source = source;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(textField).To(vm => vm.SearchTerm);
            set.Bind(source).To(vm => vm.Results);
            set.Apply();

            tableView.ReloadData();
        }
Ejemplo n.º 16
0
		public override void InitializeCell(UITableView tableView)
		{
			Cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			TextLabel.Text = Caption;
		
			base.InitializeCell(tableView);
		}
		void ReleaseDesignerOutlets ()
		{
			if (btnTermsAndConditions != null) {
				btnTermsAndConditions.Dispose ();
				btnTermsAndConditions = null;
			}
			if (cellOnFacebook != null) {
				cellOnFacebook.Dispose ();
				cellOnFacebook = null;
			}
			if (imgAppIcon != null) {
				imgAppIcon.Dispose ();
				imgAppIcon = null;
			}
			if (lblMadeInGuildford != null) {
				lblMadeInGuildford.Dispose ();
				lblMadeInGuildford = null;
			}
			if (lblVersion != null) {
				lblVersion.Dispose ();
				lblVersion = null;
			}
			if (tableView != null) {
				tableView.Dispose ();
				tableView = null;
			}
		}
		void ReleaseDesignerOutlets ()
		{
			if (CommentsTableView != null) {
				CommentsTableView.Dispose ();
				CommentsTableView = null;
			}
		}
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     table = new UITableView(View.Bounds); // defaults to Plain style
     table.Source = new TableSource(eventList);
     Add(table);
 }
Ejemplo n.º 20
0
			public override void MoveRow (UITableView tableView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath)
			{
				var section = Container.Root [sourceIndexPath.Section];
				var source = section [sourceIndexPath.Row];
				section.Remove (source);
				section.Insert (destinationIndexPath.Row, source);
			}
Ejemplo n.º 21
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
        {
            var root = (RootElement)Parent.Parent;
            root.RadioSelected = RadioIdx;

            base.Selected(dvc, tableView, indexPath);
        }
Ejemplo n.º 22
0
		public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
		{
			UIAlertController okAlertController = UIAlertController.Create ("Row Selected", indexedTableItems [keys [indexPath.Section]] [indexPath.Row], UIAlertControllerStyle.Alert);
			okAlertController.AddAction (UIAlertAction.Create ("OK", UIAlertActionStyle.Default, null));
			owner.PresentViewController (okAlertController, true, null);
			tableView.DeselectRow (indexPath, true);
		}
 public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
 {
     if (editingStyle == UITableViewCellEditingStyle.Delete) {
         _taskManager.RemoveItem(_taskManager.TodoItems[indexPath.Row]);
         tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Top);
     }
 }
Ejemplo n.º 24
0
		public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
		{
			var cell = tableView.DequeueReusableCell("ArterTableCell");
			if(cell == null)
				cell = new UIJaktTableViewCell(UITableViewCellStyle.Default, "ArterTableCell");

			var groupId = JaktLoggApp.instance.ArtGroupList[indexPath.Section].ID;
			var artsInSection = JaktLoggApp.instance.ArtList.Where(a => a.GroupId == groupId);
			var c = artsInSection.Count();
			//legg til art - knapp
			if(_controller.TableView.Editing && groupId == 100 && indexPath.Row == c){
				cell.TextLabel.Text = Utils.Translate("specie.new");
				//cell.Accessory = UITableViewCellAccessory.None;
				cell.ImageView.Image = null;
			}
			else
			{
				var art = artsInSection.ElementAt(indexPath.Row);
				var label = art.Navn;

				var icon = JaktLoggApp.instance.SelectedArtIds.Contains(art.ID) ? "icon_checked.png" : "icon_unchecked.png";
				var file = "Images/Icons/"+icon;
				cell.ImageView.Image = new UIImage(file);
				cell.ImageView.Layer.MasksToBounds = true;
				cell.ImageView.Layer.CornerRadius = 5.0f;

				cell.TextLabel.Text = label;
				cell.TextLabel.TextAlignment = UITextAlignment.Left;
				if(!EditMode)
					cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;
			}
			return cell;
		}
Ejemplo n.º 25
0
        public override UITableViewCell GetCell (UITableView tv)
        {
            var cell = tv.DequeueReusableCell(CellReuseIdentifier) as OwnerDrawnCell;

            if (cell == null)
            {
                cell = new OwnerDrawnCell(this, Style, CellReuseIdentifier);
                OnCreateCell(cell);
            }
            else
            {
                cell.Element = this;
            }

            if (Tapped != null) {
                cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
            } 
            else 
            {
                cell.Accessory = UITableViewCellAccessory.None;
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            }

            cell.BackgroundColor = BackgroundColor;
            cell.Update();
            return cell;
        }   
		public override UITableViewCell GetCell (UITableView tv)
		{
			var cell = base.GetCell (tv);
			if (this.IsMandatory)
				cell.TextLabel.Text += "*";
			return cell;
		}
Ejemplo n.º 27
0
		public override UITableViewCellEditingStyle EditingStyleForRow (UITableView tableView, NSIndexPath indexPath)
		{
			var artsInSection = JaktLoggApp.instance.ArtList.Where(a => a.GroupId == 100).Count();
			if(indexPath.Section == 0 && indexPath.Row == artsInSection)
			    return UITableViewCellEditingStyle.Insert;
			return UITableViewCellEditingStyle.Delete;
		}
Ejemplo n.º 28
0
        protected override StandardContentCell CreateCell(UITableView tableView)
        {
            var cell = new StandardContentCell(UITableViewCellStyle.Default, Type);
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;

            button = UIButton.FromType (UIButtonType.Custom);

            button.SetTitle (Text, UIControlState.Normal);
            button.Font = UIFont.BoldSystemFontOfSize (16);
            button.BackgroundColor = BackgroundColor;
            button.TitleEdgeInsets = new UIEdgeInsets(0, 6, 0, 6);
            button.Layer.CornerRadius = 7.0f;
            button.SetTitleColor(TextColor, UIControlState.Normal);
            button.SizeToFit ();
            button.TouchUpInside += delegate {
                RowSelectedImpl (tableView);
            };

            if (Disable) {
                button.UserInteractionEnabled = false;
                button.Enabled = false;
                button.TitleLabel.Enabled = false;
            }

            float left = (tableView.Frame.Width - button.Frame.Width ) / 2 - 12;
            button.Frame = new RectangleF(left, 4, button.Frame.Width + 12, 36);

            cell.ContentView.Add (button);

            return cell;
        }
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (IsReadonly) {
				base.Selected (dvc, tableView, path);
				return;
			}

			var controller = new UIViewController ();

			UITextView disclaimerView = new UITextView (controller.View.Frame);
//			disclaimerView.BackgroundColor = UIColor.FromWhiteAlpha (0, 0);
//			disclaimerView.TextColor = UIColor.White;
//			disclaimerView.TextAlignment = UITextAlignment.Left;
			if (!string.IsNullOrWhiteSpace (Value))
				disclaimerView.Text = Value;
			else
				disclaimerView.Text = string.Empty;
			
			disclaimerView.Font = UIFont.SystemFontOfSize (16f);
			disclaimerView.Editable = true;

			controller.View.AddSubview (disclaimerView);
			controller.NavigationItem.Title = Caption;
			controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem (string.IsNullOrEmpty (_saveLabel) ? "Save" : _saveLabel, UIBarButtonItemStyle.Done, (object sender, EventArgs e) => {
				if (OnSave != null)
					OnSave (this, EventArgs.Empty);
				controller.NavigationController.PopViewControllerAnimated (true);
				Value = disclaimerView.Text;
			});	

			dvc.ActivateController (controller);
		}
Ejemplo n.º 30
0
		public override float GetHeightForHeader (UITableView tableView, int section)
		{
			if(section > 0)
				return 0.0f;
			
			return 160f;
		}
Ejemplo n.º 31
0
 public override UIView GetViewForHeader(UITableView tableView, nint section)
 {
     return(new UIView {
         BackgroundColor = UIColor.Clear
     });
 }
Ejemplo n.º 32
0
 /// <summary>
 ///     Returns an app specific identifier for cell.
 /// </summary>
 /// <param name="item">The data content</param>
 /// <param name="container">The element to which the template will be applied</param>
 /// <returns>An app-specific template to apply, or null.</returns>
 NSString ITableCellTemplateSelector.GetIdentifier(object item, UITableView container)
 {
     return(GetIdentifier((TSource)item, container));
 }
Ejemplo n.º 33
0
 public override nint RowsInSection(UITableView tableView, nint section)
 {
     return(base.FilteredProducts.Count);
 }
Ejemplo n.º 34
0
 public override nint RowsInSection(UITableView tableView, nint section)
 {
     return(summaryItems == null ? 0 : summaryItems.Length);
 }
Ejemplo n.º 35
0
 protected abstract UITableViewCell GetOrCreateCellFor(UITableView tableView, NSIndexPath indexPath, object item);
Ejemplo n.º 36
0
 protected MvxBaseTableViewSource(UITableView tableView)
 {
     this._tableView = tableView;
 }
Ejemplo n.º 37
0
 public override nint NumberOfSections(UITableView tableView)
 {
     return(1);
 }
Ejemplo n.º 38
0
 public nint RowsInSection(UITableView tableView, nint section) => items?.Count <T>() ?? 0;
Ejemplo n.º 39
0
 /// <summary>
 ///     Returns an app specific template.
 /// </summary>
 /// <param name="container">The element to which the template will be applied</param>
 /// <param name="identifier">The specified identifier.</param>
 /// <returns>An app-specific template to apply, or null.</returns>
 protected abstract TTemplate SelectTemplate(UITableView container, NSString identifier);
Ejemplo n.º 40
0
 /// <summary>
 ///     Returns an app specific template height.
 /// </summary>
 /// <param name="container">The element to which the template will be applied</param>
 /// <param name="identifier">The specified identifier.</param>
 /// <returns>An app-specific template height to apply, or null.</returns>
 protected virtual float?GetHeight(UITableView container, NSString identifier)
 {
     return(null);
 }
Ejemplo n.º 41
0
 /// <summary>
 ///     Returns an app specific template height.
 /// </summary>
 /// <param name="container">The element to which the template will be applied</param>
 /// <param name="identifier">The specified identifier.</param>
 /// <returns>An app-specific template height to apply, or null.</returns>
 float?ITableCellTemplateSelector.GetHeight(UITableView container, NSString identifier)
 {
     return(GetHeight(container, identifier));
 }
Ejemplo n.º 42
0
 /// <summary>
 ///     Returns an app specific identifier for cell.
 /// </summary>
 /// <param name="item">The data content</param>
 /// <param name="container">The element to which the template will be applied</param>
 /// <returns>An app-specific template to apply, or null.</returns>
 protected abstract NSString GetIdentifier(TSource item, UITableView container);
Ejemplo n.º 43
0
 public ImageConnectionDelegate(UITableView tableView, NSIndexPath rowIndex)
 {
     this.tableView = tableView;
     this.index     = rowIndex;
 }
Ejemplo n.º 44
0
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            var formsControl = (ExtendedTextCell)item;

            var nativeControl = reusableCell as NativeiOSCell;

            if (nativeControl == null)
            {
                nativeControl = new NativeiOSCell(rid, formsControl);
            }

            nativeControl.UpdateCell(formsControl);

            return(nativeControl);
        }
Ejemplo n.º 45
0
 public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
 {
     laborViewModel
     .DeleteLaborAsync(assignmentViewModel.SelectedAssignment, laborViewModel.LaborHours[indexPath.Row])
     .ContinueWith(_ => BeginInvokeOnMainThread(controller.ReloadLabor));
 }
Ejemplo n.º 46
0
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            var textCell = (TextCell)item;

            if (!(reusableCell is CellTableViewCell tvc))
            {
                tvc = new CellTableViewCell(UITableViewCellStyle.Subtitle, item.GetType().FullName);
            }
Ejemplo n.º 47
0
 public override nint RowsInSection(UITableView tableview, nint section)
 {
     return(laborViewModel.LaborHours == null ? 0 : laborViewModel.LaborHours.Count);
 }
Ejemplo n.º 48
0
 public override bool CanEditRow(UITableView tableView, NSIndexPath indexPath)
 {
     return(!assignmentViewModel.SelectedAssignment.IsReadonly);
 }
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;

            try
            {
                var xOffset       = 8;
                var yOffset       = 28;
                var controlHeight = 30;
                var spacing       = 6;
                var viewWidth     = View.Bounds.Width;
                var viewHeight    = View.Bounds.Height;

                // --- First Row - from location ---

                // Add marker image
                var markerImage = UIImage.FromFile("./MarkerA.png");
                var imageView   = new UIImageView(markerImage)
                {
                    Frame       = new CGRect(xOffset, yOffset, controlHeight, controlHeight),
                    ContentMode = UIViewContentMode.ScaleToFill
                };
                View.AddSubview(imageView);

                // Add from text field
                var textFieldOffset = xOffset + imageView.Frame.Width + spacing;
                var textFieldWidth  = viewWidth - (textFieldOffset * 2);
                _fromTextField = new UITextField()
                {
                    Frame       = new CGRect(textFieldOffset, yOffset, textFieldWidth, controlHeight),
                    Placeholder = "from office or conference room",
                    BorderStyle = UITextBorderStyle.RoundedRect
                };
                _fromTextField.EditingChanged += FromTextField_EditingChanged;
                View.AddSubview(_fromTextField);

                // Add QR image
                var qrOffset = _fromTextField.Frame.Right + spacing;
                var qrImage  = UIImage.FromFile("./QRScan_Black.png");
                imageView = new UIImageView(qrImage)
                {
                    Frame       = new CGRect(qrOffset, yOffset, controlHeight, controlHeight),
                    ContentMode = UIViewContentMode.ScaleToFill
                };
                View.AddSubview(imageView);


                //// --- Second row - to location ---

                yOffset += controlHeight + spacing;

                // Add marker image
                markerImage = UIImage.FromFile("./MarkerB.png");
                imageView   = new UIImageView(markerImage)
                {
                    Frame       = new CGRect(xOffset, yOffset, controlHeight, controlHeight),
                    ContentMode = UIViewContentMode.ScaleToFill
                };
                View.AddSubview(imageView);

                // Add to text field
                _toTextField = new UITextField()
                {
                    Frame       = new CGRect(textFieldOffset, yOffset, textFieldWidth, controlHeight),
                    Placeholder = "to office or conference room",
                    BorderStyle = UITextBorderStyle.RoundedRect
                };
                _toTextField.EditingChanged += ToTextField_EditingChanged;
                View.AddSubview(_toTextField);

                // Add calendar image
                var calendarOffset = _toTextField.Frame.Right + spacing;
                var calendarImage  = UIImage.FromBundle("Calendar.png");
                imageView = new UIImageView(calendarImage)
                {
                    Frame       = new CGRect(calendarOffset, yOffset, controlHeight, controlHeight),
                    ContentMode = UIViewContentMode.ScaleToFill
                };
                View.AddSubview(imageView);



                // --- Third row - map view ---

                yOffset += controlHeight + spacing;

                // Initialize view-model
                _mapViewModel = new MapViewModel();
                await _mapViewModel.LoadAsync();

                _mapViewModel.RequestViewpoint += MapViewModel_RequestViewpoint;
                _mapViewModel.PropertyChanged  += MapViewModel_PropertyChanged;

                // Initialize map view
                _mapView = new MapView()
                {
                    Map = _mapViewModel.Map,
                    GraphicsOverlays = _mapViewModel.Overlays,
                    Frame            = new CGRect(0, yOffset, viewWidth, viewHeight - yOffset)
                };
                _mapView.DrawStatusChanged   += MapView_DrawStatusChanged;
                _mapView.NavigationCompleted += MapView_NavigationCompleted;
                View.AddSubview(_mapView);

                // --- Auto-complete drop-downs ---

                // Add table-view for auto-complete entries for "from" field
                _fromAutoCompleteTableView = new UITableView()
                {
                    Frame  = new CGRect(textFieldOffset, _fromTextField.Frame.Bottom, textFieldWidth, controlHeight),
                    Hidden = true
                };
                View.AddSubview(_fromAutoCompleteTableView);

                // Add table-view for auto-complete entries for "to" field
                _toAutoCompleteTableView = new UITableView()
                {
                    Frame  = new CGRect(textFieldOffset, _toTextField.Frame.Bottom, textFieldWidth, controlHeight),
                    Hidden = true
                };
                View.AddSubview(_toAutoCompleteTableView);


                // --- Walk-time UI ---

                controlHeight = 24;
                var routeDetailsHeight = (controlHeight * 2) + spacing + (xOffset * 2);
                _routeDetailsView = new UIView()
                {
                    BackgroundColor = UIColor.White,
                    Frame           = new CGRect(0, viewHeight - routeDetailsHeight, viewWidth, routeDetailsHeight),
                    Hidden          = true
                };

                var titleWidth    = 200;
                var fontSize      = 22;
                var cfBlue        = System.Drawing.Color.CornflowerBlue;
                var cfBlueUIColor = UIColor.FromRGB(cfBlue.R, cfBlue.G, cfBlue.B);
                _walkTimeTitle = new UILabel()
                {
                    TextColor = cfBlueUIColor,
                    Font      = UIFont.BoldSystemFontOfSize(fontSize),
                    Text      = "Walk Time",
                    Frame     = new CGRect(xOffset, xOffset, titleWidth, controlHeight)
                };
                _routeDetailsView.AddSubview(_walkTimeTitle);

                var timeLabelOffset = _walkTimeTitle.Frame.Right;
                var timeLabelWidth  = viewWidth - xOffset - timeLabelOffset;
                _walkTime = new UILabel()
                {
                    TextColor     = cfBlueUIColor,
                    Font          = UIFont.BoldSystemFontOfSize(fontSize),
                    Text          = "00:00:00",
                    TextAlignment = UITextAlignment.Right,
                    Frame         = new CGRect(timeLabelOffset, xOffset, timeLabelWidth, controlHeight)
                };
                _routeDetailsView.AddSubview(_walkTime);

                var altFontSize = 18;
                var altYOffset  = _walkTime.Frame.Bottom + spacing;
                _walkTimeAltTitle = new UILabel()
                {
                    TextColor = UIColor.Gray,
                    Font      = UIFont.BoldSystemFontOfSize(altFontSize),
                    Text      = "Alternate Route",
                    Frame     = new CGRect(xOffset, altYOffset, titleWidth, controlHeight)
                };
                _routeDetailsView.AddSubview(_walkTimeAltTitle);

                _walkTimeAlt = new UILabel()
                {
                    TextColor     = UIColor.Gray,
                    Font          = UIFont.BoldSystemFontOfSize(altFontSize),
                    Text          = "00:00:00",
                    TextAlignment = UITextAlignment.Right,
                    Frame         = new CGRect(timeLabelOffset, altYOffset, timeLabelWidth, controlHeight)
                };
                _routeDetailsView.AddSubview(_walkTimeAlt);

                View.AddSubview(_routeDetailsView);

                // --- Busy indicator view ---

                _busyView = new UIView()
                {
                    BackgroundColor = UIColor.White,
                    Frame           = _routeDetailsView.Frame,
                    Hidden          = true
                };

                var busyIndicatorSize = 44;
                var busyIndicatorTop  = (_busyView.Frame.Height - busyIndicatorSize) / 2;
                _busyIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge)
                {
                    Color = UIColor.Gray,
                    Frame = new CGRect(xOffset, busyIndicatorTop, busyIndicatorSize, busyIndicatorSize)
                };
                _busyIndicator.StartAnimating();
                _busyView.AddSubview(_busyIndicator);

                _busyLabel = new UILabel()
                {
                    TextColor = cfBlueUIColor,
                    Font      = UIFont.BoldSystemFontOfSize(fontSize),
                    Text      = "Calculating...",
                    Frame     = new CGRect(busyIndicatorSize + xOffset, busyIndicatorTop, titleWidth, busyIndicatorSize)
                };
                _busyView.AddSubview(_busyLabel);

                View.AddSubview(_busyView);
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"{ex.Message}\n{ex.StackTrace}");
            }
        }
 public override nint NumberOfSections(UITableView tableView) => 1;
Ejemplo n.º 51
0
 public override nint RowsInSection(UITableView tableview, nint section)
 {
     return(tableItems.Count);
 }
Ejemplo n.º 52
0
 public override nint RowsInSection(UITableView tableview, nint section)
 {
     return(1);
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Gets the cell.
 /// </summary>
 /// <param name="tableView">The table view.</param>
 /// <param name="indexPath">The index path.</param>
 /// <returns>UITableViewCell.</returns>
 public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
 {
     return(_onGetCell(tableView, indexPath));
 }
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            var cell = base.GetCell(item, reusableCell, tv);
            var view = item as ExtendedViewCell;

            cell.SelectedBackgroundView = new UIView
            {
                BackgroundColor = view.SelectedBackgroundColor.ToUIColor(),
            };

            return(cell);
        }
Ejemplo n.º 55
0
 /// <summary>
 /// Gets the height for row.
 /// </summary>
 /// <param name="tableView">The table view.</param>
 /// <param name="indexPath">The index path.</param>
 /// <returns>System.Single.</returns>
 public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
 {
     return(_onGetHeightForRow(tableView, indexPath));
 }
Ejemplo n.º 56
0
 public override nint NumberOfSections(UITableView tableView)
 {
     return(photoViewModel.Photos == null ? 0 : photoViewModel.Photos.Count);
 }
Ejemplo n.º 57
0
 /// <summary>
 /// Gets the height for row.
 /// </summary>
 /// <param name="tableView">The table view.</param>
 /// <param name="item">The item.</param>
 /// <returns>System.Single.</returns>
 protected virtual float GetHeightForRow(UITableView tableView, T item)
 {
     return(DEFAULT_ROW_HEIGHT);
 }
Ejemplo n.º 58
0
 /// <summary>
 /// Rows the selected.
 /// </summary>
 /// <param name="tableView">The table view.</param>
 /// <param name="indexPath">The index path.</param>
 public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
 {
     _onRowSelected(tableView, indexPath);
 }
Ejemplo n.º 59
0
 //[Export("tableView:heightForRowAtIndexPath:")]
 /// <summary>
 /// Gets the height for row.
 /// </summary>
 /// <param name="tableView">The table view.</param>
 /// <param name="indexPath">The index path.</param>
 /// <returns>System.Single.</returns>
 public virtual float GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
 {
     return(GetHeightForRow(tableView, Element.Data[(int)indexPath.Item]));
 }
Ejemplo n.º 60
0
 /// <summary>
 /// Rowses the in section.
 /// </summary>
 /// <param name="tableView">The table view.</param>
 /// <param name="section">The section.</param>
 /// <returns>System.Int32.</returns>
 public override nint RowsInSection(UITableView tableView, nint section)
 {
     return(_onRowsInSection(tableView, section));
 }