public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (InputControl != null)
			{
				InputControl.InvokeOnMainThread(() => { InputControl.BecomeFirstResponder(); });
			}
		}
		public void NADA()
		{
			var binding = new BindingContext(MonoMobileApplication.MainView, MonoMobileApplication.Title);
			var controller = new DialogViewController(UITableViewStyle.Grouped, binding, true) { Autorotate = true };
		
			controller.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
controller.ModalTransitionStyle = UIModalTransitionStyle.CoverVertical;
			Application.NavigationController.PresentModalViewController(controller, true);
		}
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
		{
			if (Parent != null)
			{
				if (Root != null)
				{
					var section = Root.Sections[indexPath.Section];
					var selectedIndex = -1;
					var index = 0;
					
					if (Container != null)
					{
						Container.SelectedItems.Clear();

						foreach (var e in section.Elements)
						{
							var radioView = e as RadioElement;
							UpdateSelected(radioView, this == radioView);
							
							if (this == radioView)
							{
								selectedIndex = index;

								Container.SelectedItem = Item;
								Container.SelectedItems.Add(Item);
							}
							index++;
						}
					}
							
					Root.Index = selectedIndex;					
					
					var property = BindableProperty.GetBindableProperty(Container, "SelectedItemProperty");
					if (property != null)
						property.Update();
					
					property = BindableProperty.GetBindableProperty(Container, "SelectedItemsProperty");
					if (property != null)
						property.Update();

					property = BindableProperty.GetBindableProperty(Container, "IndexProperty");
					property.Update();

					property = BindableProperty.GetBindableProperty(Root, "DataContextProperty");
					if (property != null)
						property.Update(Caption);
				}
			}
			
			DataContext = true;
			UpdateSelected();
			
			if (PopOnSelect)
				dvc.NavigationController.PopViewControllerAnimated(true);
		}
Esempio n. 4
0
        /// <summary>
        /// Creates the UIViewController that will be pushed by this RootElement
        /// </summary>
        protected virtual UIViewController MakeViewController()
        {
            if (_ViewControllerFactory != null)
            {
                return(_ViewControllerFactory(this));
            }

            var dvc = new DialogViewController(this, true)
            {
                Autorotate = true
            };

            return(dvc);
        }
Esempio n. 5
0
        public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new DateTimeController(this)
            {
                Autorotate = dvc.Autorotate
            };

            DatePicker              = CreatePicker();
            DatePicker.Frame        = PickerFrameWithSize(DatePicker.SizeThatFits(SizeF.Empty));
            vc.View.BackgroundColor = tableView.BackgroundColor;
            vc.View.AddSubview(DatePicker);

            //dvc.PresentModalViewController(vc, true);
            dvc.ActivateController(vc, dvc);
        }
Esempio n. 6
0
        public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            if (Animating)
            {
                return;
            }

            if (Command != null)
            {
                Animating = true;

                var executeCommandThread = new Thread(ExecuteCommandThread as ThreadStart);
                executeCommandThread.Start();
            }
        }
Esempio n. 7
0
        public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
        {
            if (Parent != null)
            {
                var root = (IRoot)Parent.Parent;
                if (root != null)
                {
                    var radioGroup = root.Groups.FirstOrDefault() as RadioGroup;

                    var section = root.Sections[indexPath.Section];
                    var index   = 0;
                    foreach (var e in section.Elements)
                    {
                        var radioView = e as RadioElement;
                        UpdateSelected(radioView, this == radioView);

                        if (this == radioView && radioGroup != null)
                        {
                            radioGroup.Selected = index;
                        }

                        index++;
                    }

                    root.Value = this.Caption;

                    var property = BindableProperty.GetBindableProperty(root, "ValueProperty");
                    property.Update();

                    property = BindableProperty.GetBindableProperty(root, "ItemIndexProperty");
                    //	property.Update();

                    if (radioGroup != null)
                    {
                        root.ItemIndex = radioGroup.Selected;
                    }
                }
            }

            Value = true;
            UpdateSelected();

            if (PopOnSelect)
            {
                dvc.NavigationController.PopViewControllerAnimated(true);
            }
        }
