当前位置: 首页>>代码示例>>C#>>正文


C# UIBarButtonItem.GetClickedObservable方法代码示例

本文整理汇总了C#中UIBarButtonItem.GetClickedObservable方法的典型用法代码示例。如果您正苦于以下问题:C# UIBarButtonItem.GetClickedObservable方法的具体用法?C# UIBarButtonItem.GetClickedObservable怎么用?C# UIBarButtonItem.GetClickedObservable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIBarButtonItem的用法示例。


在下文中一共展示了UIBarButtonItem.GetClickedObservable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BaseWebViewController

        protected BaseWebViewController(bool navigationToolbar, bool showPageAsTitle = false)
        {
            NavigationItem.BackBarButtonItem = new UIBarButtonItem { Title = "" };

            _navigationToolbar = navigationToolbar;
            _showPageAsTitle = showPageAsTitle;

            if (_navigationToolbar)
            {
                BackButton = new UIBarButtonItem { Image = Images.Web.BackButton, Enabled = false };
                ForwardButton = new UIBarButtonItem { Image = Images.Web.FowardButton, Enabled = false };
                RefreshButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh) { Enabled = false };

                BackButton.TintColor = Theme.CurrentTheme.WebButtonTint;
                ForwardButton.TintColor = Theme.CurrentTheme.WebButtonTint;
                RefreshButton.TintColor = Theme.CurrentTheme.WebButtonTint;

                OnActivation(d =>
                {
                    d(BackButton.GetClickedObservable().Subscribe(_ => GoBack()));
                    d(ForwardButton.GetClickedObservable().Subscribe(_ => GoForward()));
                    d(RefreshButton.GetClickedObservable().Subscribe(_ => Refresh()));
                });
            }

            EdgesForExtendedLayout = UIRectEdge.None;
        }
开发者ID:GitWatcher,项目名称:CodeHub,代码行数:27,代码来源:BaseWebViewController.cs

示例2: Composer

        public Composer () : base (null, null)
        {
            Title = "New Comment";
            EdgesForExtendedLayout = UIRectEdge.None;

            var close = new UIBarButtonItem { Image = Images.Buttons.Cancel };
            NavigationItem.LeftBarButtonItem = close;
            SendItem = new UIBarButtonItem { Image = Images.Buttons.Save };
            NavigationItem.RightBarButtonItem = SendItem;

            TextView = new UITextView(ComputeComposerSize(CGRect.Empty));
            TextView.Font = UIFont.PreferredBody;
            TextView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            // Work around an Apple bug in the UITextView that crashes
            if (ObjCRuntime.Runtime.Arch == ObjCRuntime.Arch.SIMULATOR)
                TextView.AutocorrectionType = UITextAutocorrectionType.No;

            View.AddSubview (TextView);

            _normalButtonImage = ImageFromColor(UIColor.White);
            _pressedButtonImage = ImageFromColor(UIColor.FromWhiteAlpha(0.0f, 0.4f));

            OnActivation(d =>
            {
                d(close.GetClickedObservable().Subscribe(_ => CloseComposer()));
                d(SendItem.GetClickedObservable().Subscribe(_ => PostCallback()));
            });
        }
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:29,代码来源:Composer.cs

示例3: AccountsViewController

        public AccountsViewController()
            : base(UITableViewStyle.Plain)
        {
            Title = "Accounts";

            var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);
            NavigationItem.RightBarButtonItem = addButton;
            OnActivation(d => d(addButton.GetClickedObservable().Subscribe(_ => AddAccount())));
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:9,代码来源:AccountsViewController.cs

示例4: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

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

            var vm = (IssueAddViewModel)ViewModel;
            var saveButton = new UIBarButtonItem { Image = Images.Buttons.SaveButton };
            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");

            Root.Reset(new Section { title, assignedTo, milestone, labels }, 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(vm.Bind(x => x.Content, true).Subscribe(x => content.Details = x));
                d(labels.Clicked.Subscribe(_ => vm.GoToLabelsCommand.Execute(null)));
                d(milestone.Clicked.Subscribe(_ => vm.GoToMilestonesCommand.Execute(null)));
                d(assignedTo.Clicked.Subscribe(_ => vm.GoToAssigneeCommand.Execute(null)));
                d(vm.Bind(x => x.IsSaving).SubscribeStatus("Saving..."));

                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(_ => {
                    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.NewComment(this, (text) => {
                        vm.Content = text;
                        composer.CloseComposer();
                    });
                }));
            });
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:56,代码来源:IssueAddView.cs

