コード例 #1
7
		void ReleaseDesignerOutlets ()
		{
			if (EditButton != null) {
				EditButton.Dispose ();
				EditButton = null;
			}
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var camera = CameraPosition.FromCamera (-37.81969, 144.966085, 4);
            mapView = MapView.FromCamera (RectangleF.Empty, camera);
            View = mapView;

            mapView.LongPress += HandleLongPress;

            // Add a default marker around Sydney.
            var sydneyMarker = new Marker () {
                Title = "Sydney!",
                Icon = UIImage.FromBundle ("glow-marker"),
                Position = new CLLocationCoordinate2D (-33.8683, 151.2086),
                Map = mapView
            };

            // Create a list of markers, adding the Sydney marker.
            markers = new List<Marker> () { sydneyMarker };

            // Create a button that, when pressed, updates the camera to fit the bounds
            // of the specified markers.
            var fitBoundsButton = new UIBarButtonItem ("Fit Bounds", UIBarButtonItemStyle.Plain, DidTapFitBounds);
            NavigationItem.RightBarButtonItem = fitBoundsButton;
        }
コード例 #3
1
ファイル: textview.cs プロジェクト: CBrauer/monotouch-samples
	public override void ViewDidLoad ()
	{
		base.ViewDidLoad ();

		Title = "Text View";
		textView = new UITextView (View.Frame){
			TextColor = UIColor.Black,
			Font = UIFont.FromName ("Arial", 18f),
			BackgroundColor = UIColor.White,
			Text = "This code brought to you by ECMA 334, ECMA 335 and the Mono Team at Novell\n\n\nEmbrace the CIL!",
			ReturnKeyType = UIReturnKeyType.Default,
			KeyboardType = UIKeyboardType.Default,
			ScrollEnabled = true,
			AutoresizingMask = UIViewAutoresizing.FlexibleHeight,
		};

		// Provide our own save button to dismiss the keyboard
		textView.Started += delegate {
			var saveItem = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate {
				textView.ResignFirstResponder ();
				NavigationItem.RightBarButtonItem = null;
				});
			NavigationItem.RightBarButtonItem = saveItem;
		};

		View.AddSubview (textView);
	}
コード例 #4
1
ファイル: CommitView.cs プロジェクト: xNUTs/CodeBucket
        public CommitView()
        {
			_viewSegment = new UISegmentedControl(new [] { "Changes", "Comments", "Approvals" });
			_viewSegment.SelectedSegment = 0;
			_viewSegment.ValueChanged += (sender, e) => Render();
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
        }
コード例 #5
1
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			webView = new UIWebView (new RectangleF(0, (_addCancelButton) ? navigationBarHeight : 0, View.Frame.Width, (_addCancelButton) ? View.Frame.Height - navigationBarHeight : View.Frame.Height));
			webView.Delegate = new WebViewDelegate(RequestStarted, RequestFinished);

			if (!_addCancelButton) {
				this.View.AddSubview (webView);
			} else {
				var cancelButton = new UIBarButtonItem (UIBarButtonSystemItem.Cancel);
				cancelButton.Clicked += (object sender, EventArgs e) => {
					_cancelled();
					this.DismissViewController(true, null);
				};

				var navigationItem = new UINavigationItem {
					LeftBarButtonItem = cancelButton
				};

				navigationBar = new UINavigationBar (new RectangleF (0, 0, View.Frame.Width, navigationBarHeight));
				navigationBar.PushNavigationItem (navigationItem, false);

				this.View.AddSubviews (navigationBar, webView);
			}
		}
コード例 #6
1
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationItem.TitleView = new UIImageView(UIImage.FromFile("Images/RusLogoStackBlkPPT.png"));

            items = new List<string>()
            {
                "Market Insights",
                "Russell Newsroom",
                "US Indexes",
                "Global Indexes",
                "Twitter"
            };

            var about = new UIBarButtonItem("About", UIBarButtonItemStyle.Bordered, null);
            about.Clicked += delegate(object sender, EventArgs e) {
                AboutViewController aboutView = new AboutViewController();
                aboutView.Title = "About";
                this.NavigationController.PushViewController(aboutView, true);
            };
            ToolbarItems = new UIBarButtonItem[] {about};

            TableView.DataSource = new TableViewDataSource(items);
            TableView.Delegate = new TableViewDelegate(this);
            TableView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight|UIViewAutoresizing.FlexibleWidth;
            TableView.BackgroundColor = UIColor.Clear;
            TableView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
        }
コード例 #7
0
 void ReleaseDesignerOutlets()
 {
     if (MoreMenuBtn != null) {
         MoreMenuBtn.Dispose ();
         MoreMenuBtn = null;
     }
 }
コード例 #8
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			Console.WriteLine ("DYNAMIC SPLIT VIEW DID LOAD");

			toggleButton = CreateToggleButton ();
			NavigationItem.RightBarButtonItems =
				(NavigationItem.RightBarButtonItems ?? new UIBarButtonItem[0]{}).
				Concat (new [] { toggleButton }).
				ToArray ();

			containerView.Frame = View.Bounds;
			containerView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

			containerView.AddSubview (First.View);
			containerView.AddSubview (Second.View);
			containerView.AddSubview (Splitter);
			View.AddSubview (containerView);
			containerView.SetNeedsLayout ();

			AddChildViewController (First);
			AddChildViewController (Second);

			Splitter.AddGestureRecognizer (new UIPanGestureRecognizer (HandlePanSplitter));
		}
コード例 #9
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			this.NavigationItem.HidesBackButton = true;
			if(isFrom == "")
				setAccountResponse (Constant.selectedAffialte );

			Appdata.setButtonBorder (btnSave);
			btnSave.BackgroundColor = Appdata.buttonBackgroundColor;

			if (UserInterfaceIsPhone)
				SetLayoytIPhone ();
			else
				SetLayoytIPad ();
			
			UIToolbar toolbar = new UIToolbar();
			toolbar.BarStyle = UIBarStyle.Default;
			toolbar.Translucent = true;
			toolbar.SizeToFit();

			// Create a 'done' button for the toolbar and add it to the toolbar
			UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
				(s, e) => {
					Console.WriteLine ("Calling Done!");
				});
			toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);
		}
コード例 #10
0
        public HomeViewController()
            : base(null)
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion (6,0)) {
                // UIRefreshControl iOS6
                RefreshControl = new UIRefreshControl();
                RefreshControl.ValueChanged += HandleValueChanged;
                AppDelegate.Conference.OnDownloadSucceeded += (jsonString) => {
                    Console.WriteLine ("OnDownloadSucceeded");
                    InvokeOnMainThread (() => {
                        RefreshControl.EndRefreshing ();
                    });
                };
                AppDelegate.Conference.OnDownloadFailed += (err) => {
                    Console.WriteLine ("OnDownloadFailed");
                    InvokeOnMainThread (() => {
                        RefreshControl.EndRefreshing ();
                    });
                };

                if (MonoTouch.PassKit.PKPassLibrary.IsAvailable) {
                    // PassKit
                    bbi = new UIBarButtonItem(UIImage.FromBundle ("Images/TicketIcon"), UIBarButtonItemStyle.Plain, (sender, e) => {
                        ShowPassKit();
                    });
                    NavigationItem.SetLeftBarButtonItem (bbi, false);
                }
            } else {
                // old style refresh button and no PassKit for older iOS
                NavigationItem.SetRightBarButtonItem (new UIBarButtonItem (UIBarButtonSystemItem.Refresh), false);
                NavigationItem.RightBarButtonItem.Clicked += (sender, e) => { Refresh(); };
            }
        }
