Example #1
0
        /// <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);
        }
Example #2
0
        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));
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            if (_picker == null)
            {
                _picker = new UIImagePickerController();
            }
            _picker.Delegate = new MyUIImagePickerDelegate(this, tableView, path);

            switch (UIDevice.CurrentDevice.UserInterfaceIdiom)
            {
            case UIUserInterfaceIdiom.Pad:
                _popover = new UIPopoverController(_picker);
                var cell = tableView.CellAt(path);
                if (cell != null)
                {
                    _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)
        {
            tableView.DeselectRow(path, false);
            var newDvc = MakeViewController();

            PrepareDialogViewController(newDvc);
            dvc.ActivateController(newDvc);
        }
Example #5
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();
        }
        /// <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);
        }
Example #7
0
        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);
            }
        }
Example #8
0
        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);
            }
        }
Example #9
0
        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);
            }
        }
Example #10
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);
            }
        }
Example #11
0
 /// <summary>
 /// Behaves differently depending on iPhone or iPad
 /// </summary>
 public override void Selected(DialogViewController dvc, UITableView tableView, Foundation.NSIndexPath path)
 {
     if (splitView != null)
     {
         splitView.ShowSession(session.ID);
     }
     else
     {
         var sds = new MWC.iOS.Screens.iPhone.Sessions.SessionDetailsScreen(session.ID);
         sds.Title = "Session";
         dvc.ActivateController(sds);
     }
 }
Example #12
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);
        }
 /// <summary>
 /// Behaves differently depending on iPhone or iPad
 /// </summary>
 public override void Selected(DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
 {
     if (this.splitViewController != null)
     {
         this.splitViewController.ShowPatient(this.patient);
     }
     else
     {
         var detailViewController = this.ObjectFactory.Create <PatientDetailViewController>(new NamedParameterOverloads {
             { "patientId", this.patient.Id }
         });
         detailViewController.Title = "Patient";
         dvc.ActivateController(detailViewController);
     }
 }
Example #14
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);
     }
 }
Example #15
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);
        }
Example #16
0
        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,
                ScalesPageToFit = true,
#warning UIViewAutoresizing.All not in my version of MonoTouch - so use long form here
                AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin
                                   | UIViewAutoresizing.FlexibleRightMargin
                                   | UIViewAutoresizing.FlexibleHeight
                                   | UIViewAutoresizing.FlexibleTopMargin
                                   | UIViewAutoresizing.FlexibleLeftMargin
                                   | UIViewAutoresizing.FlexibleWidth
            };
            _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'>{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));
        }
Example #17
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);
            }
        }
Example #18
0
        public override void Selected(DialogViewController dvc, UITableView tableView, Foundation.NSIndexPath path)
        {
            var tds = new MWC.iOS.Screens.iPhone.Twitter.TweetDetailsScreen(tweet);

            if (dvc.NavigationController != null)
            {
                dvc.NavigationController.NavigationBar.Translucent = false;
            }

            if (splitView != null)
            {
                splitView.ShowTweet(tweet.ID, tds);
            }
            else
            {
                dvc.ActivateController(tds);
            }
        }
Example #19
0
        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);
        }
Example #20
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new DateTimeViewController(this)
            {
                Autorotate = dvc.Autorotate
            };

            if (_datePicker == null)
            {
                _datePicker = CreatePicker();
            }
            _datePicker.Date = (NSDate)DateTimeToPickerDateTime(Value ?? DateTime.UtcNow);

            vc.View.BackgroundColor = BackgroundColor;
            vc.View.AddSubview(_datePicker);
            dvc.ActivateController(vc);

            //ensure picker will stay centered, regardless current screen orientation
            _datePicker.Center = vc.View.Center;
        }
Example #21
0
        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,
                ScalesPageToFit  = true,
                AutoresizingMask = UIViewAutoresizing.All
            };
            _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;
                _web?.LoadHtmlString(
                    $"<html><center><font size=+5 color='red'>{"An error occurred:".GetText()}:<br>{args.Error.LocalizedDescription}</font></center></html>", null);
            };
            vc.NavigationItem.Title = Caption;

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

            dvc.ActivateController(vc);
            _web.LoadRequest(NSUrlRequest.FromUrl(_nsUrl));
        }
Example #22
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new SimplePickerViewController(this)
            {
                Autorotate = dvc.Autorotate
            };

            _picker       = CreatePicker();
            _picker.Frame = PickerFrameWithSize(_picker.SizeThatFits(SizeF.Empty));

            if (Entries != null)
            {
                var index = Entries.IndexOf(Value);
                if (index >= 0)
                {
                    _picker.Select(index, 0, true);
                }
            }

            vc.View.BackgroundColor = UIColor.Black;
            vc.View.AddSubview(_picker);
            dvc.ActivateController(vc);
        }
Example #23
0
        public RootElement CreateRoot()
        {
            return(new RootElement("Tapku Library")
            {
                new Section("Views")
                {
                    new StringElement("Coverflow", () => {
                        dvc.PresentModalViewController(new CoverflowViewController(), true);
//						dvc.ActivateController(new CoverflowViewController());
                    }),
                    new StringElement("Month Grid Calendar", () => {
                        dvc.ActivateController(new DemoCalendarMonth());
                    }),
                },
                new Section("UI Elements")
                {
                    new StringElement("Empty Sign", () => {
                        dvc.ActivateController(new EmptyViewController());
                    }),
                    new StringElement("Loading HUD", () => {
                        dvc.ActivateController(new HUDViewController());
                    }),
                    new StringElement("Alerts", () => {
                        dvc.ActivateController(new AlertsViewController());
                    }),
                    new StringElement("Place Pins", () => {
                        dvc.ActivateController(new MapViewController());
                    }),
                },
                new Section("Network")
                {
                    new StringElement("Image Cache", () => {
                        dvc.ActivateController(new ImageCenterViewController());
                    }),
                },
            });
        }
Example #24
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var full = new FullProfileView(TwitterAccount.CurrentAccount.Username);

            dvc.ActivateController(full);
        }
Example #25
0
 public override void Selected(DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
 {
     dvc.ActivateController(new FullProfileView(Caption));
 }
        public override void Selected(DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
        {
            var svc = new SessionViewController(session);

            dvc.ActivateController(svc);
        }
Example #27
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var profile = new DetailTweetViewController(Tweet);

            dvc.ActivateController(profile);
        }
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var vc = CreateEditorController(dvc);
			vc.Autorotate = true; 
			dvc.ActivateController (vc);
		}
Example #29
0
        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,
                    ScalesPageToFit = true,
                    AutoresizingMask = UIViewAutoresizing.All
                };
            _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'>{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));
        }
Example #30
0
        public override void Selected(DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
        {
            var sds = new HomeViewController(entry);

            dvc.ActivateController(sds);
        }
 void viewHighScores()
 {
     dvc.ActivateController(new HighScoreViewController());
 }