Esempio n. 8
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
		{
			if (Parent != null)
			{
				var root = (IRoot)Parent.Parent;
				if (root != null)
				{
					var radioGroup = root.Groups.FirstOrDefault() as RadioGroup;

					var section = root.Sections[indexPath.Section];
					var index = 0;
					foreach (var e in section.Elements)
					{
						var radioView = e as RadioElement;
						UpdateSelected(radioView, this == radioView);

						if (this == radioView && radioGroup != null)
						{
							radioGroup.Selected = index;
						}

						index++;
					}
					
					root.Value = this.Caption;

					var property = BindableProperty.GetBindableProperty(root, "ValueProperty");
					property.Update();

					property = BindableProperty.GetBindableProperty(root, "ItemIndexProperty");
				//	property.Update();
					
					if (radioGroup != null)
						root.ItemIndex = radioGroup.Selected;
				}
			}
			
			Value = true;
			UpdateSelected();
			
			if (PopOnSelect)
				dvc.NavigationController.PopViewControllerAnimated(true);
		}
		public static DialogViewController CreateDialogViewController(UIView view)
		{
			Theme theme = null;
			
			if (CurrentDialogViewController != null)
			{
				theme = CurrentDialogViewController.Root.Theme;
				theme.TableViewStyle = UITableViewStyle.Grouped;
			}
			
			var title = MonoMobileApplication.Title;
			if (view is IView)
				title = ((IView)view).Caption;
			
			var binding = new BindingContext(view, title, theme);
			var dvc = new DialogViewController(UITableViewStyle.Grouped, binding, true) { Autorotate = true };
			dvc.IsModal = true;

			return dvc;
		}
Esempio n. 10
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
		{
			if (Command != null && Command.CanExecute(CommandParameter))
				Command.Execute(CommandParameter);
		}
		/// <summary>
		/// Activates a nested view controller from the DialogViewController.   
		/// If the view controller is hosted in a UINavigationController it
		/// will push the result.   Otherwise it will show it as a modal
		/// dialog
		/// </summary>
		public void ActivateController(UIViewController controller, DialogViewController oldController)
		{
			_Dirty = true;
			
			var parent = ParentViewController;
			var nav = parent as UINavigationController;
			
			if (typeof(DialogViewController) == controller.GetType())
			{
				var dialog = (DialogViewController)controller;

				dialog.TableView.Opaque = false;
				
				if (dialog.BackgroundImage == null)
					dialog.TableView.BackgroundColor = oldController.TableView.BackgroundColor;
			}
			
			// We can not push a nav controller into a nav controller
			if (nav != null && !(controller is UINavigationController))
				nav.PushViewController(controller, true);
			else
				PresentModalViewController(controller, true);
		}
			public Source(DialogViewController container)
			{
				Container = container;
				Root = container.Root;
			}
Esempio n. 13
0
 public virtual void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
 }
Esempio n. 14
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var root = BindingContext.CreateRootedView(this);
			
			if (root != null)
			{
				((RootElement)root).ActivateController(dvc, tableView, path);
			}
			else
			{
				ActivateController(dvc, tableView, path);
			}
		}
Esempio n. 15
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var vc = new WebViewController(this) { Autorotate = dvc.Autorotate };
			var frame = UIScreen.MainScreen.Bounds;

			web = new UIWebView(frame) { BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight };
			web.LoadStarted += delegate { NetworkActivity = true; };
			web.LoadFinished += delegate { NetworkActivity = false; };
			web.LoadError += (webview, args) =>
			{
				NetworkActivity = false;
				if (web != null)
					web.LoadHtmlString(String.Format("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null);
			};
			vc.NavigationItem.Title = Caption;
			vc.View.AddSubview(web);
			
			dvc.ActivateController(vc, dvc);

			var url = new NSUrl(Value.AbsoluteUri);
			web.LoadRequest(NSUrlRequest.FromUrl(url));
		}
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			DataContext = !(bool)DataContext;
			DataContextProperty.Update();
			UpdateSelected();
		}
Esempio n. 17
0
 public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     Value = !Value;
     ValueProperty.Update();
     UpdateSelected();
 }
Esempio n. 18
0
		public virtual void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{

		}