コード例 #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            webView.ShouldStartLoad = delegate(UIWebView webViewParam, NSUrlRequest request, UIWebViewNavigationType navigationType) {
                // view links in a new 'webbrowser' window like session & twitter
                if (navigationType == UIWebViewNavigationType.LinkClicked) {
                    this.NavigationController.PushViewController (new WebViewController (request), true);
                    return false;
                }
                return true;
            };

            navBar = new UINavigationBar (new RectangleF (0, 0, 320, 44));
            var bbi = new UIBarButtonItem(UIImage.FromBundle ("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
                AppDelegate.Current.FlyoutNavigation.ToggleMenu();
            });
            var item = new UINavigationItem ("About MonkeySpace");
            item.LeftBarButtonItem = bbi;
            var items = new UINavigationItem[] {
                item
            };
            navBar.SetItems (items, false);

            View.Add (navBar);
        }
コード例 #12
0
        public static void ShareUrl(string url, UIBarButtonItem barButtonItem = null)
        {
            try
            {
                var item = new NSUrl(url);
                var activityItems = new NSObject[] { item };
                UIActivity[] applicationActivities = null;
                var activityController = new UIActivityViewController (activityItems, applicationActivities);

                if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) 
                {
                    var window = UIApplication.SharedApplication.KeyWindow;
                    var pop = new UIPopoverController (activityController);

                    if (barButtonItem != null)
                    {
                        pop.PresentFromBarButtonItem(barButtonItem, UIPopoverArrowDirection.Any, true);
                    }
                    else
                    {
                        var rect = new CGRect(window.RootViewController.View.Frame.Width / 2, window.RootViewController.View.Frame.Height / 2, 0, 0);
                        pop.PresentFromRect (rect, window.RootViewController.View, UIPopoverArrowDirection.Any, true);
                    }
                } 
                else 
                {
                    var viewController = UIApplication.SharedApplication.KeyWindow.GetVisibleViewController();
                    viewController.PresentViewController(activityController, true, null);
                }
            }
            catch
            {
            }
        }
コード例 #13
0
ファイル: MainViewController.cs プロジェクト: jeffbmiller/mps
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var shift1Button = new UIBarButtonItem ();
            shift1Button.Title = "Shift 1";
            shift1Button.Style = UIBarButtonItemStyle.Bordered;
            var shift2Button = new UIBarButtonItem ();
            shift2Button.Title = "Shift 2";
            shift2Button.Style = UIBarButtonItemStyle.Bordered;
            SetToolbarItems (new UIBarButtonItem[] {
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
                shift1Button,
                shift2Button,
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace)
            },false);
            NavigationController.ToolbarHidden = false;
            var labels = new [] { "Omega 3", "Herb", "RJ", "JD","RWA","NP", "NPO" };
            var segments = new SDSegmentedControl (labels) {
                Frame = new RectangleF (0, 0, 320, 44)
            };
            segments.ValueChanged += (sender, e) => {
                Console.WriteLine ("Selected " + segments.SelectedSegment);
                View.Add(new ProductionSegmentsTableView(new RectangleF (0, 44, View.Bounds.Width, View.Bounds.Height)));
                View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            };

            View.AddSubview (segments);
            View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
        }
コード例 #14
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI setup from code
			cancel.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			
			var label = new UILabel (new CGRect(0, 0, 80, 36)) { 
				Text = "Labor",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (18),
			};
			labor = new UIBarButtonItem(label);

			done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
				laborViewModel
					.SaveLaborAsync (assignmentViewModel.SelectedAssignment, laborViewModel.SelectedLabor)
					.ContinueWith (_ => BeginInvokeOnMainThread (() => DismissViewController (true, null)));
			});
			done.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			done.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			
			space1 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
			space2 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

			tableView.Source = 
				tableSource = new TableSource();
		}
		void ReleaseDesignerOutlets ()
		{
			if (ButtonNewContact != null) {
				ButtonNewContact.Dispose ();
				ButtonNewContact = null;
			}
		}
コード例 #16
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI setup from code
			View.BackgroundColor = Theme.BackgroundColor;
			photoSheet = new PhotoAlertSheet();
			photoSheet.DesiredSize = photoSize;
			photoSheet.Callback = image => {
				photoViewModel.SelectedPhoto.Image = image.ToByteArray ();

				var addPhotoController = Storyboard.InstantiateViewController<AddPhotoController>();
				addPhotoController.Dismissed += (sender, e) => ReloadConfirmation ();
				PresentViewController(addPhotoController, true, null);
			};
			addPhoto.SetBackgroundImage (Theme.ButtonDark, UIControlState.Normal);
			addPhoto.SetTitleColor (UIColor.White, UIControlState.Normal);

			//Setup our toolbar
			var label = new UILabel (new RectangleF (0, 0, 120, 36)) { 
				Text = "Confirmations",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (16),
			};
			var descriptionButton = new UIBarButtonItem (label);
			toolbar.Items = new UIBarButtonItem[] { descriptionButton };

			photoTableView.Source = new PhotoTableSource (this);
			signatureTableView.Source = new SignatureTableSource (this);
		}
コード例 #17
0
		public void OnShareClicked(UIBarButtonItem button)
		{
			UIActivityViewController activityViewController = new UIActivityViewController (new NSObject[] {
				ImageView.Image
			}, null);
			var popover = activityViewController.PopoverPresentationController;
			if (popover != null) {
				popover.BarButtonItem = ShareItem;
			}

			// Set a completion handler to handle what the UIActivityViewController returns
			activityViewController.SetCompletionHandler ((activityType, completed, returnedItems, error) => {
				if (returnedItems == null
				   || returnedItems.Length == 0)
					return;

				NSExtensionItem extensionItem = returnedItems [0];
				NSItemProvider imageItemProvider = extensionItem.Attachments [0];

				if (!imageItemProvider.HasItemConformingTo(UTType.Image))
					return;

				imageItemProvider.LoadItem (UTType.Image, null, (item, loadError) => {
					if (item != null && loadError == null)
						InvokeOnMainThread (() => {
							ImageView.Image = (UIImage)item;
						});
				});
			});

			PresentViewController (activityViewController, true, null);
		}
コード例 #18
0
ファイル: MyIssuesView.cs プロジェクト: ryanseys/CodeHub
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

			_viewSegment = new UISegmentedControl(new object[] { "Open".t(), "Closed".t(), "Custom".t() });
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
            _segmentBarButton.Width = View.Frame.Width - 10f;
			ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
			var vm = (MyIssuesViewModel)ViewModel;
			vm.Bind(x => x.SelectedFilter, x =>
			{
				if (x == 2)
				{
					ShowFilterController(new CodeHub.iOS.Views.Filters.MyIssuesFilterViewController(vm.Issues));
				}

                // If there is searching going on. Finish it.
                FinishSearch();
			});

			BindCollection(vm.Issues, CreateElement);
			var set = this.CreateBindingSet<MyIssuesView, MyIssuesViewModel>();
			set.Bind(_viewSegment).To(x => x.SelectedFilter);
			set.Apply();
        }
コード例 #19
0
ファイル: FriendListView.cs プロジェクト: sbondini/FriendList
        private UIBarButtonItem CreateAddFriendButton()
        {
            var button = new UIBarButtonItem("Add", UIBarButtonItemStyle.Plain, null);
            button.Clicked += ((sender, args) => ((FriendListViewModel) ViewModel).InsertFriendCommand.Execute(null));

            return button;
        }
コード例 #20
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI that must be setup from code
			View.BackgroundColor = Theme.BackgroundColor;
			title = new UILabel (new RectangleF (0, 0, 100, 36)) { 
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (16),
				Text = "Items",
			};
			titleButton = new UIBarButtonItem (title);
			toolbar.Items = new UIBarButtonItem[] { titleButton };

			var textAttributes = new UITextAttributes { TextColor = UIColor.White };
			edit = new UIBarButtonItem ("Edit", UIBarButtonItemStyle.Bordered, delegate {
				edit.Title = tableView.Editing ? "Edit" : "Done";
				tableView.SetEditing (!tableView.Editing, true);
			});
			edit.SetTitleTextAttributes (textAttributes, UIControlState.Normal);
			edit.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

			space = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace);

			addItem = new UIBarButtonItem ("Add Item", UIBarButtonItemStyle.Bordered, OnAddItem);
			addItem.SetTitleTextAttributes (textAttributes, UIControlState.Normal);
			addItem.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

			tableView.Source = new TableSource (this);
		}
