ActivateController() public méthode

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
public ActivateController ( UIViewController controller, DialogViewController oldController ) : void
controller UIViewController
oldController DialogViewController
Résultat void
Exemple #1
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new WebViewController(this)
            {
                Autorotate = dvc.Autorotate
            };

            web = new UIWebView(UIScreen.MainScreen.ApplicationFrame)
            {
                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));
        }
Exemple #2
0
        public override 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 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);
		}
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            tableView.DeselectRow(path, false);
            var newDvc = MakeViewController();

            PrepareDialogViewController(newDvc);
            dvc.ActivateController(newDvc, dvc);
        }
		public override void Selected (DialogViewController dvc, UITableView tableView, Foundation.NSIndexPath path)
		{
			var eds = new MWC.iOS.Screens.iPhone.Exhibitors.ExhibitorDetailsScreen (exhibitor.ID);
			
			if (splitView != null)
				splitView.ShowExhibitor(exhibitor.ID, eds);
			else
				dvc.ActivateController (eds);
		}	
		public override void Selected (DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
		{
			var tds = new MWC.iOS.Screens.iPhone.Twitter.TweetDetailsScreen (tweet);
			
			if (splitView != null)
				splitView.ShowTweet(tweet.ID, tds);
			else
				dvc.ActivateController (tds);
		}
Exemple #7
0
		public override void Selected (DialogViewController dvc, UITableView tableView, Foundation.NSIndexPath path)
		{
			var sds = new MWC.iOS.Screens.Common.News.NewsDetailsScreen(entry);
			
			if (splitView != null)
				splitView.ShowNews(entry.ID, sds);
			else
				dvc.ActivateController (sds);
		}
Exemple #8
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var _mapViewController = new MapViewController(Location)
            {
                Title = Caption
            };

            dvc.ActivateController(_mapViewController, dvc);
        }
		/// <summary>
		/// Behaves differently depending on iPhone or iPad
		/// </summary>
		public override void Selected (DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
		{
			if (splitView != null)
				splitView.ShowSpeaker (speaker.ID);
			else {
				var sds = new MWC.iOS.Screens.iPhone.Speakers.SpeakerDetailsScreen (speaker.ID);
				sds.Title = "Speaker";
				dvc.ActivateController (sds);
			}
		}
Exemple #10
0
        public static void OpenHtmlString(DialogViewController parent, string htmlString, NSUrl baseUrl)
        {
            UIView.BeginAnimations ("foo");
            Main.HidesBottomBarWhenPushed = true;
            Main.SetupWeb ();

            Main.WebView.LoadHtmlString (htmlString, baseUrl);
            parent.ActivateController (Main);
            UIView.CommitAnimations ();
        }
 public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     NullableDateTimeElement.MyViewController myViewController = new NullableDateTimeElement.MyViewController(this)
     {
         Autorotate = dvc.Autorotate
     };
     this.datePicker       = this.CreatePicker();
     this.datePicker.Frame = NullableDateTimeElement.PickerFrameWithSize(this.datePicker.SizeThatFits(SizeF.Empty));
     myViewController.View.BackgroundColor = UIColor.Black;
     myViewController.View.AddSubview(this.datePicker);
     dvc.ActivateController(myViewController);
 }
        /// <summary>
        /// Behaves differently depending on iPhone or iPad
        /// </summary>
        public override void Selected(DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
        {
            //TODO on selected go to papers list for this tag
            var papersByTagList = new PapersByTagView ();
            papersByTagList.SelectedTag = tag;
            papersByTagList.Title = tag.name;
            dvc.ActivateController (papersByTagList);

            //			var paperDetails = new WhitePaperBible.iOS.PaperDetailsView(tagNode.tag);
            //paperDetails.Title = tagNode.tag.permalink;
            //			dvc.ActivateController(paperDetails);
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            /*var vc = new MapKitViewController (this) {
             *      Autorotate = dvc.Autorotate
             * };*/

            NetworkActivity = true;
            if (SKPaymentQueue.CanMakePayments)
            {
                // Let's do it
                NSSet productIdentifiers = NSSet.MakeNSObjectSet <NSString>(/*new NSString[]{new NSString("com.savagesoftwaresolutions.murdermap.subscription.monthly"), new NSString("com.savagesoftwaresolutions.com.murdermap.monthly")}*/ ProductIdentifiers);
                var   request            = new SKProductsRequest(productIdentifiers);

                request.ReceivedResponse += delegate(object sender, SKProductsRequestResponseEventArgs e)
                {
                    var root         = new RootElement(Caption);
                    var dvStore      = new DialogViewController(root, true);
                    var storeSection = new Section();

                    root.Add(storeSection);


                    foreach (var product in e.Response.Products)
                    {
                        storeSection.Add(new StringElement(product.LocalizedTitle + ":" + product.PriceLocale));
                    }

                    dvc.ActivateController(dvStore);
                };

                request.RequestFailed += delegate(object sender, SKRequestErrorEventArgs e)
                {
                    using (var msg = new UIAlertView("Request Failed", e.Error.ToString(), null, "Ok")){
                        msg.Show();
                    }
                };

                request.RequestFinished += delegate(object sender, EventArgs e) {
                    NetworkActivity = false;
                };

                request.Start();
            }
            else
            {
                using (var msg = new UIAlertView("Unabled to Make Payments", "We are unable to connect to the Apple Store at this moment, to process your payments.\n Please try again later.", null, "Ok")){
                    msg.Show();
                }
            }

            NetworkActivity = false;
        }
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			/*var vc = new MapKitViewController (this) {
				Autorotate = dvc.Autorotate
			};*/
			
			NetworkActivity = true;
			if ( SKPaymentQueue.CanMakePayments )
			{
				// Let's do it
				NSSet productIdentifiers  = NSSet.MakeNSObjectSet<NSString>(/*new NSString[]{new NSString("com.savagesoftwaresolutions.murdermap.subscription.monthly"), new NSString("com.savagesoftwaresolutions.com.murdermap.monthly")}*/ ProductIdentifiers);
				var request = new SKProductsRequest(productIdentifiers);
				
				request.ReceivedResponse += delegate(object sender, SKProductsRequestResponseEventArgs e) 
				{
					var root = new RootElement (Caption);
					var dvStore = new DialogViewController (root, true);
					var storeSection = new Section();
					
					root.Add(storeSection);
			
					
					foreach (var product in e.Response.Products) 
					{
						storeSection.Add(new StringElement(product.LocalizedTitle +":"+ product.PriceLocale ) );
					}
					
					dvc.ActivateController (dvStore);
				};
				
				request.RequestFailed += delegate(object sender, SKRequestErrorEventArgs e) 
				{					
					using (var msg = new UIAlertView ("Request Failed", e.Error.ToString(), null, "Ok")){
						msg.Show ();
					}
				};
				
				request.RequestFinished += delegate(object sender, EventArgs e) {
					NetworkActivity = false;
				};				
				
				request.Start();
			}
			else
			{
				using (var msg = new UIAlertView ("Unabled to Make Payments", "We are unable to connect to the Apple Store at this moment, to process your payments.\n Please try again later.", null, "Ok")){
					msg.Show ();
				}
			}
			
			NetworkActivity = false;
		}