示例5: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var button = new UIBarButtonItem(UIBarButtonSystemItem.Add);

            if (ViewModel.IsMine)
                NavigationItem.RightBarButtonItem = button;

            OnActivation(d => d(button.GetClickedObservable().Subscribe(_ => GoToCreateGist())));
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:11,代码来源:UserGistsView.cs

示例6: ViewDidLoad

        public override void ViewDidLoad()
        {
            Title = "Notifications";

            base.ViewDidLoad();

            _segmentBarButton.Width = View.Frame.Width - 10f;
            ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };

            var checkButton = new UIBarButtonItem { Image = Images.Buttons.CheckButton };
            NavigationItem.RightBarButtonItem = checkButton;

            var vm = (NotificationsViewModel)ViewModel;
            var weakVm = new WeakReference<NotificationsViewModel>(vm);

            BindCollection(vm.Notifications, x =>
            {
                var el = new StringElement(x.Subject.Title, x.UpdatedAt.Humanize(), UITableViewCellStyle.Subtitle) { Accessory = UITableViewCellAccessory.DisclosureIndicator };

                var subject = x.Subject.Type.ToLower();
                if (subject.Equals("issue"))
                    el.Image = Octicon.IssueOpened.ToImage();
                else if (subject.Equals("pullrequest"))
                    el.Image = Octicon.GitPullRequest.ToImage();
                else if (subject.Equals("commit"))
                    el.Image = Octicon.GitCommit.ToImage();
                else if (subject.Equals("release"))
                    el.Image = Octicon.Tag.ToImage();
                else
                    el.Image = Octicon.Alert.ToImage();

                el.Clicked.Subscribe(MakeCallback(weakVm, x));
                return el;
            });

            var o = Observable.FromEventPattern(t => vm.ReadAllCommand.CanExecuteChanged += t, t => vm.ReadAllCommand.CanExecuteChanged -= t);

            OnActivation(d =>
            {
                d(checkButton.GetClickedObservable().BindCommand(vm.ReadAllCommand));
                d(vm.Bind(x => x.IsMarking).SubscribeStatus("Marking..."));
                d(vm.Bind(x => x.ShownIndex, true).Subscribe(x => _viewSegment.SelectedSegment = (nint)x));
                d(_viewSegment.GetChangedObservable().Subscribe(x => vm.ShownIndex = x));
                d(o.Subscribe(_ => NavigationItem.RightBarButtonItem.Enabled = vm.ReadAllCommand.CanExecute(null)));
            });
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:46,代码来源:NotificationsView.cs

示例7: ViewDidLoad

        public override void ViewDidLoad()
        {
            var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);
            NavigationItem.RightBarButtonItem = addButton;

            base.ViewDidLoad();

            _viewSegment = new CustomUISegmentedControl(new [] { "Open", "Closed", "Mine", "Custom" }, 3);
            _segmentBarButton = new UIBarButtonItem(_viewSegment);
            _segmentBarButton.Width = View.Frame.Width - 10f;
            ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
            BindCollection(ViewModel.Issues, CreateElement);

            OnActivation(d =>
            {
                d(addButton.GetClickedObservable().BindCommand(ViewModel.GoToNewIssueCommand));
            });
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:18,代码来源:IssuesView.cs

示例8: LiteComposer

        public LiteComposer()
            : base(null, null)
        {
            Title = "New Comment";
            EdgesForExtendedLayout = UIRectEdge.None;

            _textView = new UITextView()
            {
                Font = UIFont.PreferredBody
            };

            var close = new UIBarButtonItem { Image = Images.Buttons.BackButton };
            NavigationItem.LeftBarButtonItem = close;
            _sendButton = new UIBarButtonItem { Image = Images.Buttons.SaveButton };
            NavigationItem.RightBarButtonItem = _sendButton;

            OnActivation(d =>
            {
                d(close.GetClickedObservable().Subscribe(_ => CloseComposer()));
                d(_sendButton.GetClickedObservable().Subscribe(_ => PostCallback()));
            });
        }
开发者ID:RaineriOS,项目名称:CodeHub,代码行数:22,代码来源:LiteComposer.cs