コード例 #21
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var activityIndicator = new UIActivityIndicatorView (new CoreGraphics.CGRect (0, 0, 20, 20));
            activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
            activityIndicator.HidesWhenStopped = true;
            NavigationItem.LeftBarButtonItem = new UIBarButtonItem (activityIndicator);

            var getMonkeysButton = new UIBarButtonItem ();
            getMonkeysButton.Title = "Get";
            getMonkeysButton.Clicked += async (object sender, EventArgs e) => {
                activityIndicator.StartAnimating();
                getMonkeysButton.Enabled = false;

                await ViewModel.GetMonkeysAsync();
                TableViewMonkeys.ReloadData();

                getMonkeysButton.Enabled = true;
                activityIndicator.StopAnimating();
            };
            NavigationItem.RightBarButtonItem = getMonkeysButton;

            TableViewMonkeys.WeakDataSource = this;
        }
コード例 #22
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			AddOption ("Save", CommitDataForm);
			
			// Perform any additional setup after loading the view, typically from a nib.
			this.DataForm = new TKDataForm (this.View.Bounds);
			this.DataForm.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
			this.DataForm.AllowScroll = false;
			dataFormDelegate = new DataFormDelegate ();
			this.DataForm.Delegate = dataFormDelegate;
			this.View.AddSubview (this.DataForm);

			this.DataSource =new TKDataFormEntityDataSourceHelper ("user", "json", (string)null);
			this.DataSource ["name"].Index = 0;
			this.DataSource ["age"].Index = 1;

			this.DataSource ["gender"].ValuesProvider = NSArray.FromStrings (new string[] { "Male", "Female" });
			this.DataSource ["gender"].EditorClass = new Class (typeof(TKDataFormSegmentedEditor));
			this.DataSource ["gender"].Index = 2;
			this.DataSource ["gender"].PickersUseIndexValue = false;

			this.DataSource ["email"].Index = 3;
			this.DataSource ["email"].EditorClass = new Class (typeof(TKDataFormEmailEditor));

			this.DataForm.WeakDataSource = this.DataSource.NativeObject;
			this.DataForm.CommitMode = TKDataFormCommitMode.Manual;

			UIBarButtonItem save = new UIBarButtonItem ("Save", UIBarButtonItemStyle.Done, this, new Selector ("CommitDataForm"));
			this.NavigationItem.RightBarButtonItem = save;
		}
コード例 #23
0
ファイル: FriendView.cs プロジェクト: sbondini/FriendList
        private UIBarButtonItem CreateSaveButton()
        {
            var button = new UIBarButtonItem("Save", UIBarButtonItemStyle.Plain, null);
            button.Clicked += ((sender, args) => ((FriendViewModel)ViewModel).SaveCommand.Execute(null));

            return button;
        }
コード例 #24
0
        public async void ShowPDFForSigning()
        {
            var currentFilePath = "Salesinvoice.pdf";

            QLPreviewItemBundle prevItem = new QLPreviewItemBundle ("Salesinvoice.pdf", currentFilePath);
            QLPreviewController previewController = new QLPreviewController ();
            previewController.DataSource = new PreviewControllerDS (prevItem);

            NavigationController.PushViewController (previewController, true);

            //this adds a button to the QLPreviewController, but it has to wait until after it's been loaded 
            //I'm not sure if there's a better way to do this.
            await System.Threading.Tasks.Task.Run( () =>
                {
                    System.Threading.Thread.Sleep( 500 );
                    for (int i = 0; i < 10; i++)
                    {
                        System.Threading.Thread.Sleep( 500 );
                        InvokeOnMainThread( () =>
                            {
                                if (previewController.NavigationItem.RightBarButtonItems.Length == 1)
                                {
                                    var signButton = new UIBarButtonItem( UIBarButtonSystemItem.Compose, (o, e ) =>
                                        {
                                            SignPDF();
                                        } );

                                    previewController.NavigationItem.RightBarButtonItems = 
                                        new UIBarButtonItem[] { signButton, previewController.NavigationItem.RightBarButtonItems[0] };                              
                                }
                            } );
                    }
                } );
        }
コード例 #25
0
        public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
        {
            _pc = null;
            _lefty = null;

            ReplaceDetailNavigationViewController();
        }
コード例 #26
0
ファイル: UIUtils.cs プロジェクト: nodoid/mvvmlight1
        public static void UiSetKeyboardEditorWithCloseButton(this UITextField txt, UIKeyboardType keyboardType)
        {
            var toolbar = new UIToolbar
            {
                BarStyle = UIBarStyle.Black,
                Translucent = true,
            };
            txt.KeyboardType = keyboardType;
            toolbar.SizeToFit();

            var text = new UITextView(new CGRect(0, 0, 200, 32))
            {
                ContentInset = UIEdgeInsets.Zero,
                KeyboardType = keyboardType,
                Text = txt.Text,
                UserInteractionEnabled = true
            };
            text.Layer.CornerRadius = 4f;
            text.BecomeFirstResponder();

            var doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
                                 (s, e) =>
                {
                    text.ResignFirstResponder();
                    txt.ResignFirstResponder();
                });

            toolbar.UserInteractionEnabled = true;
            toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true);

            txt.InputAccessoryView = toolbar;
        }
コード例 #27
0
        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            var signButton = new UIBarButtonItem ("Sign PDF", UIBarButtonItemStyle.Plain, (o,e) => ShowPDFForSigning ());
            NavigationItem.RightBarButtonItem = signButton;
        }
コード例 #28
0
        /// <remarks>
        /// Background image idea from 
        /// http://mikebluestein.wordpress.com/2009/10/05/setting-an-image-background-on-a-uitableview-using-monotouch/
        /// </remarks>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            Title = "Speakers";

            //_speakerData = AppDelegate.ConferenceData.Speakers;
            speakerData = MonkeySpace.Core.ConferenceManager.Speakers.Values.ToList ();

            UIImageView imageView = new UIImageView (UIImage.FromFile ("Background.png"));
            imageView.Frame = new RectangleF (0, 0, View.Frame.Width, View.Frame.Height);
            imageView.UserInteractionEnabled = true;

            tableView = new UITableView { Source = new TableViewSource (this, speakerData)
                , AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth
                , BackgroundColor = UIColor.Clear
                , Frame = new RectangleF (0, 0, View.Frame.Width, View.Frame.Height - 44)
                , ShowsVerticalScrollIndicator = true};

            imageView.AddSubview (tableView);
            View.AddSubview (imageView);

            // SLIDEOUT BUTTON
            NavigationController.NavigationBar.SetTitleTextAttributes(AppDelegate.Current.FontTitleTextAttributes);
            var bbi = new UIBarButtonItem(UIImage.FromBundle ("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
                AppDelegate.Current.FlyoutNavigation.ToggleMenu();
            });
            NavigationItem.SetLeftBarButtonItem (bbi, false);

            tableView.BackgroundView = new UIImageView (UIImage.FromBundle ("Images/Background"));
        }