Exemple #15
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new MyViewController(this)
            {
                Autorotate = dvc.Autorotate
            };

            DatePicker              = CreatePicker();
            DatePicker.Frame        = PickerFrameWithSize(DatePicker.SizeThatFits(SizeF.Empty));
            vc.View.BackgroundColor = UIColor.Black;
            vc.View.AddSubview(DatePicker);
            dvc.ActivateController(vc, dvc);
        }
Exemple #16
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            if (Url == null)
            {
                base.Selected(dvc, tableView, path);
                return;
            }

            tableView.DeselectRow(path, false);
            if (loading)
            {
                return;
            }
            var cell    = GetActiveCell();
            var spinner = StartSpinner(cell);

            loading = true;

            var wc = new WebClient();

            wc.DownloadStringCompleted += delegate(object sender, DownloadStringCompletedEventArgs e){
                dvc.BeginInvokeOnMainThread(delegate {
                    loading = false;
                    spinner.StopAnimating();
                    spinner.RemoveFromSuperview();
                    if (e.Result != null)
                    {
                        try {
                            var obj = JsonValue.Load(new StringReader(e.Result)) as JsonObject;
                            if (obj != null)
                            {
                                var root   = JsonElement.FromJson(obj);
                                var newDvc = new DialogViewController(root, true)
                                {
                                    Autorotate = true
                                };
                                PrepareDialogViewController(newDvc);
                                dvc.ActivateController(newDvc);
                                return;
                            }
                        } catch (Exception ee) {
                            Console.WriteLine(ee);
                        }
                    }
                    IUIAlertViewDelegate avd = null;
                    var alert = new UIAlertView("Error", "Unable to download data", avd, "OK", null);
                    alert.Show();
                });
            };
            wc.DownloadStringAsync(new Uri(Url));
        }
