Ejemplo n.º 1
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			NavBar=new UINavigationBar(new CoreGraphics.CGRect (0, 0, pview.uvWidth, 44));
			NavBar.BackgroundColor = UIColor.Red;
//			UIBarButtonItem bbitemCancel = new UIBarButtonItem (UIBarButtonSystemItem.Cancel, CancelButtonClicked);
			UIButton btnCancel = new UIButton (new CGRect (0, 0, 80, 30));
			btnCancel.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			btnCancel.SetTitle ("Cancel", UIControlState.Normal);
			btnCancel.TouchUpInside += (object sender, EventArgs e) => {
				pview.popover.Dismiss(false);
			};
			UIBarButtonItem bbitemCancel = new UIBarButtonItem (btnCancel);

//			UIBarButtonItem bbitemDone = new UIBarButtonItem (UIBarButtonSystemItem.Done, DoneButtonClicked);
			UIButton btnDone = new UIButton (new CGRect (0, 0, 80, 30));
			btnDone.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			btnDone.SetTitle ("Done", UIControlState.Normal);
			btnDone.TouchUpInside += (object sender, EventArgs e) => {
				pview.DismissPopOver ();
			};
			UIBarButtonItem bbitemDone = new UIBarButtonItem (btnDone);

			UINavigationItem navgitem = new UINavigationItem ("Select");
			navgitem.SetLeftBarButtonItem(bbitemCancel,true);
			navgitem.SetRightBarButtonItem (bbitemDone, true);
			NavBar.PushNavigationItem(navgitem,true);
			this.View.Add (NavBar);
			searchBar=new UISearchBar(new CoreGraphics.CGRect (0, 44, pview.uvWidth, 44));
			this.View.Add(searchBar);
			rvc = new RootViewController (RootData,pview);
			rvc.View.Frame = new CoreGraphics.CGRect (0, 88, pview.uvWidth, 600);
			this.subview.SetRootview(rvc);
			this.View.Add (rvc.View);
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.NavigationItem.Title = "Choose a currency";

            UINavigationBar navBar = new UINavigationBar();

            navBar.Frame = new CGRect(0, 0, this.View.Bounds.Width, 50);

            navBar.BarStyle = UIBarStyle.Default;


            UIBarButtonItem cancelButton = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, (sender, e) => {
                this.DismissViewController(true, () =>
                {
                    this.Dispose();
                });
            });

            UINavigationItem cancel = new UINavigationItem();

            cancel.SetLeftBarButtonItem(cancelButton, true);

            navBar.Items = new UINavigationItem[] { cancel };
            this.View.AddSubview(navBar);
        }
Ejemplo n.º 3
0
        public ToolBarBackView(UINavigationItem navigationItem, UINavigationBar navigationBar)
        {
            _navigationItem = navigationItem;
            _navigationBar  = navigationBar;

            _backButton = new UIBarButtonItem(new UIImage(), UIBarButtonItemStyle.Plain, (sender, e) => { Presenter.BackClick(); });
            _navigationItem.SetLeftBarButtonItem(_backButton, true);
        }
Ejemplo n.º 4
0
 public static void AddButtonItem(this UINavigationItem navigationItem, UIBarButtonItem item, bool left)
 {
     if (left)
     {
         navigationItem.SetLeftBarButtonItem(item, false);
     }
     else
     {
         navigationItem.SetRightBarButtonItem(item, false);
     }
 }