コード例 #29
0
ファイル: TaskListScreen.cs プロジェクト: AranHu/TaskCloud
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, (s,e) =>{
                var filename = DateTime.Now.ToString ("yyyyMMdd_HHmmss") + ".task";
                if (AppDelegate.HasiCloud) {
                    var p1 = Path.Combine(AppDelegate.iCloudUrl.Path, "Documents");
                    var p2 = Path.Combine (p1, filename);
                    var ubiq = new NSUrl(p2, false);

                    var task = new TaskDocument(ubiq);
                    task.Save (task.FileUrl, UIDocumentSaveOperation.ForCreating
                    , (success) => {
                        Console.WriteLine ("Save completion:"+ success);
                        tasks.Add (task);
                        Reload();
                    });
                }
            });
            NavigationItem.RightBarButtonItem = addButton;

            // UIBarButtonSystemItem.Refresh or http://barrow.io/posts/iphone-emoji/
            refreshButton = new UIBarButtonItem('\uE049'.ToString ()
            , UIBarButtonItemStyle.Plain
            , (s,e) => {
                LoadTasks(null);
            });

            NavigationItem.LeftBarButtonItem = refreshButton;
            LoadTasks(null);
        }
コード例 #30
0
 async partial void btnShare_Activated (UIBarButtonItem sender)
 {
     var text = viewModel.SharingMessage;
     var items = new NSObject[] { new NSString (text) };
     var activityController = new UIActivityViewController (items, null);
     await PresentViewControllerAsync (activityController, true);
 }
コード例 #31
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TableView.RowHeight          = UITableView.AutomaticDimension;
            TableView.EstimatedRowHeight = 44f;

            var vm = (IssueEditViewModel)ViewModel;

            var saveButton = new UIBarButtonItem(UIBarButtonSystemItem.Save);

            NavigationItem.RightBarButtonItem = saveButton;

            var title      = new EntryElement("Title", string.Empty, string.Empty);
            var assignedTo = new StringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1);
            var milestone  = new StringElement("Milestone", "None", UITableViewCellStyle.Value1);
            var labels     = new StringElement("Labels", "None", UITableViewCellStyle.Value1);
            var content    = new MultilinedElement("Description");
            var state      = new BooleanElement("Open", true);

            Root.Reset(new Section {
                title, assignedTo, milestone, labels
            }, new Section {
                state
            }, new Section {
                content
            });

            OnActivation(d =>
            {
                d(vm.Bind(x => x.IssueTitle, true).Subscribe(x => title.Value = x));
                d(title.Changed.Subscribe(x => vm.IssueTitle = x));

                d(assignedTo.Clicked.BindCommand(vm.GoToAssigneeCommand));
                d(milestone.Clicked.BindCommand(vm.GoToMilestonesCommand));
                d(labels.Clicked.BindCommand(vm.GoToLabelsCommand));

                d(vm.Bind(x => x.IsOpen, true).Subscribe(x => state.Value = x));
                d(vm.Bind(x => x.IsSaving).SubscribeStatus("Updating..."));

                d(state.Changed.Subscribe(x => vm.IsOpen = x));
                d(vm.Bind(x => x.Content, true).Subscribe(x => content.Details = x));

                d(vm.Bind(x => x.AssignedTo, true).Subscribe(x => {
                    assignedTo.Value = x == null ? "Unassigned" : x.Login;
                }));

                d(vm.Bind(x => x.Milestone, true).Subscribe(x => {
                    milestone.Value = x == null ? "None" : x.Title;
                }));

                d(vm.BindCollection(x => x.Labels, true).Subscribe(x => {
                    labels.Value = vm.Labels.Items.Count == 0 ? "None" : string.Join(", ", vm.Labels.Items.Select(i => i.Name));
                }));

                d(saveButton.GetClickedObservable().Subscribe(_ => {
                    View.EndEditing(true);
                    vm.SaveCommand.Execute(null);
                }));

                d(content.Clicked.Subscribe(_ => {
                    var composer = new MarkdownComposerViewController
                    {
                        Title = "Issue Description",
                        Text  = content.Details
                    };

                    composer.PresentAsModal(this, text =>
                    {
                        vm.Content = text;
                        this.DismissViewController(true, null);
                    });
                }));
            });
        }
コード例 #32
0
 partial void SearchBarButton_Activated(UIBarButtonItem sender)
 {
     PerformSegue("loginSearchFromListSegue", this);
 }
コード例 #33
0
ファイル: AppDelegate.cs プロジェクト: sushmasavekar/Seminars
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            var book = new AddressBook();

            _rootElement = new RootElement("Json Example")
            {
                new Section("Json Demo")
                {
                    JsonElement.FromFile("sample.json"),
                    new JsonElement("Load from url", "http://localhost/sample.json")
                },
                new Section("MT.D+Linq+Xamarin.Mobile")
                {
                    new RootElement("Contacts with Phones")
                    {
                        from c in book.Where(c => c.Phones.Count() > 0)
                        select new Section(c.DisplayName)
                        {
                            from p in c.Phones
                            select(Element) new StringElement(p.Number)
                        }
                    }
                },
                new Section("Tasks Sample using Json")
            };

            _vc  = new DialogViewController(_rootElement);
            _nav = new UINavigationController(_vc);

            window.RootViewController = _nav;
            window.MakeKeyAndVisible();

            #region task demo

            int n = 0;

            _addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);
            _vc.NavigationItem.RightBarButtonItem = _addButton;

            _addButton.Clicked += (sender, e) => {
                ++n;

                var task = new Task {
                    Name = "task " + n, DueDate = DateTime.Now
                };

                var taskElement = JsonElement.FromFile("task.json");

                taskElement.Caption = task.Name;

                var description = taskElement ["task-description"] as EntryElement;

                if (description != null)
                {
                    description.Caption = task.Name;
                    description.Value   = task.Description;
                }

                var duedate = taskElement ["task-duedate"] as DateElement;

                if (duedate != null)
                {
                    duedate.DateValue = task.DueDate;
                }

                _rootElement [2].Add(taskElement);
            };

            #endregion

            return(true);
        }
コード例 #34
0
        public void InitController(Boolean stop)
        {
            if (stop)
            {
                // Check location was aborted with quit
                locationManager.StopUpdatingLocation();
                DestroyEngine();
                appDelegate.CartStop();

                return;
            }

            locationManager.StopUpdatingLocation();
            locationManager.DistanceFilter = 2.0;
            locationManager.HeadingFilter  = 5.0;
            locationManager.Delegate       = new LocationManagerDelegate(this);
            locationManager.StartUpdatingLocation();
            locationManager.StartUpdatingHeading();

            // Create Engine
            CreateEngine(cart);

            // Create screens
            screenMain = new ScreenMain(this);

            // Set left button
            var leftBarButton = new UIBarButtonItem(Catalog.GetString("Quit"), UIBarButtonItemStyle.Plain, (sender, args) => {
                ButtonPressed(null);
                quit();
            });

            leftBarButton.TintColor = Colors.NavBarButton;
            screenMain.NavigationItem.SetLeftBarButtonItem(leftBarButton, true);

            // Set right button
            var rightBarButton = new UIBarButtonItem(Catalog.GetString("Save"), UIBarButtonItemStyle.Plain, (sender, args) => {
                ButtonPressed(null);
                Save();
            });

            rightBarButton.TintColor = Colors.NavBarButton;
            screenMain.NavigationItem.SetRightBarButtonItem(rightBarButton, true);

            screenListLocations = new ScreenList(this, ScreenType.Locations);
            screenListItems     = new ScreenList(this, ScreenType.Items);
            screenListInventory = new ScreenList(this, ScreenType.Inventory);
            screenListTasks     = new ScreenList(this, ScreenType.Tasks);

            Delegate = new ScreenControllerDelegate();

            // ... and push it to the UINavigationController while replacing the CheckLocation
            SetViewControllers(new UIViewController[] { screenMain }, animation);

            Title = cart.Name;

            if (restore)
            {
                Restore();
            }
            else
            {
                Start();
            }
        }
