public FeedbackComposerView() { _descriptionElement = new ExpandingInputElement("Description"); _descriptionElement.AccessoryView = x => new MarkdownAccessoryView(x, ViewModel.PostToImgurCommand) { Frame = new CGRect(0, 0, 320f, 44f) }; this.WhenViewModel(x => x.Subject).Subscribe(x => _titleElement.Value = x); _titleElement.Changed += (sender, e) => ViewModel.Subject = _titleElement.Value; this.WhenViewModel(x => x.Description).Subscribe(x => _descriptionElement.Value = x); _descriptionElement.ValueChanged += (sender, e) => ViewModel.Description = _descriptionElement.Value; this.WhenViewModel(x => x.SubmitCommand).Subscribe(x => { NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, (s, e) => { ResignFirstResponder(); x.ExecuteIfCan(); }); x.CanExecuteObservable.Subscribe(y => NavigationItem.RightBarButtonItem.Enabled = y); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.WhenAnyValue(x => x.ViewModel.SaveCommand) .Subscribe(x => { NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, (s, e) => { ResignFirstResponder(); x.ExecuteIfCan(); }); NavigationItem.RightBarButtonItem.EnableIfExecutable(x); }); var titleElement = new DummyInputElement("Title"); this.WhenAnyValue(x => x.ViewModel.Filename).Subscribe(x => titleElement.Value = x); titleElement.Changed += (sender, e) => ViewModel.Filename = titleElement.Value; var descriptionElement = new ExpandingInputElement("Description"); this.WhenAnyValue(x => x.ViewModel.Description).Subscribe(x => descriptionElement.Value = x); descriptionElement.ValueChanged += (sender, e) => ViewModel.Description = descriptionElement.Value; var source = new DialogTableViewSource(TableView); source.Root.Add(new Section { titleElement, descriptionElement }); TableView.Source = source; TableView.TableFooterView = new UIView(); }
public override void ViewDidLoad() { base.ViewDidLoad(); var titleElement = new DummyInputElement("Title") { SpellChecking = false }; var contentElement = new ExpandingInputElement("Content"); Root.Add(new Section { titleElement, contentElement }); TableView.TableFooterView = new UIView(); OnActivation(d => { d(this.Bind(x => x.Filename, true).Subscribe(x => { Title = string.IsNullOrEmpty(x) ? "Gist File" : x; titleElement.Value = x; })); d(titleElement.Changed.Subscribe(x => Filename = x)); d(this.Bind(x => x.Content, true).Subscribe(x => contentElement.Value = x)); d(contentElement.Changed.Subscribe(x => Content = x)); d(SaveCommand.Subscribe(_ => ResignFirstResponder())); d(this.Bind(x => x.SaveCommand, true).ToBarButtonItem(Images.Buttons.SaveButton, x => NavigationItem.RightBarButtonItem = x)); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var titleElement = new DummyInputElement("Title"); var descriptionElement = new ExpandingInputElement("Description"); var source = new DialogTableViewSource(TableView); source.Root.Add(new Section { titleElement, descriptionElement }); TableView.Source = source; TableView.TableFooterView = new UIView(); OnActivation(d => { d(this.WhenAnyValue(x => x.ViewModel.Filename).Subscribe(x => titleElement.Value = x)); d(titleElement.Changed.Subscribe(x => ViewModel.Filename = x)); d(this.WhenAnyValue(x => x.ViewModel.Description).Subscribe(x => descriptionElement.Value = x)); d(descriptionElement.Changed.Subscribe(x => ViewModel.Description = x)); d(this.WhenAnyValue(x => x.ViewModel.SaveCommand) .Do((IReactiveCommand <Unit> _) => ResignFirstResponder()) .ToBarButtonItem(UIBarButtonSystemItem.Save, x => NavigationItem.RightBarButtonItem = x)); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var descriptionElement = new ExpandingInputElement("Description"); descriptionElement.AccessoryView = x => new MarkdownAccessoryView(x); var titleElement = new DummyInputElement("Title"); var saveButton = new UIBarButtonItem(UIBarButtonSystemItem.Save); var cancelButton = new UIBarButtonItem(UIBarButtonSystemItem.Cancel); NavigationItem.LeftBarButtonItem = cancelButton; NavigationItem.RightBarButtonItem = saveButton; var source = new DialogTableViewSource(TableView); source.Root.Add(new Section { titleElement, descriptionElement }); TableView.Source = source; TableView.TableFooterView = new UIView(); OnActivation(d => { d(descriptionElement.Changed .Subscribe(x => ViewModel.Description = x)); d(this.WhenAnyValue(x => x.ViewModel.Title) .Subscribe(title => Title = title)); d(this.WhenAnyValue(x => x.ViewModel.Subject) .Subscribe(x => titleElement.Value = x)); d(this.WhenAnyValue(x => x.ViewModel.Description) .Subscribe(x => descriptionElement.Value = x)); d(titleElement.Changed.Subscribe(x => ViewModel.Subject = x)); d(cancelButton.GetClickedObservable() .Select(_ => Unit.Default) .InvokeReactiveCommand(ViewModel.DismissCommand)); d(this.WhenAnyObservable(x => x.ViewModel.DismissCommand) .Where(x => x) .Subscribe(_ => DismissViewController(true, null))); d(saveButton.GetClickedObservable() .Do(x => ResignFirstResponder()) .InvokeReactiveCommand(ViewModel.SubmitCommand)); d(ViewModel.SubmitCommand .Subscribe(_ => DismissViewController(true, null))); d(this.WhenAnyObservable(x => x.ViewModel.SubmitCommand.CanExecute) .Subscribe(x => saveButton.Enabled = x)); d(this.WhenAnyObservable(x => x.ViewModel.SubmitCommand.IsExecuting) .SubscribeStatus("Submitting feedback")); }); }
public CreateFileView() { _titleElement.SpellChecking = false; _descriptionElement = new ExpandingInputElement("Content"); _descriptionElement.Font = UIFont.FromName("Courier", UIFont.PreferredBody.PointSize); _descriptionElement.SpellChecking = false; this.WhenAnyValue(x => x.ViewModel.Name).Subscribe(x => _titleElement.Value = x); _titleElement.Changed += (sender, e) => ViewModel.Name = _titleElement.Value; this.WhenAnyValue(x => x.ViewModel.Content).Subscribe(x => _descriptionElement.Value = x); _descriptionElement.ValueChanged += (sender, e) => ViewModel.Content = _descriptionElement.Value; NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, PromptForCommitMessage); this.WhenAnyValue(x => x.ViewModel.CanCommit).Subscribe(x => NavigationItem.RightBarButtonItem.Enabled = x); }
public AddSourceViewController( string username, string repository, string path, string branch, IApplicationService applicationService = null) : base(UITableViewStyle.Plain) { _username = username; _repository = repository; _path = path; _branch = branch; _applicationService = applicationService ?? Locator.Current.GetService <IApplicationService>(); _titleElement = new DummyInputElement("Name") { SpellChecking = false }; _descriptionElement = new ExpandingInputElement("Content") { SpellChecking = false, Font = UIFont.FromName("Courier", UIFont.PreferredBody.PointSize) }; EdgesForExtendedLayout = UIRectEdge.None; Title = "Add File"; var commitButton = new UIBarButtonItem { Title = "Commit" }; NavigationItem.RightBarButtonItem = commitButton; this.OnActivation(d => { d(commitButton .GetClickedObservable() .Subscribe(_ => Commit())); d(_titleElement .Changed .Select(x => x.Length != 0) .Subscribe(x => commitButton.Enabled = x)); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var titleElement = new DummyInputElement("Title") { SpellChecking = false }; var contentElement = new ExpandingInputElement("Content"); Root.Add(new Section { titleElement, contentElement }); TableView.TableFooterView = new UIView(); var saveButton = new UIBarButtonItem { Image = Images.Buttons.SaveButton }; NavigationItem.RightBarButtonItem = saveButton; OnActivation(d => { d(this.Bind(x => x.Filename, true).Subscribe(x => { Title = string.IsNullOrEmpty(x) ? "Gist File" : x; titleElement.Value = x; })); d(titleElement.Changed.Subscribe(x => Filename = x)); d(this.Bind(x => x.Content, true).Subscribe(x => contentElement.Value = x)); d(contentElement.Changed.Subscribe(x => Content = x)); d(SaveCommand.Subscribe(_ => ResignFirstResponder())); d(saveButton.GetClickedObservable() .Select(_ => Unit.Default) .InvokeCommand(SaveCommand)); d(SaveCommand.IsExecuting .Subscribe(x => saveButton.Enabled = !x)); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var descriptionElement = new ExpandingInputElement("Description"); descriptionElement.AccessoryView = x => new MarkdownAccessoryView(x); var titleElement = new DummyInputElement("Title"); var saveButton = new UIBarButtonItem(UIBarButtonSystemItem.Save); var cancelButton = new UIBarButtonItem { Image = Images.Cancel }; NavigationItem.LeftBarButtonItem = cancelButton; NavigationItem.RightBarButtonItem = saveButton; var source = new DialogTableViewSource(TableView); source.Root.Add(new Section { titleElement, descriptionElement }); TableView.Source = source; TableView.TableFooterView = new UIView(); OnActivation(d => { d(descriptionElement.Changed.Subscribe(x => ViewModel.Description = x)); d(this.WhenAnyValue(x => x.ViewModel.Subject).Subscribe(x => titleElement.Value = x)); d(this.WhenAnyValue(x => x.ViewModel.Description).Subscribe(x => descriptionElement.Value = x)); d(titleElement.Changed.Subscribe(x => ViewModel.Subject = x)); d(this.WhenAnyValue(x => x.ViewModel.DismissCommand) .ToBarButtonItem(Images.Cancel, x => NavigationItem.LeftBarButtonItem = x)); d(saveButton.GetClickedObservable() .Do <Unit>(x => ResignFirstResponder()) .InvokeCommand(ViewModel.SubmitCommand)); d(this.WhenAnyObservable(x => x.ViewModel.SubmitCommand.CanExecuteObservable) .Subscribe(x => saveButton.Enabled = x)); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var titleElement = new DummyInputElement("Name"); titleElement.SpellChecking = false; var descriptionElement = new ExpandingInputElement("Content"); descriptionElement.Font = UIFont.FromName("Courier", UIFont.PreferredBody.PointSize); descriptionElement.SpellChecking = false; this.WhenAnyValue(x => x.ViewModel.Name) .Subscribe(x => titleElement.Value = x); titleElement.Changed += (sender, e) => ViewModel.Name = titleElement.Value; this.WhenAnyValue(x => x.ViewModel.Content) .Subscribe(x => descriptionElement.Value = x); descriptionElement.ValueChanged += (sender, e) => ViewModel.Content = descriptionElement.Value; NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, (s, e) => { ResignFirstResponder(); NavigationController.PushViewController(_messageViewController.Value, true); }); this.WhenAnyValue(x => x.ViewModel.CanCommit) .Subscribe(x => NavigationItem.RightBarButtonItem.Enabled = x); this.WhenAnyValue(x => x.ViewModel.DismissCommand) .Select(x => x.ToBarButtonItem(Images.Cancel)) .Subscribe(x => NavigationItem.LeftBarButtonItem = x); var source = new DialogTableViewSource(TableView); source.Root.Add(new Section { titleElement, descriptionElement }); TableView.Source = source; TableView.TableFooterView = new UIView(); }
public override void ViewDidLoad() { base.ViewDidLoad(); var root = _root.Value; TableView.Source = new DialogTableViewSource(root); TableView.TableFooterView = new UIView(); var deleteBranch = new BooleanElement("Delete Source Branch"); var content = new ExpandingInputElement("Merge Message (Optional)"); var contentSection = new Section { deleteBranch, content }; root.Reset(contentSection); OnActivation(disposable => { this.WhenAnyValue(x => x.Message) .Subscribe(x => content.Value = x) .AddTo(disposable); content .Changed .Subscribe(x => Message = x) .AddTo(disposable); this.WhenAnyValue(x => x.DeleteSourceBranch) .Subscribe(x => deleteBranch.Value = x) .AddTo(disposable); deleteBranch .Changed .Subscribe(x => DeleteSourceBranch = x) .AddTo(disposable); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.WhenAnyValue(x => x.ViewModel.SaveCommand) .Select(x => x.ToBarButtonItem(UIBarButtonSystemItem.Save)) .Subscribe(x => NavigationItem.RightBarButtonItem = x); this.WhenAnyValue(x => x.ViewModel.DismissCommand) .Select(x => x.ToBarButtonItem(Images.Cancel)) .Subscribe(x => NavigationItem.LeftBarButtonItem = x); this.WhenAnyValue(x => x.ViewModel.Files) .Select(x => x.Changed.Select(_ => Unit.Default).StartWith(Unit.Default)) .Switch() .Select(_ => ViewModel.Files.Select(x => new FileElement(x))) .Subscribe(x => _fileSection.Reset(x)); var addFileElement = new StringElement("Add File"); addFileElement.Image = Octicon.Plus.ToImage(); addFileElement.Tapped = () => ViewModel.AddGistFileCommand.ExecuteIfCan(); var descriptionElement = new ExpandingInputElement("Description (Optional)"); this.WhenAnyValue(x => x.ViewModel.Description).Subscribe(x => descriptionElement.Value = x); descriptionElement.ValueChanged += (sender, e) => ViewModel.Description = descriptionElement.Value; Source = new EditSource(this); Source.Root.Add(_fileSection, new Section { addFileElement }, new Section("Details") { descriptionElement }); TableView.Source = Source; TableView.TableFooterView = new UIView(); }
public override void ViewDidLoad() { base.ViewDidLoad(); var titleElement = new DummyInputElement("Name") { SpellChecking = false }; var descriptionElement = new ExpandingInputElement("Content") { SpellChecking = false, Font = UIFont.FromName("Courier", UIFont.PreferredBody.PointSize) }; var source = new DialogTableViewSource(TableView); source.Root.Add(new Section { titleElement, descriptionElement }); TableView.Source = source; TableView.TableFooterView = new UIView(); OnActivation(d => { d(this.WhenAnyValue(x => x.ViewModel.Name).Subscribe(x => titleElement.Value = x)); d(this.WhenAnyValue(x => x.ViewModel.Content).Subscribe(x => descriptionElement.Value = x)); d(titleElement.Changed.Subscribe(x => ViewModel.Name = x)); d(descriptionElement.Changed.Subscribe(x => ViewModel.Content = x)); d(this.WhenAnyValue(x => x.ViewModel.GoToCommitMessageCommand) .ToBarButtonItem(UIBarButtonSystemItem.Save, x => NavigationItem.RightBarButtonItem = x)); d(this.WhenAnyObservable(x => x.ViewModel.GoToCommitMessageCommand).Subscribe(_ => GoToMessage())); d(this.WhenAnyValue(x => x.ViewModel.DismissCommand) .ToBarButtonItem(Images.Cancel, x => NavigationItem.LeftBarButtonItem = x)); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var addFileElement = new StringElement("Add File", Octicon.Plus.ToImage()); var descriptionElement = new ExpandingInputElement("Description (Optional)"); Source = new EditSource(this); Source.Root.Add(_fileSection, new Section { addFileElement }, new Section("Details") { descriptionElement }); TableView.Source = Source; TableView.TableFooterView = new UIView(); OnActivation(d => { d(addFileElement.Clicked.InvokeCommand(ViewModel.AddGistFileCommand)); d(this.WhenAnyValue(x => x.ViewModel.Description).Subscribe(x => descriptionElement.Value = x)); d(descriptionElement.Changed.Subscribe(x => ViewModel.Description = x)); d(this.WhenAnyValue(x => x.ViewModel.SaveCommand) .ToBarButtonItem(Images.SaveButton, x => NavigationItem.RightBarButtonItem = x)); d(this.WhenAnyValue(x => x.ViewModel.DismissCommand) .ToBarButtonItem(Images.Cancel, x => NavigationItem.LeftBarButtonItem = x)); d(this.WhenAnyValue(x => x.ViewModel.Files) .Select(x => x.Changed.Select(_ => Unit.Default).StartWith(Unit.Default)) .Switch() .Select(_ => ViewModel.Files.Select(x => new FileElement(x))) .Subscribe(x => _fileSection.Reset(x))); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var descriptionElement = new ExpandingInputElement("Description"); descriptionElement.AccessoryView = x => new MarkdownAccessoryView(x); var titleElement = new DummyInputElement("Title"); this.WhenAnyValue(x => x.ViewModel.Subject).Subscribe(x => titleElement.Value = x); titleElement.Changed += (sender, e) => ViewModel.Subject = titleElement.Value; this.WhenAnyValue(x => x.ViewModel.Description).Subscribe(x => descriptionElement.Value = x); descriptionElement.ValueChanged += (sender, e) => ViewModel.Description = descriptionElement.Value; this.WhenAnyValue(x => x.ViewModel.SubmitCommand).Subscribe(x => { NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, (s, e) => { ResignFirstResponder(); x.ExecuteIfCan(); }); x.CanExecuteObservable.Subscribe(y => NavigationItem.RightBarButtonItem.Enabled = y); }); this.WhenAnyValue(x => x.ViewModel.DismissCommand) .Select(x => x.ToBarButtonItem(Images.Cancel)) .Subscribe(x => NavigationItem.LeftBarButtonItem = x); var source = new DialogTableViewSource(TableView); source.Root.Add(new Section { titleElement, descriptionElement }); TableView.Source = source; TableView.TableFooterView = new UIView(); }
public override void ViewDidLoad() { base.ViewDidLoad(); var root = _root.Value; TableView.Source = new DialogTableViewSource(root); TableView.TableFooterView = new UIView(); var save = NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save); var title = new EntryElement("Title", "(Required)", string.Empty); var assignedTo = new ButtonElement("Responsible", "Unassigned", UITableViewCellStyle.Value1); var kind = new ButtonElement("Issue Type", ViewModel.Kind, UITableViewCellStyle.Value1); var priority = new ButtonElement("Priority", ViewModel.Priority, UITableViewCellStyle.Value1); var milestone = new ButtonElement("Milestone", "None", UITableViewCellStyle.Value1); var component = new ButtonElement("Component", "None", UITableViewCellStyle.Value1); var version = new ButtonElement("Version", "None", UITableViewCellStyle.Value1); var content = new ExpandingInputElement("Description"); var titleSection = new Section { title, assignedTo, kind, priority }; var attributeSection = new Section("Categories") { milestone, component, version }; var contentSection = new Section("Content") { content }; root.Reset(titleSection, attributeSection, contentSection); OnActivation(d => { this.WhenAnyObservable(x => x.ViewModel.SaveCommand.IsExecuting) .SubscribeStatus("Saving...") .AddTo(d); this.WhenAnyValue(x => x.ViewModel.IssueTitle) .Subscribe(x => title.Value = x) .AddTo(d); this.WhenAnyValue(x => x.ViewModel.Assignee.SelectedValue) .Subscribe(x => assignedTo.Value = x ?? "Unassigned") .AddTo(d); this.WhenAnyValue(x => x.ViewModel.Kind) .Select(x => x?.Humanize(LetterCasing.Title)) .Subscribe(x => kind.Value = x) .AddTo(d); this.WhenAnyValue(x => x.ViewModel.Priority) .Select(x => x?.Humanize(LetterCasing.Title)) .Subscribe(x => priority.Value = x) .AddTo(d); this.WhenAnyValue(x => x.ViewModel.Milestones.SelectedValue) .Subscribe(x => milestone.Value = x ?? "None") .AddTo(d); this.WhenAnyValue(x => x.ViewModel.Components.SelectedValue) .Subscribe(x => component.Value = x ?? "None") .AddTo(d); this.WhenAnyValue(x => x.ViewModel.Versions.SelectedValue) .Subscribe(x => version.Value = x ?? "None") .AddTo(d); content .Changed .Subscribe(x => ViewModel.Content = x) .AddTo(d); this.WhenAnyValue(x => x.ViewModel.Content) .Subscribe(x => content.Value = x) .AddTo(d); title.Changed .Subscribe(x => ViewModel.IssueTitle = x) .AddTo(d); version .Clicked .Select(_ => _versionsViewController.Value) .Subscribe(x => NavigationController.PushViewController(x, true)) .AddTo(d); assignedTo .Clicked .Select(_ => _assigneeViewController.Value) .Subscribe(x => NavigationController.PushViewController(x, true)) .AddTo(d); milestone .Clicked .Select(_ => _milestonesViewController.Value) .Subscribe(x => NavigationController.PushViewController(x, true)) .AddTo(d); component .Clicked .Select(_ => _componentsViewController.Value) .Subscribe(x => NavigationController.PushViewController(x, true)) .AddTo(d); save.GetClickedObservable() .Do(_ => View.EndEditing(true)) .SelectUnit() .BindCommand(this, x => x.ViewModel.SaveCommand) .AddTo(d); this.WhenAnyObservable(x => x.ViewModel.SaveCommand.CanExecute) .Subscribe(x => save.Enabled = x) .AddTo(d); this.WhenAnyObservable(x => x.ViewModel.DismissCommand) .Subscribe(x => DismissViewController(true, null)) .AddTo(d); priority.Clicked.Subscribe(_ => { var ctrl = new IssueAttributesViewController( IssueAttributesViewController.Priorities, ViewModel.Priority) { Title = "Priority" }; ctrl.SelectedObservable .Do(x => ViewModel.Priority = x.ToLower()) .Subscribe(__ => NavigationController.PopToViewController(this, true)); NavigationController.PushViewController(ctrl, true); }).AddTo(d); kind.Clicked.Subscribe(_ => { var ctrl = new IssueAttributesViewController( IssueAttributesViewController.Kinds, ViewModel.Kind) { Title = "Issue Type" }; ctrl.SelectedObservable .Do(x => ViewModel.Kind = x.ToLower()) .Subscribe(__ => NavigationController.PopToViewController(this, true)); NavigationController.PushViewController(ctrl, true); }).AddTo(d); }); }