Exemple #17
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            if (Url == null)
            {
                base.Selected(dvc, tableView, path);
                return;
            }

            tableView.DeselectRow(path, false);
            if (loading)
            {
                return;
            }
            var cell    = GetActiveCell();
            var spinner = StartSpinner(cell);

            loading = true;

            var request = new NSUrlRequest(new NSUrl(Url), NSUrlRequestCachePolicy.UseProtocolCachePolicy, 60);

            /*var connection = */ new NSUrlConnection(request, new ConnectionDelegate((data, error) => {
                loading = false;
                spinner.StopAnimating();
                spinner.RemoveFromSuperview();
                if (error == null)
                {
                    try {
                        var obj = JsonValue.Load(new StreamReader(data)) as JsonObject;
                        if (obj != null)
                        {
                            var root   = JsonElement.FromJson(obj);
                            var newDvc = new DialogViewController(root, true)
                            {
                                Autorotate = true
                            };
                            PrepareDialogViewController(newDvc);
                            dvc.ActivateController(newDvc);
                            return;
                        }
                    } catch (Exception ee) {
                        Console.WriteLine(ee);
                    }
                }
                var alertController = UIAlertController.Create("Error", "Unable to download data", UIAlertControllerStyle.Alert);
                alertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (obj) => { }));
                UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(alertController, true, () => { });
            }));
        }
 public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     model = new CounterPickerDataModel(model.Counter);
     var vc = new MyViewController (this) {
         Autorotate = dvc.Autorotate
     };
     counterPicker = CreatePicker ();
     counterPicker.Frame = PickerFrameWithSize (counterPicker.SizeThatFits (SizeF.Empty));
     counterPicker.Model = model;
     for (int d = 0; d < model.Items.Count; d++) {
         counterPicker.Select(model.SelectedIndex[d], d, true);
     }
     vc.View.BackgroundColor = UIColor.Black;
     vc.View.AddSubview (counterPicker);
     dvc.ActivateController (vc);
 }
Exemple #19
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            if (!Url.StartsWith("http:"))
            {
                tableView.DeselectRow(path, false);
                UIApplication.SharedApplication.OpenUrl(nsUrl);
                return;
            }

            var vc = new WebViewController(this)
            {
                Autorotate = dvc.Autorotate
            };

            web = new UIWebView(UIScreen.MainScreen.ApplicationFrame)
            {
                BackgroundColor  = UIColor.White,
                ScalesPageToFit  = true,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
            };
            web.LoadStarted += delegate {
                NetworkActivity = true;
                var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White);
                vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator);
                indicator.StartAnimating();
            };
            web.LoadFinished += delegate {
                NetworkActivity = false;
                vc.NavigationItem.RightBarButtonItem = null;
            };
            web.LoadError += (webview, args) => {
                NetworkActivity = false;
                vc.NavigationItem.RightBarButtonItem = null;
                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 = web;

            dvc.ActivateController(vc, dvc);
            web.LoadRequest(NSUrlRequest.FromUrl(nsUrl));
        }