コード例 #35
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AppDisplayUtil.Instance.contentVC = this;

            GotoBarButton.Hidden = true;
            PageNumLabel.Hidden  = true;

            NSLayoutConstraint leadingContraint = NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Leading, NSLayoutRelation.GreaterThanOrEqual, View, NSLayoutAttribute.Leading, 1, 0);

            leadingContraint.Priority = 750;

            NSLayoutConstraint trailingContraint = NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Trailing, NSLayoutRelation.GreaterThanOrEqual, View, NSLayoutAttribute.Trailing, 1, 0);

            trailingContraint.Priority = 750;

            NSLayoutConstraint widthContraint = NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Width, NSLayoutRelation.LessThanOrEqual, View, NSLayoutAttribute.Width, 0, 703);

            widthContraint.Priority = 1000;

            View.AddConstraints(new NSLayoutConstraint[] {
                leadingContraint,
                trailingContraint,
                widthContraint,
                NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0),         //center X
                NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, 45),                //top 45
                NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, 0),           //bottom 0
            });
            View.TranslatesAutoresizingMaskIntoConstraints           = false;
            ContentWebView.TranslatesAutoresizingMaskIntoConstraints = false;

            IndexNavigationItem = new UINavigationItem();
            IndexNavigationItem.LeftBarButtonItem = new UIBarButtonItem("A", UIBarButtonItemStyle.Plain, null);
            IndexNavigationItem.LeftBarButtonItem.SetTitlePositionAdjustment(new UIOffset(20, 0), UIBarMetrics.Default);

            ContentNavigationItem = new UINavigationItem();
            UIBarButtonItem spaceBarButtonItem = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, null);

            UIBarButtonItem forwardBarButtonItem = new UIBarButtonItem(new UIImage("Images/Navigation/GrayForwardArrow.png"), UIBarButtonItemStyle.Plain, delegate {
                NavigateForward();
            });

            forwardBarButtonItem.Enabled = false;

            UIBarButtonItem backwardBarButtonItem = new UIBarButtonItem(new UIImage("Images/Navigation/RedBackArrow.png"), UIBarButtonItemStyle.Plain, delegate {
                NavigateBackward();
            });

            backwardBarButtonItem.Enabled = false;


            ContentNavigationItem.LeftBarButtonItems = new UIBarButtonItem[] { spaceBarButtonItem, backwardBarButtonItem, forwardBarButtonItem };
            ContentNavigationBar.PushNavigationItem(ContentNavigationItem, false);
            AppDataUtil.Instance.AddOpenedContentObserver(this);             //Set current instance as the observer of subject OpendPublication to get notification when opend content changed

            if (await PageSearchUtil.Instance.IsPBO(AppDataUtil.Instance.GetCurrentPublication().BookId))
            {
                this.JudgePBOBook("YES");
            }

            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("JudgePBOBook"), delegate(NSNotification obj) {
                if (obj.UserInfo != null)
                {
                    string boolStr = obj.UserInfo.ObjectForKey(new NSString("PBOBook")).ToString();
                    this.JudgePBOBook(boolStr);
                }
            });

            NSNotificationCenter.DefaultCenter.AddObserver(new NSString("ExecuteJS"), delegate(NSNotification obj) {
                if (obj.UserInfo != null)
                {
                    string jsStr = obj.UserInfo.ObjectForKey(new NSString("jsStr")).ToString();
                    ContentWebView.EvaluateJavascript(jsStr);
                }
            });
        }
コード例 #36
0
        protected override void OnElementChanged(ElementChangedEventArgs <Picker> e)
        {
            if (e.OldElement != null)
            {
                ((INotifyCollectionChanged)e.OldElement.Items).CollectionChanged -= RowsCollectionChanged;
            }

            if (e.NewElement != null)
            {
                if (Control == null)
                {
                    // disabled cut, delete, and toggle actions because they can throw an unhandled native exception
                    var entry = CreateNativeControl();

                    entry.EditingDidBegin += OnStarted;
                    entry.EditingDidEnd   += OnEnded;
                    entry.EditingChanged  += OnEditing;

                    _picker = new UIPickerView();

                    var width   = UIScreen.MainScreen.Bounds.Width;
                    var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44))
                    {
                        BarStyle = UIBarStyle.Default, Translucent = true
                    };
                    var spacer     = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
                    var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (o, a) =>
                    {
                        var s = (PickerSource)_picker.Model;
                        if (s.SelectedIndex == -1 && Element.Items != null && Element.Items.Count > 0)
                        {
                            UpdatePickerSelectedIndex(0);
                        }
                        UpdatePickerFromModel(s);
                        entry.ResignFirstResponder();
                        UpdateCharacterSpacing();
                    });

                    toolbar.SetItems(new[] { spacer, doneButton }, false);

                    entry.InputView          = _picker;
                    entry.InputAccessoryView = toolbar;

                    entry.InputView.AutoresizingMask                 = UIViewAutoresizing.FlexibleHeight;
                    entry.InputAccessoryView.AutoresizingMask        = UIViewAutoresizing.FlexibleHeight;
                    entry.InputAssistantItem.LeadingBarButtonGroups  = null;
                    entry.InputAssistantItem.TrailingBarButtonGroups = null;

                    _defaultTextColor = entry.TextColor;

                    _useLegacyColorManagement = e.NewElement.UseLegacyColorManagement();

                    entry.AccessibilityTraits = UIAccessibilityTrait.Button;

                    SetNativeControl(entry);
                }

                _picker.Model = new PickerSource(this);

                UpdateFont();
                UpdatePicker();
                UpdateTextColor();
                UpdateHorizontalTextAlignment();
                UpdateVerticalTextAlignment();

                ((INotifyCollectionChanged)e.NewElement.Items).CollectionChanged += RowsCollectionChanged;
            }

            base.OnElementChanged(e);
        }