Esempio n. 19
0
        public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
        {
            if (Parent != null)
            {
                if (Root != null)
                {
                    var section       = Root.Sections[indexPath.Section];
                    var selectedIndex = -1;
                    var index         = 0;

                    if (Container != null)
                    {
                        Container.SelectedItems.Clear();

                        foreach (var e in section.Elements)
                        {
                            var radioView = e as RadioElement;
                            UpdateSelected(radioView, this == radioView);

                            if (this == radioView)
                            {
                                selectedIndex = index;

                                Container.SelectedItem = Item;
                                Container.SelectedItems.Add(Item);
                            }
                            index++;
                        }
                    }

                    Root.Index = selectedIndex;

                    var property = BindableProperty.GetBindableProperty(Container, "SelectedItemProperty");
                    if (property != null)
                    {
                        property.Update();
                    }

                    property = BindableProperty.GetBindableProperty(Container, "SelectedItemsProperty");
                    if (property != null)
                    {
                        property.Update();
                    }

                    property = BindableProperty.GetBindableProperty(Container, "IndexProperty");
                    property.Update();

                    property = BindableProperty.GetBindableProperty(Root, "DataContextProperty");
                    if (property != null)
                    {
                        property.Update(Caption);
                    }
                }
            }

            DataContext = true;
            UpdateSelected();

            if (PopOnSelect)
            {
                dvc.NavigationController.PopViewControllerAnimated(true);
            }
        }
Esempio n. 20
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var vc = new DateTimeController(this) { Autorotate = dvc.Autorotate };
			DatePicker = CreatePicker();
			DatePicker.Frame = PickerFrameWithSize(DatePicker.SizeThatFits(SizeF.Empty));
			vc.View.BackgroundColor = tableView.BackgroundColor;
			vc.View.AddSubview(DatePicker);
		
			//dvc.PresentModalViewController(vc, true);
			dvc.ActivateController(vc, dvc);
		}
Esempio n. 21
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var mapViewController = new MapViewController(Value) { Title = Caption };
			dvc.ActivateController(mapViewController, dvc);
		}
Esempio n. 22
0
		/// <summary>
		/// Creates the UIViewController that will be pushed by this RootElement
		/// </summary>
		protected virtual UIViewController MakeViewController(UITableViewStyle style)
		{
			if (_ViewControllerFactory != null)
				return _ViewControllerFactory(this);

			var dvc = new DialogViewController(style, this, true) { Autorotate = true };

			return dvc;
		}
Esempio n. 23
0
        public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            BindingContext bindingContext = null;

            if (ViewBinding != null)
            {
                switch (ViewBinding.DataContextCode)
                {
                case DataContextCode.Object:
                {
                    object view = ViewBinding.CurrentView;

                    if (view == null)
                    {
                        if (ViewBinding.DataContext != null && ViewBinding.DataContext is UIView)
                        {
                            view = ViewBinding.DataContext as UIView;
                        }
                        else if (ViewBinding.ViewType != null)
                        {
                            view = Activator.CreateInstance(ViewBinding.ViewType);
                            var dataContext = view as IDataContext;
                            if (dataContext != null)
                            {
                                if (dataContext.DataContext == null)
                                {
                                    dataContext.DataContext = ViewBinding.DataContext;
                                }

                                var lifetime = dataContext.DataContext as ISupportInitialize;
                                if (lifetime != null)
                                {
                                    lifetime.BeginInit();
                                }

                                lifetime = view as ISupportInitialize;
                                if (lifetime != null)
                                {
                                    lifetime.BeginInit();
                                }
                            }
                        }
                    }

                    bindingContext = new BindingContext(view, Caption, Root.Theme);

                    var root = (RootElement)bindingContext.Root;
                    root.ActivateController(dvc, tableView, path);

                    return;
                }

                case DataContextCode.Enum: break;

                case DataContextCode.EnumCollection: break;

                case DataContextCode.Enumerable:
                {
                    Sections.Clear();
                    IElement element = null;

                    var items = (IEnumerable)ViewBinding.DataContext;

                    var genericType = items.GetType().GetGenericArguments().SingleOrDefault();

                    if (genericType is IView)
                    {
                        Sections.Add(new Section());

                        foreach (var e in items)
                        {
                            element = new RootElement(e.ToString())
                            {
                                ViewBinding = ViewBinding, Theme = Theme
                            };
                            element.ViewBinding.DataContextCode = DataContextCode.Object;

                            Sections[0].Add(element);
                        }
                    }
                    else
                    {
                        var section = BindingContext.CreateEnumSection(this, items, null, true);
                        Sections.Add(section);
                    }

                    break;
                }
                }
            }

            ActivateController(dvc, tableView, path);
        }