Ejemplo n.º 5
0
        public ToolBarPostsView(UINavigationItem navigationItem, UINavigationBar navigationBar)
        {
            _navigationItem = navigationItem;
            _navigationBar  = navigationBar;

            _moreButton = new UIBarButtonItem(new UIImage(), UIBarButtonItemStyle.Plain, (sender, e) => { Presenter.MoreClick(); });
            _navigationItem.SetLeftBarButtonItem(_moreButton, true);

            _createPostButton = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, (sender, e) => { Presenter.CreatePostClick(); });
            _navigationItem.SetRightBarButtonItem(_createPostButton, true);
        }
 public static void SetupNavigationBar(SidebarNavigation.SidebarController sidebarController, NavController navController, UINavigationItem navItem, UIBarButtonItem menuButton)
 {
     menuButton = new UIBarButtonItem(UIImage.FromBundle("hamburger_menu_white.png")
                                      , UIBarButtonItemStyle.Plain
                                      , (sender, args) => {
         sidebarController.ToggleMenu();
     });
     //menuButton.TintColor = Helper.Theme.Color.C2;
     navItem.SetLeftBarButtonItem(menuButton, true);
     navController.NavigationBar.BackgroundColor = Helper.Theme.Color.C2;
     navController.NavigationBar.BarStyle        = UIBarStyle.BlackOpaque;
     navController.NavigationBar.TintColor       = Helper.Theme.Color.C1;
     navController.NavigationBar.BarTintColor    = Helper.Theme.Color.C2;
 }
 public static void SetupNavigationBar(SidebarNavigation.SidebarController sidebarController, NavController navController, UINavigationItem navItem, UIBarButtonItem menuButton)
 {
     menuButton = new UIBarButtonItem(UIImage.FromBundle("hamburger_menu_white.png")
             , UIBarButtonItemStyle.Plain
             , (sender, args) => {
                 sidebarController.ToggleMenu();
             });
     //menuButton.TintColor = Helper.Theme.Color.C2;
     navItem.SetLeftBarButtonItem(menuButton, true);
     navController.NavigationBar.BackgroundColor = Helper.Theme.Color.C2;
     navController.NavigationBar.BarStyle = UIBarStyle.BlackOpaque;
     navController.NavigationBar.TintColor = Helper.Theme.Color.C1;
     navController.NavigationBar.BarTintColor = Helper.Theme.Color.C2;
 }
        /// <summary>
        /// Sets the back button.
        /// </summary>
        /// <param name="navigationItem">The navigation item.</param>
        public static void SetHamburgerMenu(UINavigationItem navigationItem, UIView parentView)
        {
            //var button = new UIButton(UIButtonType.Custom)
            //{
            //	Frame = new CGRect(0, 0, 25, 25) //You may need to adjust as necessary
            //}
            //;
            //button.SetTitle("Menu", UIControlState.Normal);
            //button.SetTitleColor(UIColor.Black, UIControlState.Normal);

            //create a UIBarButtonItem with a UIButton as the custom view.
            //var barButtonItem = new UIBarButtonItem(button);

            navigationItem.SetLeftBarButtonItem(new UIBarButtonItem(
                                                    "Menu", UIBarButtonItemStyle.Plain, (sender, e) =>
            {
                ShowSideBar(parentView);
            }), true);
        }
        /// <summary>
        /// Construct the UI
        /// </summary>
        public override void LoadView()
        {
            UIWindow   appWindow      = UIApplication.SharedApplication.Delegate.Window;
            float      titlebarHeight = 45F;
            float      appHeight      = appWindow.Frame.Size.Height;
            float      appWidth       = appWindow.Frame.Size.Width;
            RectangleF frame          = new RectangleF(0F, 0F, appWidth, appHeight);

            topView = new UIView(frame);
            topView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            RectangleF barFrame = new RectangleF(0F, 0F, appWidth, titlebarHeight);

            titleBar                  = new UINavigationBar(barFrame);
            titleBar.BarStyle         = UIBarStyle.Black;
            titleBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;

            RectangleF webviewFrame = new RectangleF(0F, titlebarHeight, appWidth, appHeight - titleBar.Frame.Size.Height);

            webView = new UIWebView(webviewFrame);
            webView.ScalesPageToFit = true;

            RectangleF activityFrame = new RectangleF(appWidth / 2 - 12.5f, appHeight / 2 - 12.5f, 25F, 25F);

            activityView = new UIActivityIndicatorView(activityFrame);
            activityView.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;
            activityView.SizeToFit();
            activityView.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin;

            topView.AddSubview(titleBar);
            topView.AddSubview(activityView);
            topView.AddSubview(webView);

            UINavigationItem titleBarItem = new UINavigationItem("Login");
            UIBarButtonItem  done         = new UIBarButtonItem("Close", UIBarButtonItemStyle.Done, delegate(object sender, EventArgs e) {
                cancelled = true;
                CloseView();
            });

            titleBarItem.SetLeftBarButtonItem(done, true);
            titleBar.PushNavigationItem(titleBarItem, true);

            this.View = topView;
        }