Exemple #20
0
 public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     try
     {
         if (_tappedAction != null)
         {
             _tappedAction();
         }
         if (_tappedFunc != null)
         {
             UIViewController controller = _tappedFunc();
             dvc.ActivateController(controller);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            tableView.DeselectRow(path, false);
            if (loading)
                return;
            var cell = GetActiveCell();
            var spinner = StartSpinner(cell);
            loading = true;

            var request = new NSUrlRequest(new NSUrl(apiNode.ApiUrl), NSUrlRequestCachePolicy.UseProtocolCachePolicy, 60);

            var connection = new NSUrlConnection(request, new ConnectionDelegate((data, error) =>
            {
                var apiNodes = DrupalApiParser.ParseJsonStream(data);

                loading = false;
                spinner.StopAnimating();
                spinner.RemoveFromSuperview();

                string childType = apiNode["childType"];

                if (this.Count == 0)
                    Add(new Section(""));
                else
                    this[0].Clear();

                foreach (var element in apiNodes)
                {
                    this[0].Add(CreateElement(element, apiNode));
                }

                var newDvc = new DialogViewController(this, true)
                {
                    Autorotate = true
                };
                PrepareDialogViewController(newDvc);
                dvc.ActivateController(newDvc);

                return;
            }));
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            if (picker == null)
            {
                picker = new UIImagePickerController();
            }
            picker.Delegate = new ImagePickerControllerDelegate(this, tableView, path);

            switch (UIDevice.CurrentDevice.UserInterfaceIdiom)
            {
            case UIUserInterfaceIdiom.Pad:
                popover = new UIPopoverController(picker);
                popover.PresentFromRect(rect, dvc.View, UIPopoverArrowDirection.Any, true);
                break;

            default:
            case UIUserInterfaceIdiom.Phone:
                dvc.ActivateController(picker, dvc);
                break;
            }
            currentController = dvc;
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            int i = 0;
            var vc = new UIViewController()
            {
                //Autorotate = dvc.Autorotate
            };

            webView = new UIWebView(UIScreen.MainScreen.Bounds)
            {
                BackgroundColor = UIColor.White,
                ScalesPageToFit = true,
                AutoresizingMask = UIViewAutoresizing.All
            };

            webView.LoadHtmlString(html, new NSUrl("HtmlContent", true));

            vc.NavigationItem.Title = Caption;

            vc.View.AutosizesSubviews = true;
            vc.View.AddSubview(webView);

            dvc.ActivateController(vc);
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new MapKitViewController(this)
            {
                Autorotate = dvc.Autorotate
            };


            if (MapView == null)
            {
                MapView = new MKMapView()
                {
                    BackgroundColor  = UIColor.White,
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
                };
            }

            MapView.Frame = new CGRect(UIScreen.MainScreen.ApplicationFrame.Left, UIScreen.MainScreen.ApplicationFrame.Top - 20, UIScreen.MainScreen.ApplicationFrame.Right, UIScreen.MainScreen.ApplicationFrame.Bottom - 20);
            if (mkHandleGetViewForAnnotation != null)
            {
                MapView.GetViewForAnnotation = delegate(MKMapView mapView, IMKAnnotation annotation) {
                    return(mkHandleGetViewForAnnotation(mapView, annotation));
                };
            }

            if (mkHandleMapViewCalloutAccessoryControlTapped != null)
            {
                MapView.CalloutAccessoryControlTapped += mkHandleMapViewCalloutAccessoryControlTapped;
            }

            if (mkHandleMapViewDidSelectAnnotationView != null)
            {
                MapView.DidSelectAnnotationView += mkHandleMapViewDidSelectAnnotationView;
            }

            if (mkAnnotationObjects != null)
            {
                MapView.AddAnnotations(mkAnnotationObjects);
            }

            MapView.WillStartLoadingMap += delegate(object sender, EventArgs e) {
                NetworkActivity = true;
            };

            MapView.MapLoaded += delegate(object sender, EventArgs e) {
                NetworkActivity = false;
            };

            MapView.LoadingMapFailed += delegate(object sender, NSErrorEventArgs e) {
                // Display an error of sorts
            };

            if (ReverseGeocoderDelegate != null)
            {
                if (MapView != null)
                {
                    MapView.DidUpdateUserLocation += delegate(object sender, MKUserLocationEventArgs e) {
                        if (MapView != null)
                        {
                            var ul = MapView.UserLocation.Location;
                            if (ul != null)                               // May be null if user has not given permission
                            {
                                var gc = new MKReverseGeocoder(ul.Coordinate);
                                gc.Delegate = ReverseGeocoderDelegate;
                                gc.Start();
                            }
                        }
                    };
                }
            }

            MapView.ShowsUserLocation = true;

            vc.NavigationItem.Title = Caption;
            vc.View.AddSubview(MapView);

            dvc.ActivateController(vc);
        }
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (picker == null)
				picker = new UIImagePickerController ();
			picker.Delegate = new ImagePickerControllerDelegate (this, tableView, path);
			
			switch (UIDevice.CurrentDevice.UserInterfaceIdiom){
			case UIUserInterfaceIdiom.Pad:
				popover = new UIPopoverController (picker);
				popover.PresentFromRect (rect, dvc.View, UIPopoverArrowDirection.Any, true);
				break;
				
			default:
			case UIUserInterfaceIdiom.Phone:
				dvc.ActivateController (picker, dvc);
				break;
			}
			currentController = dvc;
		}
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var vc = new WebViewController (this) {
				Autorotate = dvc.Autorotate
			};

			web = new UIWebView (UIScreen.MainScreen.Bounds) {
				BackgroundColor = UIColor.White,
				AutoresizingMask = UIViewAutoresizing.All
			};

			// We delete cache and cookies so it does not remember our login information
			DeleteCacheandCookies ();


			web.LoadStarted += (webview, e) => {
				NetworkActivity = true;
			};

			web.LoadFinished += (webview, e) =>  {
				NetworkActivity = false;
				var wb = webview as UIWebView;
				FacebookOAuthResult oauthResult;
				if (!_fb.TryParseOAuthCallbackUrl (new Uri (wb.Request.Url.ToString()), out oauthResult))
				{
					return;
				}
				
				if (oauthResult.IsSuccess)
				{
					// Facebook Granted Token
					var accessToken = oauthResult.AccessToken;
					LoginSucceded(accessToken, dvc);
				}
				else
				{
					// user cancelled login
					LoginSucceded(string.Empty, dvc);
				}
			};

			web.LoadError += (webview, args) => {
				NetworkActivity = false;
				if (web != null)
					web.LoadHtmlString (
						String.Format ("<html><center><font size=+5 color='red'>{0}:<br>{1}</font></center></html>",
					               "An error occurred: ", args.Error.LocalizedDescription), null);
			};
			vc.NavigationItem.Title = Caption;
			
			vc.View.AutosizesSubviews = true;
			vc.View.AddSubview (web);

			dvc.ActivateController (vc);
			web.LoadRequest (NSUrlRequest.FromUrl (nsUrl));
		}