Esempio n. 24
0
		public void ActivateController(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{	
			var newDvc = MakeViewController(dvc.Style);
			PrepareDialogViewController(newDvc);
			dvc.ActivateController(newDvc, dvc);
			
			tableView.DeselectRow(path, false);
		}
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var mapViewController = new MapViewController((CLLocationCoordinate2D)DataContext) { Title = Caption };
			dvc.ActivateController(mapViewController, dvc);
		}
			public SearchDelegate(DialogViewController container)
			{
				_Container = container;
			}
Esempio n. 27
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (picker == null)
				picker = new UIImagePickerController();
			picker.Delegate = new MyDelegate(this, tableView, path);

			switch (UIDevice.CurrentDevice.UserInterfaceIdiom)
			{
				case UIUserInterfaceIdiom.Pad:
					RectangleF useRect;
					popover = new UIPopoverController(picker);
					var cell = tableView.CellAt(path);
					if (cell == null)
						useRect = rect;
					else
						useRect = cell.Frame;
					popover.PresentFromRect(useRect, dvc.View, UIPopoverArrowDirection.Any, true);
					break;
				default:
				
				case UIUserInterfaceIdiom.Phone:
					dvc.ActivateController(picker, dvc);
					break;
			}
			currentController = dvc;
		}
			public SizingSource(DialogViewController controller) : base(controller)
			{
			}
Esempio n. 29
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			BindingContext bindingContext = null;
			if (ViewBinding != null)
			{
				switch (ViewBinding.DataContextCode)
				{
					case DataContextCode.Object:
					{
						object view = ViewBinding.CurrentView;

						if (view == null)
						{
							if (ViewBinding.DataContext != null && ViewBinding.DataContext is UIView)
							{
								view = ViewBinding.DataContext as UIView;
							}
							else if (ViewBinding.ViewType != null) 
							{
								view = Activator.CreateInstance(ViewBinding.ViewType);
								var dataContext = view as IDataContext;
								if (dataContext != null)
								{
									if (dataContext.DataContext == null)
										dataContext.DataContext = ViewBinding.DataContext;
	
									var lifetime = dataContext.DataContext as ISupportInitialize;
									if (lifetime != null)
										lifetime.BeginInit();
									
									lifetime = view as ISupportInitialize;
									if (lifetime != null)
										lifetime.BeginInit();
								}

							}
						}
			
						bindingContext = new BindingContext(view, Caption, Root.Theme);

						var root = (RootElement)bindingContext.Root;
						root.ActivateController(dvc, tableView, path);
		
						return;
					}
					case DataContextCode.Enum: break;
					case DataContextCode.EnumCollection: break;
					case DataContextCode.Enumerable:
					{
						Sections.Clear();
						IElement element = null;
	
						var items = (IEnumerable)ViewBinding.DataContext;
	
						var genericType = items.GetType().GetGenericArguments().SingleOrDefault();
					
						if (genericType is IView)
						{
							Sections.Add(new Section());

							foreach (var e in items)
							{
								element = new RootElement(e.ToString()) { ViewBinding = ViewBinding, Theme = Theme };
								element.ViewBinding.DataContextCode = DataContextCode.Object;
			
								Sections[0].Add(element);
							}
						}
						else
						{
							var section = BindingContext.CreateEnumSection(this, items, null, true);
							Sections.Add(section);
						}

						break;
					}
				}
			}

			ActivateController(dvc, tableView, path);
		}
 public SizingSource(DialogViewController controller) : base(controller)
 {
 }
Esempio n. 31
0
 public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     DataContext = !(bool)DataContext;
     DataContextProperty.Update();
     UpdateSelected();
 }
Esempio n. 32
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			Value = !Value;
			ValueProperty.Update();
			UpdateSelected();
		}
 public SearchDelegate(DialogViewController container)
 {
     _Container = container;
 }
Esempio n. 34
0
		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{			
			if (Animating)
				return;
			
			if (Command != null)
			{
				Animating = true;

				var executeCommandThread = new Thread(ExecuteCommandThread as ThreadStart);
				executeCommandThread.Start();
			}
		}
 public Source(DialogViewController container)
 {
     Container = container;
     Root      = container.Root;
 }