Ejemplo n.º 10
0
        public static void SetButton(this UINavigationItem navigationItem, UIButton button, bool left)
        {
            button.SizeToFit();
            var view = new UIView
            {
                Frame = button.Bounds
            };

            view.AddSubview(button);

            if (left)
            {
                button.Frame = new CGRect(-4, 0, button.Bounds.Width, button.Bounds.Height);
                navigationItem.SetLeftBarButtonItem(new UIBarButtonItem(view), false);
            }
            else
            {
                button.Frame = new CGRect(8, 0, button.Bounds.Width, button.Bounds.Height);
                navigationItem.SetRightBarButtonItem(new UIBarButtonItem(view), false);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Construct the UI
        /// </summary>
		public override void LoadView()
		{
			UIWindow appWindow = UIApplication.SharedApplication.Delegate.Window;
			float titlebarHeight = 45F;
			float appHeight = appWindow.Frame.Size.Height;
			float appWidth = appWindow.Frame.Size.Width;
			RectangleF frame = new RectangleF (0F, 0F, appWidth, appHeight);
			topView = new UIView (frame);
			topView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			RectangleF barFrame = new RectangleF (0F, 0F, appWidth, titlebarHeight);
			titleBar = new UINavigationBar (barFrame);
			titleBar.BarStyle = UIBarStyle.Black;
			titleBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;

			RectangleF webviewFrame = new RectangleF (0F, titlebarHeight, appWidth, appHeight - titleBar.Frame.Size.Height);
			webView = new UIWebView (webviewFrame);
			webView.ScalesPageToFit = true;

			RectangleF activityFrame = new RectangleF(appWidth/2 - 12.5f, appHeight/2 -12.5f, 25F, 25F);
			activityView = new UIActivityIndicatorView (activityFrame);
			activityView.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;
			activityView.SizeToFit ();
			activityView.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin;

			topView.AddSubview (titleBar);
			topView.AddSubview (activityView);
			topView.AddSubview (webView);

			UINavigationItem titleBarItem = new UINavigationItem ("Login");
			UIBarButtonItem done = new UIBarButtonItem ("Close", UIBarButtonItemStyle.Done, delegate (object sender, EventArgs e) {
				cancelled = true;
				CloseView();
			});

			titleBarItem.SetLeftBarButtonItem (done, true);
			titleBar.PushNavigationItem (titleBarItem, true);

			this.View = topView;
		}
Ejemplo n.º 12
0
        private void ConfigureNavigationBar()
        {
            _navigationItem = NavigationItem;

            if (Comparable == null)
            {
                Title = "Product";
                var cancelButton = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (sender, args) =>
                {
                    OnCanceled.Fire(this, EventArgs.Empty);
                });

                _navigationItem.SetRightBarButtonItem(GetDoneButton(), false);
                _navigationItem.SetLeftBarButtonItem(cancelButton, false);
            }
            else
            {
                NavigationController.SetNavigationBarHidden(false, false);
                NavigationItem.RightBarButtonItem = GetDoneButton();
                Title = string.IsNullOrEmpty(Comparable.Product) ? "Product" : Comparable.Product;
            }
        }
Ejemplo n.º 13
0
        public void transferBarButtonItem(UIViewController vc)
        {
            // Get the navigation controller in the detail spot of the split view controller
            UINavigationController nvc = this.SplitViewController.ViewControllers[1] as UINavigationController;

            // Get the root view controller out of that nav controller
            UIViewController currentVC = nvc.ViewControllers[0] as UIViewController;

            // If it's the same view controller, let's not do anything
            if (vc == currentVC)
            {
                return;
            }

            // Get that view controller's navigation item
            UINavigationItem currentVCItem = currentVC.NavigationItem;

            // Tell the new view controller to use thleft bar button item of current nav item
            vc.NavigationItem.SetLeftBarButtonItem(currentVCItem.LeftBarButtonItem, true);

            // Remove the bar button item from the current view controller's nav item
            currentVCItem.SetLeftBarButtonItem(null, true);
        }
Ejemplo n.º 14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            this.View.Layer.Frame = new CoreGraphics.CGRect (0, 0, uvWidth, uvheight);
            mutListView = new UITableView (new CoreGraphics.CGRect (0, 88, uvWidth, uvheight-100));
            mutListView.AllowsMultipleSelection = AllowsMultipleSelection;
            mutListView.AllowsMultipleSelectionDuringEditing = AllowsMultipleSelection;
            NavBar=new UINavigationBar(new CoreGraphics.CGRect (0, 0, uvWidth, 44));
            //			UIBarButtonItem bbitemCancel = new UIBarButtonItem (UIBarButtonSystemItem.Cancel, CancelButtonClicked);
            UIButton btnCancel = new UIButton (new CGRect (0, 0, 80, 30));
            btnCancel.SetTitleColor (UIColor.Blue, UIControlState.Normal);
            btnCancel.SetTitle ("Cancel", UIControlState.Normal);
            btnCancel.TouchUpInside += (object sender, EventArgs e) => {
                popover.Dismiss(false);
            };
            UIBarButtonItem bbitemCancel = new UIBarButtonItem (btnCancel);

            //			UIBarButtonItem bbitemDone = new UIBarButtonItem (UIBarButtonSystemItem.Done, DoneButtonClicked);
            UIButton btnDone = new UIButton (new CGRect (0, 0, 80, 30));
            btnDone.SetTitleColor (UIColor.Blue, UIControlState.Normal);
            btnDone.SetTitle ("Done", UIControlState.Normal);
            btnDone.TouchUpInside += (object sender, EventArgs e) => {
                DismissPopOver();
            };
            UIBarButtonItem bbitemDone = new UIBarButtonItem (btnDone);

            UINavigationItem navgitem = new UINavigationItem ("Select");
            navgitem.SetLeftBarButtonItem(bbitemCancel,true);
            navgitem.SetRightBarButtonItem (bbitemDone, true);
            NavBar.PushNavigationItem(navgitem,true);
            searchBar=new UISearchBar(new CoreGraphics.CGRect (0, 44, uvWidth, 44));
            this.View.Add (NavBar);
            this.View.AddSubview(mutListView);
            this.View.AddSubview(searchBar);
            this.mutListView.Source =new mCodePickerSource(this);
            //mutListView.SetContentOffset (new CoreGraphics.CGPoint (0, mutListView.ContentSize.Height - mutListView.Frame.Size.Height), false);
            //CoreGraphics.CGRect fram = mutListView.Frame;
            //fram.Height = mutListView.ContentSize.Height;
            //	mutListView.Frame = fram;
            this.searchBar.TextChanged += (object sender, UISearchBarTextChangedEventArgs e) =>
            {
                //DataSource.Clear();
                DataSource=tempds.FindAll(u=>u.ItemText.ToLower().Contains(searchBar.Text.ToLower()));
                this.mutListView.Source =new mCodePickerSource(this);
                this.mutListView.ReloadData();
                searchBar.ShowsCancelButton = true;

            };

            this.searchBar.CancelButtonClicked += (object sender, EventArgs e) => {
                searchBar.Text=string.Empty;
                DataSource=tempds;
                searchBar.ResignFirstResponder();
                searchBar.ShowsCancelButton = false;
                this.mutListView.ReloadData();
            };
            //lbltitle.Title = "Select";
            //btnDone.Clicked+= (object sender, EventArgs e) => {
            //	DismissPopOver();
            //};
            //BtnCancel.Clicked+= (object sender, EventArgs e) => {
            //
            //};
            //mTrashBtn.Clicked+= (object sender, EventArgs e) => {
                //if(popover!=null)
                //	popover.Dismiss(false);
            //};
            // Perform any additional setup after loading the view, typically from a nib.
        }
