public static UIBarButtonItem ToBarButtonItem(this IReactiveCommand @this, UIBarButtonSystemItem item) { var button = new UIBarButtonItem(item, (s, e) => @this.ExecuteIfCan()); button.EnableIfExecutable(@this); return(button); }
public static UIBarButtonItem ToBarButtonItem(this IReactiveCommand @this, UIBarButtonSystemItem item) { if (@this == null) return null; var button = new UIBarButtonItem(item, (s, e) => @this.ExecuteIfCan(s)); button.EnableIfExecutable(@this); return button; }
public UIBarButtonItem(UIBarButtonSystemItem systemItem, EventHandler handler) : this(systemItem, new Callback (), actionSel) { callback = (Callback) Target; callback.container = this; clicked += handler; MarkDirty (); }
public UIBarButtonItem(UIBarButtonSystemItem systemItem, EventHandler handler) : this(systemItem, new Callback(), actionSel) { callback = (Callback)Target; callback.container = this; clicked += handler; MarkDirty(); }
public static void SetCommand(this UINavigationItem navigationItem, UIBarButtonSystemItem systemItem, ICommand command, bool left) { var item = new UIBarButtonItem( systemItem, (sender, e) => command?.Execute(sender)); navigationItem.AddButtonItem(item, left); }
public static UIBarButtonItem CreateSystemItem(UIBarButtonSystemItem systemItem, Action action) { var button = new UIBarButtonItem( systemItem, (sender, args) => action() ); button.SetTitleTextAttributes(barButtonTextAttributes, UIControlState.Normal); button.SetTitleTextAttributes(barButtonTextAttributes, UIControlState.Highlighted); return(button); }
// Sets a IOS specific System Icon // ------------------------------- void SetSystemBarButton(UIBarButtonSystemItem systemButton = UIBarButtonSystemItem.Stop) { var topVC = this.TopViewController; // create the image back button var backButton = new UIBarButtonItem( systemButton, (sender, args) => { topVC.NavigationController.PopViewController(true); }); topVC.NavigationItem.LeftBarButtonItem = backButton; }
void ObserveCurrentRate(NSObservedChange change) { // Update playPauseButton type. var newRate = ((NSNumber)change.NewValue).DoubleValue; UIBarButtonSystemItem style = (Math.Abs(newRate) < float.Epsilon) ? UIBarButtonSystemItem.Play : UIBarButtonSystemItem.Pause; var newPlayPauseButton = new UIBarButtonItem(style, PlayPauseButtonWasPressed); // Replace the current button with the updated button in the toolbar. UIBarButtonItem[] items = Toolbar.Items; var playPauseItemIndex = Array.IndexOf(items, PlayPauseButton); if (playPauseItemIndex >= 0) { items[playPauseItemIndex] = newPlayPauseButton; PlayPauseButton = newPlayPauseButton; Toolbar.SetItems(items, false); } }
public override void ViewDidLoad () { base.ViewDidLoad (); Title = "Toolbar"; View.BackgroundColor = UIColor.GroupTableViewBackgroundColor; toolbar = new UIToolbar() { BarStyle = UIBarStyle.Default }; toolbar.SizeToFit (); float toolbarHeight = toolbar.Frame.Height; var mainViewBounds = View.Bounds; toolbar.Frame = new RectangleF (mainViewBounds.X, (float)(mainViewBounds.Y + mainViewBounds.Height - toolbarHeight * 2 + 2), mainViewBounds.Width, toolbarHeight); View.AddSubview (toolbar); currentSystemItem = UIBarButtonSystemItem.Done; CreateToolbarItems (); systemButtonPicker.Model = new ItemPickerModel (this); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Toolbar"; View.BackgroundColor = UIColor.GroupTableViewBackgroundColor; toolbar = new UIToolbar() { BarStyle = UIBarStyle.Default }; toolbar.SizeToFit(); float toolbarHeight = toolbar.Frame.Height; var mainViewBounds = View.Bounds; toolbar.Frame = new RectangleF(mainViewBounds.X, (float)(mainViewBounds.Y + mainViewBounds.Height - toolbarHeight * 2 + 2), mainViewBounds.Width, toolbarHeight); View.AddSubview(toolbar); currentSystemItem = UIBarButtonSystemItem.Done; CreateToolbarItems(); systemButtonPicker.Model = new ItemPickerModel(this); }
public CommandBarButtonItem(UIBarButtonSystemItem systemItem): base(systemItem, (s, e) => Command.Execute(null)) {}
public virtual UIBarButtonItem CreateBarButton (UIImage image, EventHandler handler, UIBarButtonSystemItem fallback = UIBarButtonSystemItem.Add) { if (image == null) return new UIBarButtonItem (fallback, handler); return new UIBarButtonItem (image, UIBarButtonItemStyle.Plain, handler); }
public CommandBarButtonItem(UIBarButtonSystemItem systemItem) : base(systemItem, (s, e) => Execute(CommandParameter)) { }
public CommandBarButtonItem(UIBarButtonSystemItem systemItem) : base(systemItem, (s, e) => Command.Execute(null)) { }
public UIBarButtonItem(UIBarButtonSystemItem systemItem) : this(systemItem, null, null) { }
public CommandBarButtonItem(UIBarButtonSystemItem systemItem) : base(systemItem) { }
public virtual UIBarButtonItem CreateBarButton(UIImage image, EventHandler handler, UIBarButtonSystemItem fallback = UIBarButtonSystemItem.Add) { if (image == null) { return(new UIBarButtonItem(fallback, handler)); } return(new UIBarButtonItem(image, UIBarButtonItemStyle.Plain, handler)); }
public UIBarBtn(UIBarButtonSystemItem si, EventHandler handler) : base(si,handler) { }
private static CommandBarButtonItem CreateCommandBarButton(object view, MemberInfo member, string title, UIView buttonView, UIBarButtonItemStyle style, UIBarButtonSystemItem? buttonType, BarButtonLocation location) { ICommandInterceptor commandInterceptor = null; CommandBarButtonItem button = null; ReflectiveCommand command = null; var methodInfo = member as MethodInfo; if(methodInfo != null) { command = GetCommandForMember(view, member); var cellViewTemplates = member.GetCustomAttributes<CellViewTemplate>(); if (cellViewTemplates.Length > 0) { var interceptorTemplate = cellViewTemplates .FirstOrDefault((template) => template.CellViewType != null && template.CellViewType.GetInterfaces() .Any((type)=> type == typeof(ICommandInterceptor))) as CellViewTemplate; if (interceptorTemplate != null) { commandInterceptor = Activator.CreateInstance(interceptorTemplate.CellViewType) as ICommandInterceptor; } } } if (!string.IsNullOrEmpty(title)) { button = new CommandBarButtonItem(title, style); } else if (buttonView != null) { button = new CommandBarButtonItem(buttonView); } else { if (!buttonType.HasValue) buttonType = UIBarButtonSystemItem.Done; button = new CommandBarButtonItem(buttonType.Value); button.Style = style; } command.CommandButton = button; button.Enabled = true; button.Location = location; button.Command = command; button.CommandInterceptor = commandInterceptor; var orderAttribute = member.GetCustomAttribute<OrderAttribute>(); if (orderAttribute != null) button.Order = orderAttribute.Order; else button.Order = 0; return button; }
public CommandBarButtonItem(UIBarButtonSystemItem systemItem): base(systemItem) {}
public UIBarButtonItemEx(UIBarButtonSystemItem systemItem) : base(systemItem) { }
public EditButtonAttribute(UIBarButtonSystemItem buttonType) { ButtonType = buttonType; }
public static IDisposable ToBarButtonItem(this IObservable<IReactiveCommand> @this, UIBarButtonSystemItem systemItem, Action<UIBarButtonItem> assignment) { return ToBarButtonItem(@this, () => new UIBarButtonItem(systemItem), assignment); }
public override UIBarButtonItem CreateBarButton (UIImage image, EventHandler handler, UIBarButtonSystemItem fallback = UIBarButtonSystemItem.Add) { if (image == null) return new UIBarButtonItem (fallback, handler); if (IsModern) return new UIBarButtonItem (image, UIBarButtonItemStyle.Plain, handler); var button = UIButton.FromType (UIButtonType.Custom); var sz = image.Size; sz.Width = Math.Max (44, 44); sz.Height = 44; button.Frame = new CGRect (CGPoint.Empty, sz); button.SetImage (image, UIControlState.Normal); button.ShowsTouchWhenHighlighted = true; button.TouchUpInside += handler; return new UIBarButtonItem (button); }
public UIBarButtonItem(UIBarButtonSystemItem barButtonSystemItem, [Optional] AnyObject target, Selector action) { }
private static CommandBarButtonItem CreateCommandBarButton(object view, MemberInfo member, string title, UIView buttonView, UIBarButtonItemStyle style, UIBarButtonSystemItem? buttonType, BarButtonLocation location) { CommandBarButtonItem button = null; ReflectiveCommand command = null; var methodInfo = member as MethodInfo; if(methodInfo != null) command = GetCommandForMember(view, member); if (!string.IsNullOrEmpty(title)) { button = new CommandBarButtonItem(title, style, (sender, e) => command.Execute(null)); } else if (buttonView != null) { button = new CommandBarButtonItem(buttonView); } else { if (!buttonType.HasValue) buttonType = UIBarButtonSystemItem.Done; button = new CommandBarButtonItem(buttonType.Value, (sender, e) => command.Execute(null)); button.Style = style; } command.CommandButton = button; button.Enabled = true; button.Location = location; button.Command = command; var orderAttribute = member.GetCustomAttribute<OrderAttribute>(); if (orderAttribute != null) button.Order = orderAttribute.Order; else button.Order = 0; return button; }
public EditButtonAttribute(UIBarButtonSystemItem buttonType) { ButtonType = buttonType; }
public ToolbarButtonAttribute(UIBarButtonSystemItem buttonType): this() { ButtonType = buttonType; }
public UIBarButtonItem(UIBarButtonSystemItem systemItem) : this(systemItem, null, null) { }
public static UIBarButtonItemEx Create(UIBarButtonSystemItem systemItem) { return new UIBarButtonItemEx(systemItem); }
/// <summary> /// Initializes a new instance of the <see cref="KSPictureLoginLib.KSBarButtonItem"/> class. /// </summary> /// <param name="controller">A reference to the <see cref="KSPictureLoginController"/> </param> /// <param name="sysItem">a system item.</param> public KSBarButtonItem(KSPictureLoginController controller, UIBarButtonSystemItem sysItem) : base(sysItem, null) { this.controller = new WeakReference (controller); }
public CommandBarButtonItem(UIBarButtonSystemItem systemItem, EventHandler handler): base(systemItem, handler) {}
private CommandBarButtonItem CreateCommandBarButton(object view, MemberInfo member, string title, UIView buttonView, UIBarButtonItemStyle style, UIBarButtonSystemItem buttonType, BarButtonLocation location) { CommandBarButtonItem button = null; ICommand command = null; var methodInfo = member as MethodInfo; if (methodInfo != null) { command = new ReflectiveCommand(view, member as MethodInfo, null); } if (!string.IsNullOrEmpty(title)) { button = new CommandBarButtonItem(title, style, delegate { command.Execute(null); }); } else if (buttonView != null) { button = new CommandBarButtonItem(buttonView); } else { button = new CommandBarButtonItem(buttonType, delegate { command.Execute(null); }); button.Style = style; } button.Enabled = true; button.Location = location; var orderAttribute = member.GetCustomAttribute <OrderAttribute>(); if (orderAttribute != null) { button.Order = orderAttribute.Order; } else { button.Order = 0; } return(button); }
public CommandBarButtonItem(UIBarButtonSystemItem systemItem, NSObject target, Selector action): base(systemItem, target, action) {}
public CommandBarButtonItem(UIBarButtonSystemItem systemItem): base(systemItem, (s, e) => Execute(CommandParameter)) {}
public override UIBarButtonItem CreateBarButton(UIImage image, EventHandler handler, UIBarButtonSystemItem fallback = UIBarButtonSystemItem.Add) { if (image == null) { return(new UIBarButtonItem(fallback, handler)); } if (IsModern) { return(new UIBarButtonItem(image, UIBarButtonItemStyle.Plain, handler)); } var button = UIButton.FromType(UIButtonType.Custom); var sz = image.Size; sz.Width = Math.Max(44, 44); sz.Height = 44; button.Frame = new CGRect(CGPoint.Empty, sz); button.SetImage(image, UIControlState.Normal); button.ShowsTouchWhenHighlighted = true; button.TouchUpInside += handler; return(new UIBarButtonItem(button)); }
private CommandBarButtonItem CreateCommandBarButton(object view, MemberInfo member, string title, UIBarButtonItemStyle style, UIBarButtonSystemItem buttonType, BarButtonLocation location ) { CommandBarButtonItem button = null; ICommand command = null; var methodInfo = member as MethodInfo; if(methodInfo != null) command = new ReflectiveCommand(view, member as MethodInfo, null); if(!string.IsNullOrEmpty(title)) { button = new CommandBarButtonItem(title, style, delegate {command.Execute(null); }); } else { button = new CommandBarButtonItem(buttonType, delegate {command.Execute(null); }); button.Style = style; } button.Enabled = true; button.Location = location; var orderAttribute = member.GetCustomAttribute<OrderAttribute>(); if (orderAttribute != null) button.Order = orderAttribute.Order; else button.Order = 0; return button; }
public ToolbarButtonAttribute(UIBarButtonSystemItem buttonType) : this() { ButtonType = buttonType; }
public static IDisposable ToBarButtonItem(this IObservable <ReactiveCommand> @this, UIBarButtonSystemItem systemItem, Action <UIBarButtonItem> assignment) { return(ToBarButtonItem(@this, () => new UIBarButtonItem(systemItem), assignment)); }
public CommandBarButtonItem(UIBarButtonSystemItem systemItem, EventHandler handler) : base(systemItem, handler) { }
/// <summary> /// Initializes a new instance of the <see cref="KSPictureLoginLib.KSBarButtonItem"/> class. /// </summary> /// <param name="sysItem">a system item.</param> public KSPictureLoginBarButtonItem( UIBarButtonSystemItem sysItem) : base(sysItem) { this.Initialize (); }
public CommandBarButtonItem(UIBarButtonSystemItem systemItem, NSObject target, Selector action) : base(systemItem, target, action) { }
public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context) { if (context != IntPtr.Zero) { base.ObserveValue(keyPath, ofObject, change, context); return; } var ch = new NSObservedChange(change); if (keyPath == "currentItem.duration") { // Update `TimeSlider` and enable/disable controls when `duration` > 0.0 CMTime newDuration; var newDurationAsValue = ch.NewValue as NSValue; newDuration = (newDurationAsValue != null) ? newDurationAsValue.CMTimeValue : CMTime.Zero; var hasValidDuration = newDuration.IsNumeric && newDuration.Value != 0; var newDurationSeconds = hasValidDuration ? newDuration.Seconds : 0; TimeSlider.MaxValue = (float)newDurationSeconds; var currentTime = Player.CurrentTime.Seconds; TimeSlider.Value = (float)(hasValidDuration ? currentTime : 0); PlayPauseButton.Enabled = hasValidDuration; TimeSlider.Enabled = hasValidDuration; } else if (keyPath == "rate") { // Update playPauseButton type. var newRate = ((NSNumber)ch.NewValue).DoubleValue; UIBarButtonSystemItem style = (newRate == 0) ? UIBarButtonSystemItem.Play : UIBarButtonSystemItem.Pause; var newPlayPauseButton = new UIBarButtonItem(style, PlayPauseButtonWasPressed); // Replace the current button with the updated button in the toolbar. UIBarButtonItem[] items = Toolbar.Items; var playPauseItemIndex = Array.IndexOf(items, PlayPauseButton); if (playPauseItemIndex >= 0) { items [playPauseItemIndex] = newPlayPauseButton; PlayPauseButton = newPlayPauseButton; Toolbar.SetItems(items, false); } } else if (keyPath == "currentItem.status") { // Display an error if status becomes Failed var newStatusAsNumber = ch.NewValue as NSNumber; AVPlayerItemStatus newStatus = (newStatusAsNumber != null) ? (AVPlayerItemStatus)newStatusAsNumber.Int32Value : AVPlayerItemStatus.Unknown; if (newStatus == AVPlayerItemStatus.Failed) { HandleError(Player.CurrentItem.Error); } else if (newStatus == AVPlayerItemStatus.ReadyToPlay) { var asset = Player.CurrentItem != null ? Player.CurrentItem.Asset : null; if (asset != null) { // First test whether the values of `assetKeysRequiredToPlay` we need // have been successfully loaded. foreach (var key in assetKeysRequiredToPlay) { NSError error; if (asset.StatusOfValue(key, out error) == AVKeyValueStatus.Failed) { HandleError(error); return; } } if (!asset.Playable || asset.ProtectedContent) { // We can't play this asset. HandleError(null); return; } // The player item is ready to play, // setup picture in picture. SetupPictureInPicturePlayback(); } } } else if (keyPath == "pictureInPicturePossible") { // Enable the `PictureInPictureButton` only if `PictureInPicturePossible` // is true. If this returns false, it might mean that the application // was not configured as shown in the AppDelegate. PictureInPictureButton.Enabled = ((NSNumber)ch.NewValue).BoolValue; } }