コード例 #37
0
        protected override void OnElementChanged(ElementChangedEventArgs <TimePicker> e)
        {
            if (e.NewElement != null)
            {
                if (Control == null)
                {
                    var entry = CreateNativeControl();

                    entry.EditingDidBegin += OnStarted;
                    entry.EditingDidEnd   += OnEnded;

                    _picker = new UIDatePicker {
                        Mode = UIDatePickerMode.Time, TimeZone = new NSTimeZone("UTC")
                    };

                    if (Forms.IsiOS14OrNewer)
                    {
                        _picker.PreferredDatePickerStyle = UIKit.UIDatePickerStyle.Wheels;
                    }

                    var width   = UIScreen.MainScreen.Bounds.Width;
                    var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44))
                    {
                        BarStyle = UIBarStyle.Default, Translucent = true
                    };
                    var spacer     = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
                    var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (o, a) =>
                    {
                        UpdateElementTime();
                        entry.ResignFirstResponder();
                    });

                    toolbar.SetItems(new[] { spacer, doneButton }, false);

                    entry.InputView          = _picker;
                    entry.InputAccessoryView = toolbar;

                    entry.InputView.AutoresizingMask          = UIViewAutoresizing.FlexibleHeight;
                    entry.InputAccessoryView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;

                    entry.InputAssistantItem.LeadingBarButtonGroups  = null;
                    entry.InputAssistantItem.TrailingBarButtonGroups = null;

                    _defaultTextColor = entry.TextColor;

                    _useLegacyColorManagement = e.NewElement.UseLegacyColorManagement();

                    _picker.ValueChanged += OnValueChanged;

                    entry.AccessibilityTraits = UIAccessibilityTrait.Button;

                    SetNativeControl(entry);
                }

                UpdateFont();
                UpdateTime();
                UpdateTextColor();
                UpdateCharacterSpacing();
                UpdateFlowDirection();
            }

            base.OnElementChanged(e);
        }
        public ConfigureClassGradeScaleViewController()
        {
            Title = "Grade Scale";

            var cancelButton = new UIBarButtonItem()
            {
                Title = "Cancel"
            };

            cancelButton.Clicked            += new WeakEventHandler <EventArgs>(CancelButton_Clicked).Handler;
            NavigationItem.LeftBarButtonItem = cancelButton;

            var saveButton = new UIBarButtonItem()
            {
                Title = "Save"
            };

            saveButton.Clicked += new WeakEventHandler <EventArgs>(SaveButton_Clicked).Handler;
            NavigationItem.RightBarButtonItem = saveButton;

            PowerPlannerUIHelper.ConfigureForInputsStyle(this);

            StackView.AddTopSectionDivider();

            var savedScalesContainer = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            {
                var pickerSavedScales = new BareUIInlinePickerView(this, left: 16, right: 16)
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    HeaderText = "Scale"
                };
                BindingHost.SetItemsSourceBinding(pickerSavedScales, nameof(ViewModel.SavedGradeScales));
                BindingHost.SetSelectedItemBinding(pickerSavedScales, nameof(ViewModel.SelectedSavedGradeScale));
                savedScalesContainer.AddSubview(pickerSavedScales);
                pickerSavedScales.StretchHeight(savedScalesContainer);

                var buttonSaveScale = new UIButton(UIButtonType.Custom)
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    //TintColor = UIColor.
                };
                buttonSaveScale.SetImage(UIImage.FromBundle("SaveAsIcon").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), UIControlState.Normal);
                buttonSaveScale.TouchUpInside += new WeakEventHandler(ButtonSaveScale_TouchUpInside).Handler;
                savedScalesContainer.Add(buttonSaveScale);
                buttonSaveScale.StretchHeight(savedScalesContainer, bottom: 1);

                savedScalesContainer.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[picker][save(44)]-16-|", NSLayoutFormatOptions.DirectionLeadingToTrailing,
                                                                                        "picker", pickerSavedScales,
                                                                                        "save", buttonSaveScale));

                savedScalesContainer.SetHeight(44);
            }
            StackView.AddArrangedSubview(savedScalesContainer);
            savedScalesContainer.StretchWidth(StackView);

            StackView.AddSectionDivider();

            var headerView = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            {
                var labelStartingGrade = new UILabel()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    Text = "Starting Grade",
                    Font = UIFont.PreferredBody.Bold()
                };
                headerView.Add(labelStartingGrade);
                labelStartingGrade.StretchHeight(headerView, top: 8, bottom: 8);

                var labelGpa = new UILabel()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    Text = "GPA",
                    Font = UIFont.PreferredBody.Bold()
                };
                headerView.Add(labelGpa);
                labelGpa.StretchHeight(headerView, top: 8, bottom: 8);

                headerView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[startingGrade][gpa(==startingGrade)]-52-|", NSLayoutFormatOptions.DirectionLeadingToTrailing,
                                                                              "startingGrade", labelStartingGrade,
                                                                              "gpa", labelGpa));
            }
            StackView.AddArrangedSubview(headerView);
            headerView.StretchWidth(StackView, left: 16, right: 16);

            StackView.AddDivider();

            var scalesView = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            {
                _itemsSourceGradeScales = new BareUIViewItemsSourceAdapterAsStackPanel(scalesView, (w) => { return(new UIEditingGradeScaleView(this)
                    {
                        DataContext = w
                    }); });
            }
            StackView.AddArrangedSubview(scalesView);
            scalesView.StretchWidth(StackView, left: 16);

            var buttonAdd = new UIButton(UIButtonType.System)
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            buttonAdd.SetTitle("Add Grade Scale", UIControlState.Normal);
            buttonAdd.TouchUpInside += new WeakEventHandler(delegate { ViewModel.AddGradeScale(); }).Handler;
            StackView.AddArrangedSubview(buttonAdd);
            buttonAdd.StretchWidth(StackView);
            buttonAdd.SetHeight(44);

            StackView.AddBottomSectionDivider();
        }
コード例 #39
0
            public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
            {
                DetailedTabs dvc = svc.ViewControllers[1] as DetailedTabs;

                if (dvc != null)
                {
                    // if we can get the detailed tabs controller, undo all the changes made when orientation changed last time
                    dvc.View.Frame = new CoreGraphics.CGRect(0, 0, 703, 748);                                   // set the frame to old size
                    dvc.RemoveLeftNavBarButton();                                                               // remove navigation bar button
                    // dvc.NavigationBar.Frame = new System.Drawing.RectangleF(0, 0, dvc.View.Bounds.Width, 44);
                    dvc.Popover = null;                                                                         // remove popover controller link
                }
            }
コード例 #40
0
        {               // this defines split controller behavior in case of device orientation changes
            public override void WillHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
            {
                DetailedTabs dvc = svc.ViewControllers[1] as DetailedTabs;

                if (dvc != null)
                {
                    // defines the new frame for right side view controller which should now take up the entire screen space
                    dvc.View.Frame = new CoreGraphics.CGRect(0, 0, 768, 1004);

                    // adds a button which will show the left side table with customers data when tapped
                    dvc.AddLeftNavBarButton(barButtonItem);

                    // defines a navigation frame for the navigation bar
                    dvc.MyNavigationBar.Frame = new CoreGraphics.CGRect(0, 0, dvc.View.Bounds.Width, 44);

                    // set up the popover view controller ( JobRunTable )
                    dvc.Popover = pc;
                }
            }
コード例 #41
0
 partial void OnCancel(UIBarButtonItem sender)
 {
     this.PresentingViewController.DismissViewController(true, null);
 }
コード例 #42
0
 public void Include(UIBarButtonItem barButton)
 {
     barButton.Clicked += (s, e) =>
                          barButton.Title = barButton.Title + "";
 }
 public void WillShowViewController(UISplitViewController svc, UIViewController vc, UIBarButtonItem button)
 {
     // Called when the view is shown again in the split view, invalidating the button and popover controller.
     NavigationItem.SetLeftBarButtonItem(null, true);
     masterPopoverController = null;
 }
コード例 #44
0
 protected virtual void BindClearButton(UIBarButtonItem clearBarBtn, MvxFluentBindingDescriptionSet <FiltersViewController, IFiltersViewModel> set)
 {
     set.Bind(clearBarBtn).To(vm => vm.ClearCommand);
 }
 public void WillHideViewController(UISplitViewController splitController, UIViewController viewController, UIBarButtonItem barButtonItem, UIPopoverController popoverController)
 {
     barButtonItem.Title = NSBundle.MainBundle.LocalizedString("Master", "Master");
     NavigationItem.SetLeftBarButtonItem(barButtonItem, true);
     masterPopoverController = popoverController;
 }
コード例 #46
0
 partial void CancelBarButton_Activated(UIBarButtonItem sender)
 {
     CPViewController.CompleteRequest();
 }
コード例 #47
0
 partial void CancelButton_Activated(UIBarButtonItem sender)
 {
     Cancel();
 }
コード例 #48
0
 partial void AddBarButton_Activated(UIBarButtonItem sender)
 {
     PerformSegue("loginAddSegue", this);
 }
コード例 #49
0
ファイル: NotificationsView.cs プロジェクト: yhtsnda/CodeHub
 public NotificationsView()
 {
     _viewSegment      = new UISegmentedControl(new object[] { "Unread", "Participating", "All" });
     _segmentBarButton = new UIBarButtonItem(_viewSegment);
 }
コード例 #50
0
        public override void LoadView()
        {
            // Create the views.
            View = new UIView {
                BackgroundColor = UIColor.White
            };

            _myMapView = new MapView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _navigateButton = new UIBarButtonItem()
            {
                Title = "Navigate", Enabled = false
            };
            _recenterButton = new UIBarButtonItem()
            {
                Title = "Recenter", Enabled = false
            };

            _toolbar = new UIToolbar()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            _toolbar.Items = new[]
            {
                _navigateButton,
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                _recenterButton
            };

            _statusLabel = new UILabel
            {
                Text = "",
                AdjustsFontSizeToFitWidth = true,
                TextAlignment             = UITextAlignment.Left,
                BackgroundColor           = UIColor.White,
                TextColor     = UIColor.White,
                LineBreakMode = UILineBreakMode.WordWrap,
                Lines         = 0,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            // Add the views.
            View.AddSubviews(_myMapView, _toolbar, _statusLabel);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _myMapView.BottomAnchor.ConstraintEqualTo(_toolbar.TopAnchor),

                _toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor),
                _toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),

                _statusLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                _statusLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _statusLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
            });
        }