示例9: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _splitButton1 = _split.AddButton("Comments", "-");
            _splitButton2 = _split.AddButton("Participants", "-");

            Title = "Issue #" + ViewModel.Id;
            HeaderView.SetImage(null, Images.Avatar);
            HeaderView.Text = Title;

            Appeared.Take(1)
                .Select(_ => Observable.Timer(TimeSpan.FromSeconds(0.2f)))
                .Switch()
                .ObserveOn(RxApp.MainThreadScheduler)
                .Select(_ => ViewModel.Bind(x => x.IsClosed, true).Where(x => x.HasValue).Select(x => x.Value))
                .Switch()
                .Subscribe(x => 
                {
                    HeaderView.SubImageView.TintColor = x ? UIColor.FromRGB(0xbd, 0x2c, 0) : UIColor.FromRGB(0x6c, 0xc6, 0x44);
                    HeaderView.SetSubImage((x ? Octicon.IssueClosed :Octicon.IssueOpened).ToImage());
                });

            _milestoneElement = new StringElement("Milestone", "No Milestone", UITableViewCellStyle.Value1) {Image = Octicon.Milestone.ToImage() };
            _assigneeElement = new StringElement("Assigned", "Unassigned", UITableViewCellStyle.Value1) {Image = Octicon.Person.ToImage() };
            _labelsElement = new StringElement("Labels", "None", UITableViewCellStyle.Value1) {Image = Octicon.Tag.ToImage() };
            _addCommentElement = new StringElement("Add Comment") { Image = Octicon.Pencil.ToImage() };

            var actionButton = new UIBarButtonItem(UIBarButtonSystemItem.Action) { Enabled = false };
            NavigationItem.RightBarButtonItem = actionButton;

            ViewModel.Bind(x => x.IsModifying).SubscribeStatus("Loading...");

            ViewModel.Bind(x => x.Issue).Subscribe(x =>
            {
                _assigneeElement.Value = x.Assignee != null ? x.Assignee.Login : "Unassigned";
                _milestoneElement.Value = x.Milestone != null ? x.Milestone.Title : "No Milestone";
                _labelsElement.Value = x.Labels.Count == 0 ? "None" : string.Join(", ", x.Labels.Select(i => i.Name));

                var model = new DescriptionModel(ViewModel.MarkdownDescription, (int)UIFont.PreferredSubheadline.PointSize, true);
                var markdown = new MarkdownView { Model = model };
                var html = markdown.GenerateString();
                _descriptionElement.SetValue(string.IsNullOrEmpty(ViewModel.MarkdownDescription) ? null : html);

                HeaderView.Text = x.Title;
                HeaderView.SubText = "Updated " + x.UpdatedAt.Humanize();
                HeaderView.SetImage(x.User?.AvatarUrl, Images.Avatar);
                RefreshHeaderView();

                Render();
            });

            ViewModel.BindCollection(x => x.Comments).Subscribe(_ => RenderComments());
            ViewModel.BindCollection(x => x.Events).Subscribe(_ => RenderComments());
            ViewModel.Bind(x => x.ShouldShowPro).Subscribe(x => {
                if (x) this.ShowPrivateView(); 
            });

            OnActivation(d =>
            {
                d(_milestoneElement.Clicked.BindCommand(ViewModel.GoToMilestoneCommand));
                d(_assigneeElement.Clicked.BindCommand(ViewModel.GoToAssigneeCommand));
                d(_labelsElement.Clicked.BindCommand(ViewModel.GoToLabelsCommand));
                d(_addCommentElement.Clicked.Subscribe(_ => AddCommentTapped()));
                d(_descriptionElement.UrlRequested.BindCommand(ViewModel.GoToUrlCommand));
                d(_commentsElement.UrlRequested.BindCommand(ViewModel.GoToUrlCommand));
                d(actionButton.GetClickedObservable().Subscribe(ShowExtraMenu));
                d(HeaderView.Clicked.BindCommand(ViewModel.GoToOwner));

                d(ViewModel.Bind(x => x.IsCollaborator, true).Subscribe(x => {
                    foreach (var i in new [] { _assigneeElement, _milestoneElement, _labelsElement })
                        i.Accessory = x ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                }));

                d(ViewModel.Bind(x => x.IsLoading).Subscribe(x => actionButton.Enabled = !x));
            });
        }
开发者ID:GitWatcher,项目名称:CodeHub,代码行数:77,代码来源:IssueView.cs


注:本文中的UIBarButtonItem.GetClickedObservable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。