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(); 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"); 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 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 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 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(); }