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


C# StyledStringElement.GetImmediateRootElement方法代码示例

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


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

示例1: ViewDidLoad

        public override void ViewDidLoad()
        {
            Title = "Edit Issue";

            base.ViewDidLoad();

            _hud = this.CreateHud();
            var vm = (IssueEditViewModel)ViewModel;

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => {
                View.EndEditing(true);
                vm.SaveCommand.Execute(null);
            });

            var title = new InputElement("Title", string.Empty, string.Empty);
            title.Changed += (object sender, EventArgs e) => vm.Title = title.Value;

            var assignedTo = new StyledStringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1);
            assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            assignedTo.Tapped += () => vm.GoToAssigneeCommand.Execute(null);

            var milestone = new StyledStringElement("Milestone".t(), "None", UITableViewCellStyle.Value1);
            milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            milestone.Tapped += () => vm.GoToMilestonesCommand.Execute(null);

            var labels = new StyledStringElement("Labels".t(), "None", UITableViewCellStyle.Value1);
            labels.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            labels.Tapped += () => vm.GoToLabelsCommand.Execute(null);

            var content = new MultilinedElement("Description");
            content.Tapped += () =>
            {
                var composer = new Composer { Title = "Issue Description", Text = content.Value, ActionButtonText = "Save" };
                composer.NewComment(this, (text) => {
                    vm.Content = text;
                    composer.CloseComposer();
                });
            };

            var state = new TrueFalseElement("Open", true);
            state.ValueChanged += (sender, e) => vm.IsOpen = state.Value;

            vm.Bind(x => x.Title, x => title.Value = x, true);

            vm.Bind(x => x.Content, x => content.Value = x, true);

            vm.Bind(x => x.AssignedTo, x => {
                assignedTo.Value = x == null ? "Unassigned" : x.Login;
                if (assignedTo.GetImmediateRootElement() != null)
                    Root.Reload(assignedTo, UITableViewRowAnimation.None);
            }, true);

            vm.Bind(x => x.Milestone, x => {
                milestone.Value = x == null ? "None" : x.Title;
                if (assignedTo.GetImmediateRootElement() != null)
                    Root.Reload(milestone, UITableViewRowAnimation.None);
            }, true);

            vm.BindCollection(x => x.Labels, x => {
                labels.Value = vm.Labels.Items.Count == 0 ? "None" : string.Join(", ", vm.Labels.Items.Select(i => i.Name));
                if (assignedTo.GetImmediateRootElement() != null)
                    Root.Reload(labels, UITableViewRowAnimation.None);
            }, true);

            vm.Bind(x => x.IsOpen, x =>
            {
                state.Value = x;
                if (assignedTo.GetImmediateRootElement() != null)
                    Root.Reload(state, UITableViewRowAnimation.None);
            }, true);

            vm.Bind(x => x.IsSaving, x =>
            {
                if (x)
                    _hud.Show("Updating...");
                else
                    _hud.Hide();
            });

            Root = new RootElement(Title) { new Section { title, assignedTo, milestone, labels }, new Section { state }, new Section { content } };
        }
开发者ID:GirliOS,项目名称:CodeHub,代码行数:81,代码来源:IssueEditView.cs

示例2: ViewDidLoad

        public override void ViewDidLoad()
        {
            Root.UnevenRows = true;

            base.ViewDidLoad();

            _header = new HeaderView();
            _hud = this.CreateHud();

            var content = System.IO.File.ReadAllText("WebCell/body.html", System.Text.Encoding.UTF8);
            _descriptionElement = new WebElement(content, "body", false);
            _descriptionElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;

            var content2 = System.IO.File.ReadAllText("WebCell/comments.html", System.Text.Encoding.UTF8);
            _commentsElement = new WebElement(content2, "comments", true);
            _commentsElement.UrlRequested = ViewModel.GoToUrlCommand.Execute;

            _milestoneElement = new StyledStringElement("Milestone", "No Milestone", UITableViewCellStyle.Value1) { Image = Images.Milestone };
            _milestoneElement.Tapped += () => ViewModel.GoToMilestoneCommand.Execute(null);

            _assigneeElement = new StyledStringElement("Assigned", "Unassigned".t(), UITableViewCellStyle.Value1) { Image = Images.Person };
            _assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null);

            _labelsElement = new StyledStringElement("Labels", "None", UITableViewCellStyle.Value1) { Image = Images.Tag };
            _labelsElement.Tapped += () => ViewModel.GoToLabelsCommand.Execute(null);

            _addCommentElement = new StyledStringElement("Add Comment") { Image = Images.Pencil };
            _addCommentElement.Tapped += AddCommentTapped;

            _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Merge });
            _split2 = new SplitElement(new SplitElement.Row { Image1 = Images.Person, Image2 = Images.Create });

            ViewModel.Bind(x => x.PullRequest, x =>
            {
                var merged = (x.Merged != null && x.Merged.Value);

                _split1.Value.Text1 = x.State;
                _split1.Value.Text2 = merged ? "Merged" : "Not Merged";

                _split2.Value.Text1 = x.User.Login;
                _split2.Value.Text2 = x.CreatedAt.ToString("MM/dd/yy");

                _descriptionElement.Value = ViewModel.MarkdownDescription;
                _header.Title = x.Title;
                _header.Subtitle = "Updated " + x.UpdatedAt.ToDaysAgo();

                Render();
            });

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
            NavigationItem.RightBarButtonItem.Enabled = false;
            ViewModel.Bind(x => x.IsLoading, x =>
            {
                if (!x)
                {
                    NavigationItem.RightBarButtonItem.Enabled = ViewModel.PullRequest != null;
                }
            });

            ViewModel.Bind(x => x.IsModifying, x =>
            {
                if (x)
                    _hud.Show("Loading...");
                else
                    _hud.Hide();
            });

            ViewModel.Bind(x => x.Issue, x =>
            {
                _assigneeElement.Value = x.Assignee != null ? x.Assignee.Login : "Unassigned".t();
                _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));
                Render();
            });

            ViewModel.GoToLabelsCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _labelsElement.Accessory;
                _labelsElement.Accessory = ViewModel.GoToLabelsCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_labelsElement.Accessory != before && _labelsElement.GetImmediateRootElement() != null)
                    Root.Reload(_labelsElement, UITableViewRowAnimation.Fade);
            };
            ViewModel.GoToAssigneeCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _assigneeElement.Accessory;
                _assigneeElement.Accessory = ViewModel.GoToAssigneeCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_assigneeElement.Accessory != before && _assigneeElement.GetImmediateRootElement() != null)
                    Root.Reload(_assigneeElement, UITableViewRowAnimation.Fade);
            };
            ViewModel.GoToMilestoneCommand.CanExecuteChanged += (sender, e) =>
            {
                var before = _milestoneElement.Accessory;
                _milestoneElement.Accessory = ViewModel.GoToMilestoneCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;
                if (_milestoneElement.Accessory != before && _milestoneElement.GetImmediateRootElement() != null)
                    Root.Reload(_milestoneElement, UITableViewRowAnimation.Fade);
            };

            ViewModel.BindCollection(x => x.Comments, e => RenderComments());
            ViewModel.BindCollection(x => x.Events, e => RenderComments());
        }
开发者ID:ryanseys,项目名称:CodeHub,代码行数:100,代码来源:PullRequestView.cs


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