コード例 #51
0
        public override void LoadView()
        {
            // Create the views.
            View = new UIView {
                BackgroundColor = ApplicationTheme.BackgroundColor
            };

            _myMapView = new MapView();
            _myMapView.TranslatesAutoresizingMaskIntoConstraints = false;

            _toggleAxisOrderSwitch = new UISwitch();

            UILabel axisOrderLabel = new UILabel();

            axisOrderLabel.Text = "Swap coordinates";

            _chooseLayersButton         = new UIBarButtonItem();
            _chooseLayersButton.Title   = "Choose layer";
            _chooseLayersButton.Enabled = false;

            _loadServiceButton = new UIBarButtonItem();

            UIToolbar loadBar = new UIToolbar();

            loadBar.TranslatesAutoresizingMaskIntoConstraints = false;
            loadBar.Items = new[]
            {
                _loadServiceButton
            };

            UIToolbar toolbar = new UIToolbar();

            toolbar.TranslatesAutoresizingMaskIntoConstraints = false;
            toolbar.Items = new[]
            {
                new UIBarButtonItem(_toggleAxisOrderSwitch),
                new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace)
                {
                    Width = 8
                },
                new UIBarButtonItem(axisOrderLabel),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                _chooseLayersButton
            };

            _loadingProgressBar = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            _loadingProgressBar.TranslatesAutoresizingMaskIntoConstraints = false;
            _loadingProgressBar.HidesWhenStopped = true;
            _loadingProgressBar.BackgroundColor  = UIColor.FromWhiteAlpha(0, .6f);

            // Add the views.
            View.AddSubviews(_myMapView, loadBar, toolbar, _loadingProgressBar);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                _myMapView.BottomAnchor.ConstraintEqualTo(loadBar.TopAnchor),
                _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),

                loadBar.TopAnchor.ConstraintEqualTo(_myMapView.BottomAnchor),
                loadBar.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor),
                loadBar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                loadBar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),

                toolbar.TopAnchor.ConstraintEqualTo(loadBar.BottomAnchor),
                toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor),

                _loadingProgressBar.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                _loadingProgressBar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _loadingProgressBar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _loadingProgressBar.BottomAnchor.ConstraintEqualTo(View.BottomAnchor)
            });
        }
コード例 #52
0
 partial void SubmitButton_Activated(UIBarButtonItem sender)
 {
     var task = CheckPasswordAsync();
 }
コード例 #53
0
 /// <summary>
 ///
 /// </summary>
 public void AddContentsButton(UIBarButtonItem button)
 {
     button.Title = "Contents";
     tlbrTop.SetItems(new UIBarButtonItem[] { button }, false);
 }
コード例 #54
0
        public override void LoadView()
        {
            // Create the views.
            View = new UIView()
            {
                BackgroundColor = ApplicationTheme.BackgroundColor
            };

            _myMapView = new MapView();
            _myMapView.TranslatesAutoresizingMaskIntoConstraints = false;

            _toolbar = new UIToolbar();
            _toolbar.TranslatesAutoresizingMaskIntoConstraints = false;

            _stopsOrBarriersPicker = new UISegmentedControl("Stops", "Barriers");

            _resetButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh);

            _statusLabel = new UILabel
            {
                Text = "Instructions",
                AdjustsFontSizeToFitWidth = true,
                TextAlignment             = UITextAlignment.Center,
                BackgroundColor           = UIColor.FromWhiteAlpha(0, .6f),
                TextColor = UIColor.White,
                Lines     = 1,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _settingsButton = new UIBarButtonItem(UIImage.FromBundle("Settings"), UIBarButtonItemStyle.Plain, null);

            _routeButton = new UIBarButtonItem("Route", UIBarButtonItemStyle.Plain, null);

            _directionsButton = new UIBarButtonItem(UIImage.FromBundle("DirectionsList"), UIBarButtonItemStyle.Plain, null);

            _activityIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                HidesWhenStopped = true,
                BackgroundColor  = UIColor.FromWhiteAlpha(0, .5f)
            };

            _toolbar.Items = new[]
            {
                new UIBarButtonItem(_stopsOrBarriersPicker),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                _resetButton,
                _settingsButton,
                _routeButton,
                _directionsButton
            };

            // Add the views.
            View.AddSubviews(_myMapView, _statusLabel, _toolbar, _activityIndicator);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _myMapView.BottomAnchor.ConstraintEqualTo(_toolbar.TopAnchor),
                _toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor),
                _statusLabel.TopAnchor.ConstraintEqualTo(_myMapView.TopAnchor),
                _statusLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _statusLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _statusLabel.HeightAnchor.ConstraintEqualTo(40),
                _activityIndicator.TopAnchor.ConstraintEqualTo(_statusLabel.BottomAnchor),
                _activityIndicator.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _activityIndicator.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _activityIndicator.BottomAnchor.ConstraintEqualTo(View.BottomAnchor)
            }
                                                   );
        }
コード例 #55
0
ファイル: MainView.cs プロジェクト: VanMuylemSven/SAD-Project
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //If no historyitem is selected
            var mainVM = this.ViewModel as MainViewModel; //To get the item from the ViewModel, Get it via the VM itself, and cast it as that type of VM.

            if (mainVM != null)
            {
                selectedHistoryItem = mainVM.SelectedHistoryItem;
            }

            //If you haven't selected an item,  show the History/... bottom bars + search bar
            if (selectedHistoryItem == null)
            {
                //Bottom Tab bar
                UIBarButtonItem recentHistoryBarButton = new UIBarButtonItem(UIBarButtonSystemItem.Rewind);
                recentHistoryBarButton.Title = "Recent History";
                UIBarButtonItem[] toolbarItems = new UIBarButtonItem[] {
                    recentHistoryBarButton//,
                    //...
                };

                this.SetToolbarItems(toolbarItems, false);
                this.NavigationController.ToolbarHidden = false;

                /////////////
                // BINDING //
                MvxFluentBindingDescriptionSet <MainView, MainViewModel> set = new MvxFluentBindingDescriptionSet <MainView, MainViewModel>(this);
                set.Bind(recentHistoryBarButton).To(vm => vm.SearchHistoryCommand); //show Search History window

                set.Apply();
            }


            ////////////
            // MapKit //
            locationManager.RequestWhenInUseAuthorization(); //Request authorisation to use location when app is in foreground. (Error in versions below 8.0)
            //Type
            MainMap.MapType = MapKit.MKMapType.Standard;
            //Panning and Zooming
            MainMap.ZoomEnabled   = true;
            MainMap.ScrollEnabled = true;
            //User Location
            MainMap.ShowsUserLocation = true;

            // set map center and region
            const double lat       = 50.8247952; //Stationsplein kortrijk
            const double lon       = 3.2643516000000545;
            var          mapCenter = new CLLocationCoordinate2D(lat, lon);
            var          mapRegion = MKCoordinateRegion.FromDistance(mapCenter /*MainMap.UserLocation.Coordinate*/, 2000, 2000);

            //MainMap.CenterCoordinate = mapCenter/*MainMap.UserLocation.Coordinate*/;
            MainMap.Region = mapRegion;


            if (selectedHistoryItem != null)
            {
                CLLocationCoordinate2D coordinate2D = new CLLocationCoordinate2D(double.Parse(selectedHistoryItem.Latitude), double.Parse(selectedHistoryItem.Longitude));
                //Adding an annotation
                MainMap.AddAnnotations(new MKPointAnnotation()
                {
                    Title      = selectedHistoryItem.Name,
                    Coordinate = coordinate2D,
                    Subtitle   = selectedHistoryItem.LatLong
                });
                MainMap.SetCenterCoordinate(coordinate2D, true);
                MainMap.Region = MKCoordinateRegion.FromDistance(coordinate2D, 10000, 10000);
            }


            // set the map delegate
            mapDelegate      = new MyMapDelegate();
            MainMap.Delegate = mapDelegate;


            ////////////
            //Local Search UIBar
            if (selectedHistoryItem == null)
            {
                var searchResultsController = new SearchResultsView(MainMap, mainVM); //Also give the Viewmodel, so we can access it for the Messenger/Posting

                var searchUpdater = new SearchResultsUpdater();
                searchUpdater.UpdateSearchResults += searchResultsController.Search;

                //add the search controller
                searchController = new UISearchController(searchResultsController)
                {
                    SearchResultsUpdater = searchUpdater
                };

                searchController.SearchBar.SizeToFit();
                searchController.SearchBar.SearchBarStyle = UISearchBarStyle.Minimal;
                searchController.SearchBar.Placeholder    = "Enter a search query";

                searchController.HidesNavigationBarDuringPresentation = false;
                NavigationItem.TitleView   = searchController.SearchBar;
                DefinesPresentationContext = true;
            }

            //Compass
            var compass = MKCompassButton.FromMapView(MainMap);

            compass.CompassVisibility         = MKFeatureVisibility.Visible;
            NavigationItem.RightBarButtonItem = new UIBarButtonItem(compass);
            MainMap.ShowsCompass = false; // so we don't have two compasses!
            // User tracking button
            //Because of using it on a simulator, you can't actually SEE it, but it does work. probably.
            var button = MKUserTrackingButton.FromMapView(MainMap);

            button.Layer.BackgroundColor = UIColor.FromRGBA(255, 255, 255, 80).CGColor;
            button.Layer.BorderColor     = UIColor.White.CGColor;
            button.Layer.BorderWidth     = 1;
            button.Layer.CornerRadius    = 5;
            button.TranslatesAutoresizingMaskIntoConstraints = false;
            View.AddSubview(button);
        }
