protected virtual UIActionSheet CreateActionSheet(string title) { var sheet = new UIActionSheet(); sheet.Dismissed += (sender, e) => sheet.Dispose(); return(sheet); }
public override void ActionSheet(ActionSheetConfig config) { if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var sheet = UIAlertController.Create(config.Title ?? String.Empty, String.Empty, UIAlertControllerStyle.ActionSheet); config.Options.ToList().ForEach(x => sheet.AddAction(UIAlertAction.Create(x.Text, UIAlertActionStyle.Default, y => { if (x.Action != null) { x.Action(); } })) ); this.Present(sheet); } else { var view = Utils.GetTopView(); var action = new UIActionSheet(config.Title); config.Options.ToList().ForEach(x => action.AddButton(x.Text)); action.Dismissed += (sender, btn) => { if ((int)btn.ButtonIndex > -1 && (int)btn.ButtonIndex < config.Options.Count) { config.Options[(int)btn.ButtonIndex].Action(); } }; action.ShowInView(view); } }
partial void OnGoTouchUpInside(MonoTouch.UIKit.UIButton sender) { List <AsciiPageSize> sizes = new List <AsciiPageSize> { new AsciiPageSize("micro", 320, 240), new AsciiPageSize("tiny", 480, 360), new AsciiPageSize("small", 640, 480), new AsciiPageSize("medium", 800, 600), new AsciiPageSize("large", 1024, 768), new AsciiPageSize("extra large", 1280, 1024), new AsciiPageSize("super large", 1600, 1200) }; var sizesArr = from thisSize in sizes select thisSize.Name; var actionSheet = new UIActionSheet("Select size", null, "Cancel", null, sizesArr.ToArray()) { Style = UIActionSheetStyle.Default }; actionSheet.Clicked += delegate(object actionSheetSender, UIButtonEventArgs args) { var index = args.ButtonIndex; Console.WriteLine("Clicked on item {0}", index); if (index < sizes.Count) { actionSheet.DismissWithClickedButtonIndex(sizes.Count, true); CreateAsciiArt(sizes[index]); } }; actionSheet.ShowInView(View); }
protected void HandleBtnSimpleActionSheetTouchUpInside(object sender, EventArgs e) { // create an action sheet using the qualified constructor actionSheet = new UIActionSheet("simple action sheet", null, "cancel", "delete", null); actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) { Console.WriteLine("Button " + b.ButtonIndex.ToString() + " clicked"); }; actionSheet.ShowInView(View); }
public override void LoadView () { NavigationItem.RightBarButtonItem= new UIBarButtonItem(UIBarButtonSystemItem.Compose, delegate { var actionSheet = new UIActionSheet ("Email", null, "Cancel", "PNG", "PDF"){ Style = UIActionSheetStyle.Default }; actionSheet.Clicked += delegate (object sender, UIButtonEventArgs args){ if(args.ButtonIndex > 1) return; Email(args.ButtonIndex == 0 ? "png" : "pdf"); }; actionSheet.ShowInView (View); }); var scrollView = new GraphScrollView(exampleInfo, new RectangleF(new PointF(0, 0), new SizeF(UIScreen.MainScreen.ApplicationFrame.Size.Width, UIScreen.MainScreen.ApplicationFrame.Height - UIScreen.MainScreen.ApplicationFrame.Top - 10))); View = scrollView; }
private void menu() { UIActionSheet actionSheet = new UIActionSheet(); actionSheet.AddButton(Catalog.GetString("Save")); actionSheet.AddButton(Catalog.GetString("About")); actionSheet.AddButton(Catalog.GetString("Cancel")); actionSheet.DestructiveButtonIndex = 0; // Red button actionSheet.CancelButtonIndex = 2; // Black button actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) { if (b.ButtonIndex == 0) { Save(); } if (b.ButtonIndex == 1) { var alert = new UIAlertView(); alert.Title = Catalog.GetString("WF.Player.iOS"); alert.Message = Catalog.Format(Catalog.GetString("Copyright 2012-2013 by Wherigo Foundation, Dirk Weltz, Brice Clocher\n\nVersion\niPhone {0}\nCore {1}\n\nUsed parts of following products (copyrights see at product):\nGroundspeak, NLua, KeraLua, KopiLua, Lua "), 0, Engine.CORE_VERSION); alert.AddButton(Catalog.GetString("Ok")); // alert.Clicked += (sender, e) => { // }; alert.Show(); } }; actionSheet.ShowInView(View); }
void HandleBtnSimpleActionSheetTouchUpInside (object sender, EventArgs e) { // create an action sheet using the qualified constructor actionSheet = new UIActionSheet ("simple action sheet", null, "cancel", "delete", null); actionSheet.Clicked += OnClicked; actionSheet.ShowInView (View); }
protected void HandleBtnSimpleActionSheetTouchUpInside (object sender, EventArgs e) { // create an action sheet using the qualified constructor actionSheet = new UIActionSheet ("simple action sheet", null, "cancel", "delete", null); actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) { Console.WriteLine ("Button " + b.ButtonIndex.ToString () + " clicked"); }; actionSheet.ShowInView (View); }
void HandleButtonTrashClicked (object sender, EventArgs e) { string filepath = Path.Combine(Environment.GetFolderPath (Environment.SpecialFolder.Personal), _filename); if(File.Exists(filepath)) { var actionSheet = new UIActionSheet("") {Utils.Translate("delete"), Utils.Translate("cancel")}; actionSheet.Title = Utils.Translate("confirmdeleteimage"); actionSheet.DestructiveButtonIndex = 0; actionSheet.CancelButtonIndex = 1; actionSheet.ShowFromTabBar(JaktLoggApp.instance.TabBarController.TabBar); actionSheet.Clicked += delegate(object s, UIButtonEventArgs evt) { switch (evt.ButtonIndex) { case 0: //Slett File.Delete(filepath); _filename = string.Empty; imageView.Image = null; _callback(this); NavigationController.PopViewControllerAnimated(true); break; case 1: //Avbryt break; } }; } }
private void ShareButtonPress(UIBarButtonItem barButtonItem) { var sheet = new UIActionSheet(); var shareButton = sheet.AddButton("Share"); var showButton = sheet.AddButton("Show in GitHub"); var cancelButton = sheet.AddButton("Cancel"); sheet.CancelButtonIndex = cancelButton; sheet.Dismissed += (sender, e) => { BeginInvokeOnMainThread(() => { if (e.ButtonIndex == showButton) { var viewController = new WebBrowserViewController(Readme.HtmlUrl); PresentViewController(viewController, true, null); } else if (e.ButtonIndex == shareButton) { AlertDialogService.Share( $"{_owner}/{_repository} Readme", url: Readme.HtmlUrl, barButtonItem: barButtonItem); } }); sheet.Dispose(); }; sheet.ShowFrom(barButtonItem, true); }
public void CtorAllNulls() { // http://bugzilla.xamarin.com/show_bug.cgi?id=3081 using (UIActionSheet a = new UIActionSheet(null, null, null, null)) { CheckDefault(a); } }
void HandleBtActionClicked (object sender, EventArgs e) { var actionSheet = new UIActionSheet("") {"Del på facebook", "Send link på e-post", Utils.Translate("cancel")}; actionSheet.Title = "Del denne siden"; //actionSheet.DestructiveButtonIndex = 0; actionSheet.CancelButtonIndex = 2; actionSheet.ShowInView(this.View); actionSheet.Clicked += delegate(object s, UIButtonEventArgs evt) { switch (evt.ButtonIndex) { case 0: //Del på facebook break; case 1: //Send link på e-post var url = webView.Request.MainDocumentURL; var htmlstr ="<a href='"+url+"'>"+url+"</a>"; var reportScreen = new ReportJakt(htmlstr); this.NavigationController.PushViewController(reportScreen, true); break; /*case 2: //Del på face MessageBox.Show("Ennå ikke implementert...", ""); break; */default: //Avbryt break; } }; }
void HandleMoveButtonCellTapped(UITableView tableView) { if (selectedVerses != null && selectedVerses.Count != 0) { var actionSheetDelegate = new MoveActionSheetDelegate(tableViewController, data, selectedVerses); var actionSheet = new UIActionSheet { CancelButtonIndex = 9, Delegate = actionSheetDelegate, Title = "Move" }; actionSheet.Add("Sunday"); actionSheet.Add("Monday"); actionSheet.Add("Tuesday"); actionSheet.Add("Wednesday"); actionSheet.Add("Thursday"); actionSheet.Add("Friday"); actionSheet.Add("Saturday"); actionSheet.Add("Queue"); actionSheet.Add("Review"); actionSheet.Add("Cancel"); actionSheet.ShowFromTabBar(AppDelegate.TabBarController.TabBar); selected = new bool[data.Count]; } else { new UIAlertView("No Selected Verses", "Whoops! Select the verses you wish to move first!", null, "Okay", null).Show(); } }
partial void actionSheetAction(NSObject sender) { UIActionSheet actionSheet = new UIActionSheet("Action Sheet Test"); actionSheet.AddButton("Red"); actionSheet.AddButton("Blue"); actionSheet.AddButton("Green"); actionSheet.AddButton("White"); actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) { switch (b.ButtonIndex) { case 0: this.View.BackgroundColor = UIColor.Red; break; case 1: this.View.BackgroundColor = UIColor.Blue; break; case 2: this.View.BackgroundColor = UIColor.Green; break; case 3: this.View.BackgroundColor = UIColor.White; break; } }; actionSheet.ShowInView(View); }
void ChooseDevice() { if (_selectedDevice == null) { Console.WriteLine("Choose device action sheet"); var actionSheet = new UIActionSheet(NSBundle.MainBundle.LocalizedString("ConnectToDevice", null)); foreach (var device in _deviceScanner.Devices) { actionSheet.AddButton(device.FriendlyName); } actionSheet.AddButton(NSBundle.MainBundle.LocalizedString("Cancel", null)); actionSheet.CancelButtonIndex = actionSheet.ButtonCount - 1; actionSheet.Clicked += (sender, e) => OnDeviceSelected((int)e.ButtonIndex); actionSheet.ShowInView(View); } else { Console.WriteLine("Connected device action sheet"); var actionSheet = new UIActionSheet(_selectedDevice.FriendlyName); actionSheet.AddButton(NSBundle.MainBundle.LocalizedString("Disconnect", null)); actionSheet.AddButton(NSBundle.MainBundle.LocalizedString("Cancel", null)); actionSheet.DestructiveButtonIndex = 0; actionSheet.CancelButtonIndex = 1; actionSheet.Clicked += (sender, e) => OnDisconnect(); actionSheet.ShowInView(View); } }
partial void ActionCustomIcon(UIButton sender) { var actionSheet = new UIActionSheet(Constants.STR_CUSTOM_ICON_TITLE, null, "Cancel", null, Constants.TYPE_FROM_SOURCE); actionSheet.Clicked += SelectedCustomIcon; actionSheet.ShowInView(this.View); }
public override void LoadView () { NavigationItem.RightBarButtonItem= new UIBarButtonItem(UIBarButtonSystemItem.Compose, delegate { var actionSheet = new UIActionSheet ("Email", null, "Cancel", "PNG", "PDF"){ Style = UIActionSheetStyle.Default }; actionSheet.Clicked += delegate (object sender, UIButtonEventArgs args){ if(args.ButtonIndex > 1) return; Email(args.ButtonIndex == 0 ? "png" : "pdf"); }; actionSheet.ShowInView (View); }); // Only for iOS 7 and later? this.EdgesForExtendedLayout = UIRectEdge.None; this.View = this.plotView; }
/// <summary> /// /// </summary> public ActionSheetDatePicker(UIView owner) { //---- save our uiview owner this._owner = owner; //---- configure the title label this._titleLabel.BackgroundColor = UIColor.Clear; this._titleLabel.TextColor = UIColor.LightTextColor; this._titleLabel.Font = UIFont.BoldSystemFontOfSize(18); //---- configure the done button this._doneButton.SetTitle("done", UIControlState.Normal); this._doneButton.TouchUpInside += (s, e) => { this._actionSheet.DismissWithClickedButtonIndex(0, true); }; //---- create + configure the action sheet this._actionSheet = new UIActionSheet() { Style = UIActionSheetStyle.BlackTranslucent }; this._actionSheet.Clicked += (s, e) => { Console.WriteLine("Clicked on item {0}", e.ButtonIndex); }; //---- add our controls to the action sheet this._actionSheet.AddSubview(this._datePicker); this._actionSheet.AddSubview(this._titleLabel); this._actionSheet.AddSubview(this._doneButton); }
partial void ActionItem(UIButton sender) { var actionSheet = new UIActionSheet(Constants.STR_ATTACH_TITLE, null, "Cancel", null, Constants.TYPE_ATTACH); actionSheet.Clicked += SelectedAttachType; actionSheet.ShowInView(this.View); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Main view"; View.BackgroundColor = UIColor.White; NavigationItem.RightBarButtonItem = new UIBarButtonItem("Navigation", UIBarButtonItemStyle.Plain, (sender, args) => { var actionSheet = new UIActionSheet("Navigation"); actionSheet.AddButtonWithBinding("First view model modal", "Click ShowFirstWindowCommand"); actionSheet.AddButtonWithBinding("First view model page", "Click ShowFirstPageCommand"); actionSheet.AddButtonWithBinding("First view model tab", "Click ShowFirstTabCommand"); actionSheet.AddButtonWithBinding("Second view model modal", "Click ShowSecondWindowCommand"); actionSheet.AddButtonWithBinding("Second view model page", "Click ShowSecondPageCommand"); actionSheet.AddButtonWithBinding("Second view model tab", "Click ShowSecondTabCommand"); actionSheet.AddButtonWithBinding("Navigation (Clear back stack)", "Click ShowBackStackPageCommand"); actionSheet.CancelButtonIndex = actionSheet.AddButton("Cancel"); actionSheet.ShowEx(sender, (sheet, o) => sheet.ShowFrom((UIBarButtonItem)o, true)); }); using (var bindingSet = new BindingSet <MainViewModel>()) { //TabBar bindingSet.Bind(this, AttachedMemberConstants.ItemsSource).To(() => (vm, ctx) => vm.ItemsSource); bindingSet.Bind(this, AttachedMemberConstants.SelectedItem).To(() => (vm, ctx) => vm.SelectedItem).TwoWay(); } }
void ActionMenu() { //_actionSheet = new UIActionSheet(""); UIActionSheet actionSheet = new UIActionSheet( "Customer Actions", null, "Cancel", "Delete Customer", new string[] { "Change Customer" }); actionSheet.Style = UIActionSheetStyle.Default; actionSheet.Clicked += delegate(object sender, UIButtonEventArgs args) { switch (args.ButtonIndex) { case 0: DeleteCustomer(); break; case 1: ChangeCustomer(); break; } }; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { actionSheet.ShowFromToolbar(NavigationController.Toolbar); } else { actionSheet.ShowFrom(NavigationItem.RightBarButtonItem, true); } }
void SetupAndShowActionSheet(DialogViewController dvc) { var section = dvc.Root [0]; ActionSheetDelegate = new MoveActionSheetDelegate(dvc, section); ActionSheet = new UIActionSheet { CancelButtonIndex = 9, Delegate = ActionSheetDelegate, Title = "Move" }; ActionSheet.Add("Sunday"); ActionSheet.Add("Monday"); ActionSheet.Add("Tuesday"); ActionSheet.Add("Wednesday"); ActionSheet.Add("Thursday"); ActionSheet.Add("Friday"); ActionSheet.Add("Saturday"); ActionSheet.Add("Queue"); ActionSheet.Add("Review"); ActionSheet.Add("Cancel"); ActionSheet.ShowFromTabBar(AppDelegate.tabBarController.TabBar); }
/// <summary> /// /// </summary> public ActionSheetDatePicker(UIView owner) { // save our uiview owner this.owner = owner; // configure the title label titleLabel.BackgroundColor = UIColor.Clear; titleLabel.TextColor = UIColor.LightTextColor; titleLabel.Font = UIFont.BoldSystemFontOfSize (18); // configure the done button doneButton.SetTitle ("done", UIControlState.Normal); doneButton.TouchUpInside += (s, e) => { actionSheet.DismissWithClickedButtonIndex (0, true); // Add DoneButtonClicked Event //Console.WriteLine("Done clicked"); if (DoneButtonClicked != null) { DoneButtonClicked(s,e); } }; // expose done clicked event // create + configure the action sheet actionSheet = new UIActionSheet () { Style = UIActionSheetStyle.BlackTranslucent }; actionSheet.Clicked += (s, e) => { Console.WriteLine ("Clicked on item {0}", e.ButtonIndex); }; // add our controls to the action sheet actionSheet.AddSubview (datePicker); actionSheet.AddSubview (titleLabel); actionSheet.AddSubview (doneButton); }
private void PickRegisterOption() { try { UIActionSheet actionSheet; actionSheet = new UIActionSheet(); actionSheet.AddButton("Phone"); actionSheet.AddButton("Email"); actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) { if (b.ButtonIndex == (0)) { EmailRegisterView.Hidden = true; PhoneRegisterView.Hidden = false; SetEditing(false, true); this.registerMode = this.appDelegate.MODE_REGISTER_PHONE; } else { EmailRegisterView.Hidden = false; PhoneRegisterView.Hidden = true; this.registerMode = this.appDelegate.MODE_REGISTER_EMAIL; SetEditing(false, true); } }; actionSheet.ShowInView(View); } catch (Exception ex) { Console.Write(ex.Message); } }
void HandleBtPageCurlClicked (object sender, EventArgs e) { var actionSheet = new UIActionSheet("") {"Treff", "Bom", "Observasjoner", "Alle loggføringer"}; actionSheet.Title = "Vis bare:"; actionSheet.CancelButtonIndex = 3; actionSheet.ShowFromTabBar(JaktLoggApp.instance.TabBarController.TabBar); actionSheet.Clicked += delegate(object s, UIButtonEventArgs evt) { switch (evt.ButtonIndex) { case 0: Filter = "Treff"; break; case 1: Filter = "Bom"; break; case 2: Filter = "Obs"; break; case 3: default: Filter = ""; break; } RefreshMap(); }; }
public static void ShowOptionsMenu(this UIViewController vc, IParentMenu parentMenu) { if (parentMenu == null) { return; } var actionSheet = new UIActionSheet(); #warning TODO - make this OO - let the _parentMenu render itself... var actions = new List<ICommand>(); foreach (var child in parentMenu.Children) { var childCast = child as CaptionAndIconMenu; #warning More to do here - e.g. check for null! actionSheet.AddButton(childCast.Caption); actions.Add(childCast.Command); } actionSheet.Clicked += (object sender, UIButtonEventArgs e) => { if (e.ButtonIndex >= 0) { actions[e.ButtonIndex].Execute(null); } }; #warning More to do here - e.g. check for null! //if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) // actionSheet.ShowFromToolbar(NavigationController.Toolbar); //else actionSheet.ShowFrom(vc.NavigationItem.RightBarButtonItem, true); }
private void SelectPhotoAction() { var actionSheet = new UIActionSheet("Select an Action", null, "Cancel", "Take a Picture", "Open Camera Roll", "Move Image", "Delete Image", "Enlarge Image") { Style = UIActionSheetStyle.Default }; actionSheet.Clicked += delegate(object sender, UIButtonEventArgs args) { if (args.ButtonIndex == 0) { TakePicture(); } else if (args.ButtonIndex == 1) { SelectPicture(); } else if (args.ButtonIndex == 2) { MovePicture(); } else if (args.ButtonIndex == 3) { deleteImage(); } else if (args.ButtonIndex == 4) { enlargeImage(); } }; actionSheet.ShowInView(View); }
public override void ViewDidLoad() { base.ViewDidLoad (); this.txt.ShouldReturn += (textField) => { textField.ResignFirstResponder(); return true; }; this.btn.TouchUpInside += (o,s) => { var actionSheet = new UIActionSheet ("Send Post?", null, "Cancel", null, "Send"){ Style = UIActionSheetStyle.Default }; actionSheet.Clicked += ( sender, args) => { Console.WriteLine ("Clicked on item {0} text: {1}", args.ButtonIndex, this.txt.Text); if (args.ButtonIndex == 0) { MakePost(this.txt.Text); } }; actionSheet.ShowInView (View); }; // Perform any additional setup after loading the view, typically from a nib. }
public override void ViewDidLoad () { base.ViewDidLoad (); _picker = new UIImagePickerController (); _pickerDel = new PickerDelegate (this); _picker.Delegate = _pickerDel; _actionSheet = new UIActionSheet (); _actionSheet.AddButton ("Library"); _actionSheet.AddButton ("Camera"); _actionSheet.AddButton ("Cancel"); _actionSheet.CancelButtonIndex = 2; _actionSheet.Delegate = new ActionSheetDelegate (this); showPicker.TouchUpInside += delegate { _actionSheet.ShowInView (this.View); }; playMovie.Hidden = true; playMovie.TouchUpInside += delegate { if (_mp != null) { View.AddSubview (_mp.View); _mp.SetFullscreen (true, true); _mp.Play (); } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Main view"; View.BackgroundColor = UIColor.White; NavigationItem.RightBarButtonItem = new UIBarButtonItem("Navigation", UIBarButtonItemStyle.Plain, (sender, args) => { var actionSheet = new UIActionSheet("Navigation"); actionSheet.AddButtonWithBinding("First view model modal", "Click ShowFirstWindowCommand"); actionSheet.AddButtonWithBinding("First view model page", "Click ShowFirstPageCommand"); actionSheet.AddButtonWithBinding("First view model tab", "Click ShowFirstTabCommand"); actionSheet.AddButtonWithBinding("Second view model modal", "Click ShowSecondWindowCommand"); actionSheet.AddButtonWithBinding("Second view model page", "Click ShowSecondPageCommand"); actionSheet.AddButtonWithBinding("Second view model tab", "Click ShowSecondTabCommand"); actionSheet.AddButtonWithBinding("Navigation (Clear back stack)", "Click ShowBackStackPageCommand"); actionSheet.CancelButtonIndex = actionSheet.AddButton("Cancel"); actionSheet.ShowEx(sender, (sheet, o) => sheet.ShowFrom((UIBarButtonItem)o, true)); }); using (var bindingSet = new BindingSet<MainViewModel>()) { //TabBar bindingSet.Bind(this, AttachedMemberConstants.ItemsSource).To(() => model => model.ItemsSource); bindingSet.Bind(this, AttachedMemberConstants.SelectedItem).To(() => model => model.SelectedItem).TwoWay(); } }
public override void Clicked(UIActionSheet actionSheet, int buttonIndex) { switch (buttonIndex) { case 0: MoveVerseToCategory (Category.Sunday); break; case 1: MoveVerseToCategory (Category.Monday); break; case 2: MoveVerseToCategory (Category.Tuesday); break; case 3: MoveVerseToCategory (Category.Wednesday); break; case 4: MoveVerseToCategory (Category.Thursday); break; case 5: MoveVerseToCategory (Category.Friday); break; case 6: MoveVerseToCategory (Category.Saturday); break; case 7: MoveVerseToCategory (Category.Queue); break; case 8: MoveVerseToCategory (Category.Review); break; } }
public void CreateTilesPopUp() { UIActionSheet actionsheet = new UIActionSheet("Selecteer een categorie"){ "Map", "Road", "Shop", "Annuleer" }; actionsheet.Clicked += (sender, e) => { switch (e.ButtonIndex) { case 0: GlobalSupport.MessageIdentifier = 800; NavigateToDetails(); break; case 1: GlobalSupport.MessageIdentifier = 801; NavigateToDetails(); break; case 2: GlobalSupport.MessageIdentifier = 802; NavigateToDetails(); break; } }; actionsheet.ShowInView(this.View); }
private void RightBarButtonClicked(object sender, EventArgs args) { var actionSheet = new UIActionSheet("") {Utils.Translate("email.sendbymail"), Utils.Translate("cancel")}; actionSheet.Title = Utils.Translate("actionsheet.reportheader"); //actionSheet.DestructiveButtonIndex = 0; actionSheet.CancelButtonIndex = 2; actionSheet.ShowFromTabBar(JaktLoggApp.instance.TabBarController.TabBar); actionSheet.Clicked += delegate(object s, UIButtonEventArgs e) { switch (e.ButtonIndex) { case 0: //Enkel rapport var reportScreen = new ReportJakt(jakt); this.NavigationController.PushViewController(reportScreen, true); break; /*case 1: //Jaktbok var uploadScreen = new UploadScreen(jakt); this.NavigationController.PushViewController(uploadScreen, true); break; case 2: //Del på face MessageBox.Show("Ennå ikke implementert...", ""); break; */default: //Avbryt break; } }; }
public override void LoadView () { NavigationItem.RightBarButtonItem= new UIBarButtonItem(UIBarButtonSystemItem.Compose, delegate { var actionSheet = new UIActionSheet ("Email", null, "Cancel", "PNG", "PDF"){ Style = UIActionSheetStyle.Default }; actionSheet.Clicked += delegate (object sender, UIButtonEventArgs args){ if(args.ButtonIndex > 1) return; Email(args.ButtonIndex == 0 ? "png" : "pdf"); }; actionSheet.ShowInView (View); }); View = new UIView(plotFrame); image_plotted_by_OxyPlot = new GraphView(plotModel); image_plotted_by_OxyPlot.Frame = plotFrame; View.AddSubview(image_plotted_by_OxyPlot); image_plotted_by_OxyPlot.SetAllowPinchScaling(true); }
public override void Clicked(UIActionSheet actionview, int buttonIndex) { if (buttonIndex == 0) { Console.Write("Satya!!!!!!"); /*UIActivityIndicatorView spinner = new UIActivityIndicatorView(new RectangleF(0,0,200,300)); spinner.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge; spinner.Center= new PointF(160, 140); spinner.HidesWhenStopped = true; actionview.AddSubview(spinner); InvokeOnMainThread(delegate() { spinner.StartAnimating(); }); */ var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); fileName = documents + "/" + fileName; data = NSData.FromUrl(_nsurl); File.WriteAllBytes(fileName,data.ToArray()); if (File.Exists(fileName)) { UIAlertView alert = new UIAlertView(); alert.Title = "Download Complete"; alert.AddButton("Done"); alert.Show(); } //spinner.StopAnimating(); } }
public override void CommitEditingStyle (UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { var dog = DogList.ElementAt(indexPath.Row); var actionSheet = new UIActionSheet("") {"Slett hund", Utils.Translate("cancel")}; actionSheet.Title = dog.Navn + " vil bli slettet og fjernet fra alle logger."; actionSheet.DestructiveButtonIndex = 0; actionSheet.CancelButtonIndex = 1; actionSheet.ShowFromTabBar(JaktLoggApp.instance.TabBarController.TabBar); actionSheet.Clicked += delegate(object sender, UIButtonEventArgs e) { Console.WriteLine(e.ButtonIndex); switch (e.ButtonIndex) { case 0: //Slett JaktLoggApp.instance.DeleteDog(dog); _controller.Refresh(); break; case 1: //Avbryt break; } }; }
public void ShareLink(string title, string status, string link) { var buttonTitle = string.Empty; var actionSheet = new UIActionSheet("Partilhar"); actionSheet.AddButton("Facebook"); actionSheet.AddButton("Twitter"); actionSheet.Clicked += delegate(object a, UIKit.UIButtonEventArgs b) { if(b.ButtonIndex != -1) { buttonTitle = actionSheet.ButtonTitle(b.ButtonIndex); } }; actionSheet.Dismissed += (sender, e) => { if (buttonTitle.Equals("Facebook")) { ShareOnService(SLServiceKind.Facebook, title, status, link); } else if (buttonTitle.Equals("Twitter")) { ShareOnService(SLServiceKind.Twitter, title, status, link); } }; actionSheet.ShowInView(UIApplication.SharedApplication.KeyWindow.RootViewController.View); }
protected void ActionSheetButtonsTouchUpInside(object sender, EventArgs e, int index) { UIActionSheet actionSheet = new UIActionSheet("Actions"); actionSheet.AddButton("Edit"); actionSheet.AddButton("Change status"); actionSheet.AddButton("Delete"); actionSheet.AddButton("Cancel"); actionSheet.DestructiveButtonIndex = 0; actionSheet.CancelButtonIndex = 3; var source = sender as MvxSimpleTableViewSource; var currentCell = source?.SelectedItem as CurrentTaskItem; actionSheet.Clicked += delegate(object a, UIButtonEventArgs but) { if (but.ButtonIndex == 0) { ViewModel.EditTaskCommand.Execute(null); } if (but.ButtonIndex == 1) { ViewModel.ChangeTaskStatusCommand(currentCell, index); } if (but.ButtonIndex == 2) { ViewModel.DeleteTaskCommand(currentCell, index); } }; actionSheet.ShowInView(View); }
public void Dismiss() { var actionSheet = new UIActionSheet(); actionSheet.AddButton("OK"); actionSheet.AddButton("Cancel"); actionSheet.DismissWithClickedButtonIndex(-1, false); }
private void HandleRightButtonClicked(object sender, EventArgs e) { var sheet = new UIActionSheet("Actions"); sheet.AddButton("Add"); sheet.AddButton("Kill"); sheet.Clicked += HandleActionSheetButtonClicked; sheet.ShowFrom(_rightButton, true); }
partial void OnAddAnimalsClick(MonoTouch.Foundation.NSObject sender) { var sheet = new UIActionSheet("Add Animals"); sheet.AddButton("Add Dog"); sheet.AddButton("Add Kitten"); sheet.Clicked += HandleAddAnimalClicked; sheet.ShowInView(this.View); }
public void RowSelected(UITableView tableView, NSIndexPath indexPath) { _lastItemClicked = indexPath; tableView.DeselectRow(indexPath, true); var actionSheet = new UIActionSheet("Microsoft Cognitive Services", this, "Cancel", null, "Add Face"); actionSheet.ShowInView(tableView); }
public void ButtonTitle() { string text = Guid.NewGuid().ToString("N"); var actionSheet = new UIActionSheet(); actionSheet.AddButton(text); Assert.AreEqual(text, actionSheet.ButtonTitle(0)); }
public void RowSelected(UITableView tableView, NSIndexPath indexPath) { _lastItemClicked = indexPath; tableView.DeselectRow(indexPath, true); var actionSheet = new UIActionSheet($"{ResourcesTexts.MSCS}", this, $"{ResourcesTexts.Cancel}", null, $"{ResourcesTexts.AddFace}"); actionSheet.ShowInView(tableView); }
public override void ViewDidLoad() { base.ViewDidLoad(); var split = new SplitButtonElement(); var followers = split.AddButton("Followers", "-", () => ViewModel.GoToFollowersCommand.ExecuteIfCan()); var following = split.AddButton("Following", "-", () => ViewModel.GoToFollowingCommand.ExecuteIfCan()); var events = new StyledStringElement("Events", () => ViewModel.GoToEventsCommand.ExecuteIfCan(), Images.Event); var organizations = new StyledStringElement("Organizations", () => ViewModel.GoToOrganizationsCommand.ExecuteIfCan(), Images.Group); var repos = new StyledStringElement("Repositories", () => ViewModel.GoToRepositoriesCommand.ExecuteIfCan(), Images.Repo); var gists = new StyledStringElement("Gists", () => ViewModel.GoToGistsCommand.ExecuteIfCan(), Images.Script); Root.Reset(new [] { new Section(HeaderView) { split }, new Section { events, organizations, repos, gists } }); if (!ViewModel.IsLoggedInUser) { NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s_, e_) => { _actionSheet = new UIActionSheet(ViewModel.Username); var followButton = ViewModel.IsFollowing.HasValue ? _actionSheet.AddButton(ViewModel.IsFollowing.Value ? "Unfollow" : "Follow") : -1; var cancelButton = _actionSheet.AddButton("Cancel"); _actionSheet.CancelButtonIndex = cancelButton; _actionSheet.DismissWithClickedButtonIndex(cancelButton, true); _actionSheet.Clicked += (s, e) => { if (e.ButtonIndex == followButton) { ViewModel.ToggleFollowingCommand.ExecuteIfCan(); } _actionSheet = null; }; _actionSheet.ShowInView(View); }); NavigationItem.RightBarButtonItem.EnableIfExecutable(ViewModel.WhenAnyValue(x => x.IsFollowing, x => x.HasValue)); } ViewModel.WhenAnyValue(x => x.User).Where(x => x != null).Subscribe(x => { HeaderView.SubText = x.Name; HeaderView.ImageUri = x.AvatarUrl; followers.Text = x.Followers.ToString(); following.Text = x.Following.ToString(); if (!string.IsNullOrEmpty(x.Name)) { HeaderView.SubText = x.Name; } ReloadData(); }); }
void ShareButtonTap(object sender) { if (ViewModel.Gist == null) { return; } var app = Mvx.Resolve <IApplicationService>(); var isOwner = string.Equals(app.Account.Username, ViewModel.Gist?.Owner?.Login, StringComparison.OrdinalIgnoreCase); var gist = ViewModel.Gist; var sheet = new UIActionSheet(); var editButton = sheet.AddButton(isOwner ? "Edit" : "Fork"); var starButton = sheet.AddButton(ViewModel.IsStarred ? "Unstar" : "Star"); var shareButton = sheet.AddButton("Share"); var showButton = sheet.AddButton("Show in GitHub"); var cancelButton = sheet.AddButton("Cancel"); sheet.CancelButtonIndex = cancelButton; sheet.DismissWithClickedButtonIndex(cancelButton, true); sheet.Dismissed += (s, e) => { BeginInvokeOnMainThread(() => { try { if (e.ButtonIndex == shareButton) { AlertDialogService.Share( $"Gist {gist.Files?.Select(x => x.Key).FirstOrDefault() ?? gist.Id}", gist.Description, gist.HtmlUrl, sender as UIBarButtonItem); } else if (e.ButtonIndex == showButton) { ViewModel.GoToHtmlUrlCommand.Execute(null); } else if (e.ButtonIndex == starButton) { ViewModel.ToggleStarCommand.Execute(null); } else if (e.ButtonIndex == editButton) { Compose().ToBackground(); } } catch { } }); sheet.Dispose(); }; sheet.ShowFromToolbar(NavigationController.Toolbar); }
public override void Clicked(UIActionSheet actionSheet, nint index) { UIApplication.SharedApplication.InvokeOnMainThread(delegate { if (JsCallBackFunctions != null && JsCallBackFunctions.Length > 0 && JsCallBackFunctions.Length >= index) { IPhoneServiceLocator.CurrentDelegate.EvaluateJavascript(JsCallBackFunctions[index]); } }); }
void HandleBtnSimpleActionSheetTouchUpInside (object sender, EventArgs e) { // create an action sheet using the qualified constructor actionSheet = new UIActionSheet ("simple action sheet", null, "cancel", "delete", null); actionSheet.Clicked += (object a, UIButtonEventArgs b) => { Console.WriteLine (string.Format("Button {0} clicked", b.ButtonIndex)); }; actionSheet.ShowInView (View); }
partial void OnAddAnimalsClick(MonoTouch.Foundation.NSObject sender) { var sheet = new UIActionSheet("Add Animals"); sheet.AddButton("Add Dog"); sheet.AddButton("Add Kitten"); sheet.Clicked += HandleAddAnimalClicked; sheet.ShowInView(this.View); }
void HandleRightButtonClicked(object sender, EventArgs e) { var sheet = new UIActionSheet("Actions"); sheet.AddButton("Add"); sheet.AddButton("Kill"); sheet.Clicked += HandleActionSheetButtonClicked; sheet.ShowFrom(_rightButton, true); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { if (indexPath.Row == 0) { _sheet = new UIActionSheet("Change Torrent Status", null, "Cancel", "Remove Torrent + Data", "Remove"); _sheet.Dismissed += OnDimissed; _sheet.ShowFromTabBar(_tabBar); } }
public void InitWithFrame() { RectangleF frame = new RectangleF(10, 10, 100, 100); using (UIActionSheet a = new UIActionSheet(frame)) { Assert.That(a.Frame, Is.EqualTo(frame), "Frame"); CheckDefault(a); } }
/// <summary> /// Shows me in an action sheet /// </summary> public void ShowInActionSheet(UIView container) { Console.WriteLine("VIEW LOADED: " + this.IsViewLoaded); pickerSheet = new UIActionSheet(); pickerSheet.ShowInView(container); var frame = new System.Drawing.RectangleF(0, 260, container.Frame.Width, 260); pickerSheet.Frame = frame; }
public override void ActionSheet(ActionSheetOptions options) { this.Dispatch(() => { var action = new UIActionSheet(options.Title); options.Options.ToList().ForEach(x => action.AddButton(x.Text)); action.Clicked += (sender, btn) => options.Options[btn.ButtonIndex].Action(); var view = UIApplication.SharedApplication.KeyWindow.RootViewController.View; action.ShowInView(view); }); }
public override void ActionSheet(ActionSheetConfig config) { Device.BeginInvokeOnMainThread(() => { var action = new UIActionSheet(config.Title); config.Options.ToList().ForEach(x => action.AddButton(x.Text)); action.Clicked += (sender, btn) => config.Options[btn.ButtonIndex].Action(); var view = Utils.GetTopView(); action.ShowInView(view); }); }
public override void ViewDidLoad() { base.ViewDidLoad (); this.textView.Text = ""; this.btnReset.TouchUpInside += (sender, e) => { var actionSheet = new UIActionSheet("Are you sure you want to reset ?", null, "Cancel", "Reset", "?"); actionSheet.Clicked += HandleActionSheetClicked;; actionSheet.ShowInView(View); }; }
protected void HandleBtnActionSheetWithOtherButtonsTouchUpInside (object sender, EventArgs e) { actionSheet = new UIActionSheet ("action sheet with other buttons"); actionSheet.AddButton ("delete"); actionSheet.AddButton ("a different option!"); actionSheet.AddButton ("another option"); actionSheet.DestructiveButtonIndex = 0; actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) { Console.WriteLine ("Button " + b.ButtonIndex.ToString () + " clicked"); }; actionSheet.ShowInView (View); }
void DialogOtherAction () { var actionSheet = new UIActionSheet ("UIActionSheet <title>", null, "Cancel", "OK", "Other1"){ Style = UIActionSheetStyle.Default }; actionSheet.Clicked += delegate (object sender, UIButtonEventArgs args){ Console.WriteLine ("Clicked on item {0}", args.ButtonIndex); }; actionSheet.ShowInView (view); }
partial void changePicture (MonoTouch.UIKit.UIButton sender) { Console.WriteLine("changePicture called in MonoTouch"); _changePictureSheet = new UIActionSheet ( "Change Picture", new ChangePictureActionSheetDelegate (this), "Cancel", null, "Image 1", "Image 2"); _changePictureSheet.ShowInView (imageView); }
/// <summary> /// Shows me in an action sheet /// </summary> public void ShowInActionSheet(UIView container) { pickerSheet = new UIActionSheet (); pickerSheet.ShowInView (container); int height = 260; var frame = new System.Drawing.RectangleF (0, container.Frame.Height-height, container.Frame.Width, height); pickerSheet.Frame = frame; this.View.Frame = new System.Drawing.RectangleF (0, 0, 320, height); pickerSheet.AddSubview (this.View); }