Ejemplo n.º 15
0
        private void Initialize()
        {
            var view = new EventedView(View.Frame);

            view.OnTouchesEnded += (sender, args) =>
            {
                _tableView.ResignTextFieldAsFirstResponder();
            };

            View = view;

            // add navigation item
            View.BackgroundColor = UIColor.GroupTableViewBackgroundColor;
            var navigationBar = new UINavigationBar(new RectangleF(0, 0, View.Frame.Width, 44));
            //navigationBar.TintColor = UIColor.DarkGray;
            var navigationItem = new UINavigationItem(Comparison == null ? "New Comparison" : Comparison.Name);
            var doneButton     = new UIBarButtonItem(UIBarButtonSystemItem.Done, (sender, args) =>
            {
                if (_tableView.ComparisonName == null || _tableView.ComparisonName.Trim() == string.Empty)
                {
                    new UIAlertView("Warning", "Please provide a comparison name", null, "Dismiss").Show();
                    return;
                }

                if (Comparison == null)
                {
                    Comparison = new ComparisonModel()
                    {
                        Name       = _tableView.ComparisonName.Trim(),
                        UnitId     = _unitPicker.SelectedUnit.Id,
                        UnitTypeId = _tableView.UnitTypeId
                    };
                    Comparison.Id = DataService.SaveComparison(Comparison);
                }
                else
                {
                    Comparison.Name       = _tableView.ComparisonName.Trim();
                    Comparison.UnitId     = _unitPicker.SelectedUnit.Id;
                    Comparison.UnitTypeId = _tableView.UnitTypeId;
                    DataService.UpdateComparison(Comparison);
                }

                if (OnFinished != null)
                {
                    OnFinished(this, EventArgs.Empty);
                }
            });

            var cancelButton = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (sender, args) =>
            {
                if (Comparison != null)
                {
                    navigationItem.Title = Comparison.Name;
                }

                if (OnCanceled != null)
                {
                    OnCanceled(this, EventArgs.Empty);
                }
            });

            navigationItem.SetRightBarButtonItem(doneButton, false);
            navigationItem.SetLeftBarButtonItem(cancelButton, false);
            navigationBar.PushNavigationItem(navigationItem, false);
            View.AddSubview(navigationBar);

            _tableView = new ComparisonTableView(new RectangleF(0, 44, View.Frame.Width, View.Frame.Height - 44), UITableViewStyle.Grouped);
            _tableView.OnUnitTypeChanged += (sender, args) =>
            {
                _unitPicker.SetUnitType(_tableView.UnitTypeId);
                _tableView.SetUnitText(_unitPicker.SelectedUnit.FullName);
            };

            _tableView.OnTouchesEnded += (sender, args) =>
            {
                _tableView.ResignTextFieldAsFirstResponder();
            };

            _tableView.OnKeyboardDone += (sender, args) =>
            {
                _tableView.ResignTextFieldAsFirstResponder();
            };

            if (Comparison != null)
            {
                _tableView.OnNameChanged += (sender, args) =>
                {
                    navigationItem.Title = _tableView.ComparisonName;
                };
            }

            View.AddSubview(_tableView);

            if (Comparison == null)
            {
                _unitPicker = new UnitPicker(1, new RectangleF(0, View.Frame.Height - 216, 320, 216));
            }
            else
            {
                _unitPicker = new UnitPicker(Comparison.UnitTypeId, new RectangleF(0, View.Frame.Height - 216, 320, 216));
            }

            _unitPicker.OnSelectionChanged += (sender, args) =>
            {
                _tableView.SetUnitText(_unitPicker.SelectedUnit.FullName);
            };

            View.AddSubview(_unitPicker);
        }