コード例 #56
0
 partial void DoneButton_Activated(UIBarButtonItem sender)
 {
     Grid.FinishEditing();
     Saved = true;
     PerformSegue("CloseFilterForm", this);
 }
コード例 #57
0
 partial void EditAsset(UIBarButtonItem sender);
コード例 #58
0
 partial void ToggleFavorite(UIBarButtonItem sender);
コード例 #59
0
        protected override Task <string> LoginAsyncOverride()
        {
            var tcs = new TaskCompletionSource <string>();

            var auth = new WebRedirectAuthenticator(StartUri, EndUri);

            auth.ClearCookiesBeforeLogin = false;

            UIViewController c = auth.GetUI();

            UIViewController    controller = null;
            UIPopoverController popover    = null;

            auth.Error += (o, e) =>
            {
                NSAction completed = () =>
                {
                    Exception ex = e.Exception ?? new Exception(e.Message);
                    tcs.TrySetException(ex);
                };

                if (controller != null)
                {
                    controller.DismissViewController(true, completed);
                }
                if (popover != null)
                {
                    popover.Dismiss(true);
                    completed();
                }
            };

            auth.Completed += (o, e) =>
            {
                NSAction completed = () =>
                {
                    if (!e.IsAuthenticated)
                    {
                        tcs.TrySetException(new InvalidOperationException(Resources.IAuthenticationBroker_AuthenticationCanceled));
                    }
                    else
                    {
                        tcs.TrySetResult(e.Account.Properties["token"]);
                    }
                };

                if (controller != null)
                {
                    controller.DismissViewController(true, completed);
                }
                if (popover != null)
                {
                    popover.Dismiss(true);
                    completed();
                }
            };

            controller = view as UIViewController;
            if (controller != null)
            {
                controller.PresentViewController(c, true, null);
            }
            else
            {
                UIView          v         = view as UIView;
                UIBarButtonItem barButton = view as UIBarButtonItem;

                popover = new UIPopoverController(c);

                if (barButton != null)
                {
                    popover.PresentFromBarButtonItem(barButton, UIPopoverArrowDirection.Any, true);
                }
                else
                {
                    popover.PresentFromRect(rect, v, UIPopoverArrowDirection.Any, true);
                }
            }

            return(tcs.Task);
        }
コード例 #60
0
        public override void LoadView()
        {
            // Create the views.
            View = new UIView {
                BackgroundColor = ApplicationTheme.BackgroundColor
            };

            _mapView = new MapView();
            _mapView.TranslatesAutoresizingMaskIntoConstraints = false;

            _transactionButton       = new UIBarButtonItem();
            _transactionButton.Title = "Start transaction";
            _syncButton        = new UIBarButtonItem();
            _syncButton.Title  = "Sync";
            _addButton         = new UIBarButtonItem(UIBarButtonSystemItem.Add);
            _addButton.Enabled = false;

            UIToolbar toolbar = new UIToolbar();

            toolbar.TranslatesAutoresizingMaskIntoConstraints = false;
            toolbar.Items = new[]
            {
                _transactionButton,
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                _syncButton,
                _addButton
            };

            _transactionSwitch = new UISwitch();
            _transactionSwitch.TranslatesAutoresizingMaskIntoConstraints = false;
            _transactionSwitch.On = true;

            _statusLabel = new UILabel
            {
                Text = "Preparing sample data...",
                AdjustsFontSizeToFitWidth = true,
                TextAlignment             = UITextAlignment.Center,
                BackgroundColor           = UIColor.FromWhiteAlpha(0, .6f),
                TextColor = UIColor.White,
                Lines     = 2,
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            _statusLabel.TranslatesAutoresizingMaskIntoConstraints = false;

            UILabel requireTransactionsLabel = new UILabel();

            requireTransactionsLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            requireTransactionsLabel.Text          = "Require transaction";
            requireTransactionsLabel.TextAlignment = UITextAlignment.Right;
            requireTransactionsLabel.SetContentCompressionResistancePriority((float)UILayoutPriority.DefaultHigh, UILayoutConstraintAxis.Horizontal);

            UIStackView requireTransactionRow = new UIStackView(new UIView[] { requireTransactionsLabel, _transactionSwitch });

            requireTransactionRow.TranslatesAutoresizingMaskIntoConstraints = false;
            requireTransactionRow.Axis         = UILayoutConstraintAxis.Horizontal;
            requireTransactionRow.Distribution = UIStackViewDistribution.Fill;
            requireTransactionRow.Spacing      = 8;
            requireTransactionRow.LayoutMarginsRelativeArrangement = true;
            requireTransactionRow.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8);

            _progressBar = new UIProgressView(UIProgressViewStyle.Bar);
            _progressBar.TranslatesAutoresizingMaskIntoConstraints = false;

            // Add the views.
            View.AddSubviews(_mapView, _statusLabel, requireTransactionRow, toolbar, _progressBar);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                _mapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                _mapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _mapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _mapView.BottomAnchor.ConstraintEqualTo(requireTransactionRow.TopAnchor),

                toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor),

                requireTransactionRow.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor),
                requireTransactionRow.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor),
                requireTransactionRow.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor),

                _statusLabel.TopAnchor.ConstraintEqualTo(_mapView.TopAnchor),
                _statusLabel.LeadingAnchor.ConstraintEqualTo(_mapView.LeadingAnchor),
                _statusLabel.TrailingAnchor.ConstraintEqualTo(_mapView.TrailingAnchor),
                _statusLabel.HeightAnchor.ConstraintEqualTo(80),

                _progressBar.TopAnchor.ConstraintEqualTo(_statusLabel.BottomAnchor),
                _progressBar.LeadingAnchor.ConstraintEqualTo(_statusLabel.LeadingAnchor),
                _progressBar.TrailingAnchor.ConstraintEqualTo(_statusLabel.TrailingAnchor),
                _progressBar.HeightAnchor.ConstraintEqualTo(8)
            });
        }