Exemple #27
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new MyViewController (this) {
                Autorotate = dvc.Autorotate
            };
            datePicker = CreatePicker ();
            datePicker.Frame = PickerFrameWithSize (datePicker.SizeThatFits (SizeF.Empty));

            vc.View.BackgroundColor = UIColor.Black;
            vc.View.AddSubview (datePicker);
            dvc.ActivateController (vc);
        }
Exemple #28
0
 public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     var newDvc = MakeViewController ();
     PrepareDialogViewController (newDvc);
     dvc.ActivateController (newDvc);
 }
Exemple #29
0
		void msgSelected (DialogViewController dvc, UITableView tv, NSIndexPath path)
		{
			var np = new DialogViewController (new RootElement ("Message Display") {
				new Section () {
					new StyledMultilineElement (
	                    "From: foo\n" +
	                    "To: bar\n" +
	                    "Subject: Hey there\n\n" +
	                    "This is very simple!")
				}
			}, true);
			dvc.ActivateController (np);
		}
Exemple #30
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new WebViewController (this) {
                Autorotate = dvc.Autorotate
            };
            web = new UIWebView (UIScreen.MainScreen.ApplicationFrame){
                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);
            web.LoadRequest (NSUrlRequest.FromUrl (nsUrl));
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
        {
            var eds = new MWC.iOS.Screens.iPhone.UserGroups.UserGroupDetailsScreen (usergroup.ID);

            if (splitView != null)
                splitView.ShowUserGroup(usergroup.ID, eds);
            else
                dvc.ActivateController (eds);
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            model = new TimePickerDataModel(model.Time);
            var vc = new MyViewController (this) {
                Autorotate = dvc.Autorotate
            };
            counterPicker = CreatePicker ();
            counterPicker.Frame = PickerFrameWithSize (counterPicker.SizeThatFits (SizeF.Empty));
            counterPicker.Model = model;
            for (int d = 0; d < model.Times.Count; d++) {
                counterPicker.Select(model.SelectedIndex[d], d, true);
            }

            // pass value changed
            model.ValueChanged += delegate {
                if (this.ValueChanged != null) {
                    Value = model.FormatValue ();

                    this.ValueChanged (this, new EventArgs ());
                }
            };

            vc.View.BackgroundColor = backgroundColor;
            vc.View.AddSubview (counterPicker);
            dvc.ActivateController (vc);
        }
 /// <summary>
 /// Behaves differently depending on iPhone or iPad
 /// </summary>
 public override void Selected(DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
 {
     var paperDetails = new WhitePaperBible.iOS.PaperDetailsView(paper);
     paperDetails.Title = paper.title;
     dvc.ActivateController(paperDetails);
 }
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			int i = 0;
			var vc = new WebViewController (this) {
				Autorotate = dvc.Autorotate
			};

			web = new UIWebView (UIScreen.MainScreen.Bounds) {
				BackgroundColor = UIColor.White,
				ScalesPageToFit = true,
				AutoresizingMask = UIViewAutoresizing.All
			};
			web.LoadStarted += delegate {
				// this is called several times and only one UIActivityIndicatorView is needed
				if (i++ == 0) {
					var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.White);
					vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (indicator);
					indicator.StartAnimating ();
				}
				NetworkActivity = true;
			};
			web.LoadFinished += delegate {
				if (--i == 0) {
					// we stopped loading, remove indicator and dispose of UIWebView
					vc.NavigationItem.RightBarButtonItem = null;
					web.StopLoading ();
					web.Dispose ();
				}
				NetworkActivity = false;
			};
			web.LoadError += (webview, args) => {
				NetworkActivity = false;
				vc.NavigationItem.RightBarButtonItem = null;
				if (web != null)
					web.LoadHtmlString (
						String.Format ("<html><center><font size=+5 color='red'>{0}:<br>{1}</font></center></html>",
						"An error occurred:".GetText (), args.Error.LocalizedDescription), null);
			};
			vc.NavigationItem.Title = Caption;
			
			vc.View.AutosizesSubviews = true;
			vc.View.AddSubview (web);
			
			dvc.ActivateController (vc);
			web.LoadRequest (NSUrlRequest.FromUrl (nsUrl));
		}
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var viewController = createOnSelected(apiNode);

            dvc.ActivateController(viewController);
        }