Ejemplo n.º 16
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            View.Layer.Frame = new CoreGraphics.CGRect (0, 0, uvWidth, uvheight);
            NavBar=new UINavigationBar(new CoreGraphics.CGRect (0, 0, uvWidth, 44));
            utListView = new UITableView (new CoreGraphics.CGRect (0, 44, uvWidth, uvheight));
            //			UIBarButtonItem TrashBtn = new UIBarButtonItem (UIBarButtonSystemItem.Cancel, TrashBtnClicked);

            UIButton btnCancel = new UIButton (new CGRect (0, 0, 80, 30));
            btnCancel.SetTitleColor (UIColor.Blue, UIControlState.Normal);
            btnCancel.SetTitle ("Cancel", UIControlState.Normal);
            btnCancel.TouchUpInside += (object sender, EventArgs e) => {
                if(popover!=null)
                    popover.Dismiss(false);
            };
            UIBarButtonItem TrashBtn = new UIBarButtonItem (btnCancel);

            UINavigationItem navgitem = new UINavigationItem ("Select");
            navgitem.SetLeftBarButtonItem (TrashBtn, true);
            NavBar.PushNavigationItem(navgitem,true);
            searchBar=new UISearchBar(new CoreGraphics.CGRect (100, 0, uvWidth-100, 44));
            this.View.Add (NavBar);
            this.View.AddSubview(utListView);
            this.View.AddSubview(searchBar);
            this.utListView.Source =new CodePickerSource(this);
            searchBar.BecomeFirstResponder ();
            searchBar.Text = searchkey;
            searchBar.TextChanged+= async (object sender, UISearchBarTextChangedEventArgs e) => {
                if(!string.IsNullOrEmpty(searchBar.Text))
                {
                    AppDelegate.pb.Start(this.View,"Searching...");
                    var webClient = new WebClient();
                    string url =  "http://reference.iprocedures.com/"+type+"/"+searchBar.Text.Trim()+"/20";
                    string procData = webClient.DownloadString (url);
                    procedureItems = (ProcedureDiagnosticMaster)JsonConvert.DeserializeObject (procData, typeof(ProcedureDiagnosticMaster));
                    int uwidth = 0;
                    DataSource = SetProcedureDataSource(out uwidth);
                    this.utListView.Source =new CodePickerSource(this);
                    this.utListView.ReloadData();
                    AppDelegate.pb.Stop();
                }

                    //RectangleF fillrect = new RectangleF(0,0,uwidth,uvheight);
                    //this.View.Frame=fillrect;

            };

            // Perform any additional setup after loading the view, typically from a nib.
        }