Exemple #36
0
 //
 // Dispatcher that can open various assorted link-like text entries
 //
 public void Open(DialogViewController controller, string data)
 {
     if (data.Length == 0)
         return;
     if (data [0] == '@'){
         var profile = new FullProfileView (Util.CleanName (data.Substring (1)));
         controller.ActivateController (profile);
     } else if (data [0] == '#'){
         var search = new SearchViewController (data.Substring (1)) { Account = TwitterAccount.CurrentAccount };
         controller.ActivateController (search);
     } else
         WebViewController.OpenUrl (controller, data);
 }
Exemple #37
0
        void MakeLoginDialog(DialogViewController parent, RootElement root)
        {
            loginDialog = new DialogViewController (UITableViewStyle.Grouped, root);

            if (parent == null){
                loginRoot = new UINavigationController (loginDialog);
                window.AddSubview (loginRoot.View);
            } else {
                loginDialog.NavigationItem.RightBarButtonItem =
                    new UIBarButtonItem (Locale.GetText ("Close"),
                                         UIBarButtonItemStyle.Plain,
                                         delegate { loginDialog.DismissModalViewControllerAnimated (true); });
                parent.ActivateController (loginDialog);
            }
        }
Exemple #38
0
 public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     if (picker == null)
         picker = new UIImagePickerController ();
     picker.Delegate = new MyDelegate (this);
     dvc.ActivateController (picker);
     currentController = dvc;
 }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            if (picker == null)
                picker = new UIImagePickerController ();
            picker.Delegate = new MyDelegate (this, tableView, path);

            var hasCamera = picker.MediaTypes;
            picker.SourceType = hasCamera.Length == 1 ? UIImagePickerControllerSourceType.PhotoLibrary : UIImagePickerControllerSourceType.Camera;

            switch (UIDevice.CurrentDevice.UserInterfaceIdiom){
            case UIUserInterfaceIdiom.Pad:
                RectangleF useRect;
                popover = new UIPopoverController (picker);
                var cell = tableView.CellAt (path);
                if (cell == null)
                    useRect = rect;
                else
                    rect = cell.Frame;
                popover.PresentFromRect (rect, dvc.View, UIPopoverArrowDirection.Any, true);
                break;

            default:
            case UIUserInterfaceIdiom.Phone:
            dvc.ActivateController (picker);
                break;
            }
            currentController = dvc;
        }
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (picker == null)
				picker = new UIImagePickerController ();
			picker.Delegate = new MyDelegate (this);
			
			switch (UIDevice.CurrentDevice.UserInterfaceIdiom){
			case UIUserInterfaceIdiom.Pad:
				RectangleF rect;
				popover = new UIPopoverController (picker);
				var cell = tableView.CellAt (path);
				if (cell == null)
					rect = new RectangleF (0, 0, dimx, dimy);
				else
					rect = cell.Frame;
				popover.PresentFromRect (rect, dvc.View, UIPopoverArrowDirection.Any, true);
				break;
				
			default:
			case UIUserInterfaceIdiom.Phone:
				dvc.ActivateController (picker);
				break;
			}
			currentController = dvc;
		}
 /// <summary>
 /// Behaves differently depending on iPhone or iPad
 /// </summary>
 public override void Selected(DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
 {
     if (this.PatientsSplitView != null)
         this.PatientsSplitView.ShowPatient(Patient.Id);
     else
     {
         var detailsScreen = new PatientDetailsScreen(Patient.Id) { Title = "Patient" };
         dvc.ActivateController(detailsScreen);
     }
 }
Exemple #42
0
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (Url == null){
				base.Selected (dvc, tableView, path);
				return;
			}
			
			tableView.DeselectRow (path, false);
			if (loading)
				return;
			var cell = GetActiveCell ();
			var spinner = StartSpinner (cell);
			loading = true;

			var request = new NSUrlRequest (new NSUrl (Url), NSUrlRequestCachePolicy.UseProtocolCachePolicy, 60);
			new NSUrlConnection (request, new ConnectionDelegate ((data,error) => {
				loading = false;
				spinner.StopAnimating ();
				spinner.RemoveFromSuperview ();
				if (error == null){
					try {
						var obj = JsonValue.Load (new StreamReader (data)) as JsonObject;
						if (obj != null){
							var root = JsonElement.FromJson (obj);
							var newDvc = new DialogViewController (root, true) {
								Autorotate = true
							};
							PrepareDialogViewController (newDvc);
							dvc.ActivateController (newDvc);
							return;
						}
					} catch (Exception ee){
						Console.WriteLine (ee);
					}
				}
				var alert = new UIAlertView ("Error", "Unable to download data", null, "Ok");
				alert.Show ();
			}));
		}