public override void ViewDidLoad() { base.ViewDidLoad(); var tableViewSource = new FeedbackTableViewSource(TableView, ViewModel.Items); TableView.Source = tableViewSource; Appearing .Take(1) .Subscribe(_ => LoadData()); this.WhenActivated(d => { d(this.WhenAnyValue(x => x.ViewModel.Title) .Subscribe(title => Title = title)); d(_repositorySearchBar.GetChangedObservable() .Subscribe(x => ViewModel.SearchKeyword = x)); d(ViewModel.WhenAnyValue(x => x.IsEmpty) .Where(x => x.HasValue) .Select(x => x.Value) .Subscribe(SetHasItems)); d(ViewModel.Items.Changed.Select(_ => Unit.Default) .StartWith(Unit.Default) .Select(_ => ViewModel.Items.Select(x => x.GoToCommand.Select(__ => x))) .Select(x => Observable.Merge(x)) .Switch() .Select(x => new IssueView(x.RepositoryOwner, x.RepositoryName, x.IssueId)) .Subscribe(x => NavigationController.PushViewController(x, true))); }); }
protected BaseViewController() { Appearing .Take(1) .Select(_ => this.WhenAnyValue(x => x.ViewModel)) .Switch() .OfType <ILoadableViewModel>() .Select(x => x.LoadCommand) .Subscribe(x => x.ExecuteNow()); OnActivation(disposable => { this.WhenAnyValue(x => x.ViewModel) .OfType <IProvidesTitle>() .Select(x => x.WhenAnyValue(y => y.Title)) .Switch() .Subscribe(x => Title = x) .AddTo(disposable); this.WhenAnyValue(x => x.ViewModel) .OfType <IRoutingViewModel>() .Select(x => x.RequestNavigation) .Switch() .Select(x => Locator.Current.GetService <IViewLocatorService>().GetView(x)) .OfType <UIViewController>() .Subscribe(Navigate) .AddTo(disposable); }); }
public SourceTreeViewController( string username, string repository, string path, string sha, ShaType shaType, IApplicationService applicationService = null, IFeaturesService featuresService = null) : base(style: UITableViewStyle.Plain) { _username = username; _repository = repository; _path = path; _sha = sha; _shaType = shaType; applicationService = applicationService ?? Locator.Current.GetService <IApplicationService>(); featuresService = featuresService ?? Locator.Current.GetService <IFeaturesService>(); var loadContents = ReactiveCommand.CreateFromTask((string shaRef) => { if (string.IsNullOrEmpty(path)) { return(applicationService .GitHubClient.Repository.Content .GetAllContentsByRef(username, repository, shaRef)); } return(applicationService .GitHubClient.Repository.Content .GetAllContentsByRef(username, repository, path, shaRef)); }); loadContents .ThrownExceptions .Do(_ => SetErrorView()) .Select(HandleLoadError) .SelectMany(Interactions.Errors.Handle) .Subscribe(); OnActivation(d => { d(_titleView .GetClickedObservable() .Subscribe(_ => ShowBranchSelector())); }); Appearing .Select(_ => _sha) .Where(x => !string.IsNullOrEmpty(x)) .DistinctUntilChanged() .Do(_ => SetLoading(true)) .InvokeReactiveCommand(loadContents); loadContents .Do(_ => SetLoading(false)) .Subscribe(SetElements); NavigationItem.TitleView = _titleView; }
public void SendAppearing() { if (_hasAppeared) { return; } _hasAppeared = true; if (IsBusy) { if (IsPlatformEnabled) { MessagingCenter.Send(this, BusySetSignalName, true); } else { _pendingActions.Add(() => MessagingCenter.Send(this, BusySetSignalName, true)); } } OnAppearing(); Appearing?.Invoke(this, EventArgs.Empty); var pageContainer = this as IPageContainer <Page>; pageContainer?.CurrentPage?.SendAppearing(); FindApplication(this)?.OnPageAppearing(this); }
public BranchesViewController( string username, string repository, IApplicationService applicationService = null) : base(UITableViewStyle.Plain) { applicationService = applicationService ?? Locator.Current.GetService <IApplicationService>(); var loadBranches = ReactiveCommand.CreateFromTask( () => applicationService.GitHubClient.Repository.Branch.GetAll(username, repository)); loadBranches .ThrownExceptions .Do(_ => SetErrorView()) .Select(error => new UserError(LoadErrorMessage, error)) .SelectMany(Interactions.Errors.Handle) .Subscribe(); loadBranches .Do(_ => TableView.TableFooterView = null) .Subscribe(ItemsLoaded); Appearing .Take(1) .Select(_ => Unit.Default) .Do(_ => TableView.TableFooterView = new LoadingIndicatorView()) .InvokeReactiveCommand(loadBranches); }
public RepositoriesTrendingView() { var titleButton = new TrendingTitleButton { Frame = new CGRect(0, 0, 200f, 32f), TintColor = Theme.PrimaryNavigationBarTextColor }; NavigationItem.TitleView = titleButton; titleButton.TouchUpInside += (sender, e) => ViewModel.GoToLanguages.ExecuteIfCan(); this.WhenAnyValue(x => x.ViewModel.SelectedLanguage).IsNotNull() .Subscribe(x => titleButton.Text = x.Name); EmptyView = new Lazy <UIView>(() => new EmptyListView(Octicon.Pulse.ToEmptyListImage(), "There are no trending repositories.")); Appearing .Where(_ => NavigationController != null) .Subscribe(_ => NavigationController.NavigationBar.ShadowImage = new UIImage()); Disappearing .Where(_ => NavigationController != null) .Subscribe(_ => NavigationController.NavigationBar.ShadowImage = null); }
public LoginViewController() : base(true) { ViewModel = new LoginViewModel(Mvx.Resolve <IApplicationService>(), Mvx.Resolve <IAccountsService>()); Title = "Login"; Appearing.Take(1).Subscribe(_ => LoadRequest()); OnActivation(d => d(ViewModel.Bind(x => x.IsLoggingIn).SubscribeStatus("Logging in..."))); }
public EnterpriseSupportViewController(IAlertDialogService alertDialogService = null) { _alertDialogService = alertDialogService ?? Locator.Current.GetService <IAlertDialogService>(); Appearing .Select(_ => NavigationController) .Where(x => x != null) .Subscribe(x => x.NavigationBar.ShadowImage = new UIImage()); }
public StartupViewController() { Appeared.Where(_ => ViewModel != null).Subscribe(_ => ViewModel.StartupCommand.ExecuteIfCan()); Appearing.Subscribe(_ => UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade)); Disappearing.Subscribe(_ => { UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.Fade); UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, true); }); }
public MenuViewController() : base(UITableViewStyle.Plain) { _title = new UILabel(new CGRect(0, 40, 320, 40)); _title.TextAlignment = UITextAlignment.Left; _title.BackgroundColor = UIColor.Clear; _title.Font = UIFont.SystemFontOfSize(16f); _title.TextColor = UIColor.FromRGB(246, 246, 246); NavigationItem.TitleView = _title; _profileSection = new Section(); _repoSection = new Section { HeaderView = new MenuSectionView("Repositories") }; _infoSection = new Section { HeaderView = new MenuSectionView("Info & Preferences") }; OnActivation(d => { _profileButton.GetClickedObservable().Subscribe(_ => ProfileButtonClicked()).AddTo(d); this.WhenAnyValue(x => x.ViewModel.Title) .Subscribe(x => _title.Text = x) .AddTo(d); var updatables = new[] { ViewModel.Groups.Changed, ViewModel.Teams.Changed, ViewModel.TeamEvents.Changed, ViewModel.PinnedRepositories.Changed }; Observable.Merge(updatables.Select(y => y.Select(_ => Unit.Default).StartWith(Unit.Default))) .Throttle(TimeSpan.FromMilliseconds(100)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => CreateMenuRoot()) .AddTo(d); Observable.Return(ViewModel) .OfType <IRoutingViewModel>() .Select(x => x.RequestNavigation) .Switch() .Subscribe(x => { var viewFor = Locator.Current.GetService <IViewLocatorService>().GetView(x); NavigationController.PushViewController(viewFor as UIViewController, true); }) .AddTo(d); }); Appearing .Take(1) .SelectUnit() .BindCommand(ViewModel.LoadCommand); }
public ReadmeViewController( string owner, string repository, Octokit.Readme readme = null, IApplicationService applicationService = null, IMarkdownService markdownService = null) : base(false, false) { _owner = owner; _repository = repository; _applicationService = applicationService ?? Locator.Current.GetService <IApplicationService>(); _markdownService = markdownService ?? Locator.Current.GetService <IMarkdownService>(); Title = "Readme"; var loadCommand = ReactiveCommand.CreateFromTask(() => { if (readme != null) { return(Task.FromResult(readme)); } return(_applicationService.GitHubClient.Repository.Content.GetReadme(owner, repository)); }); loadCommand .ThrownExceptions .Do(_ => SetErrorView()) .Select(error => new UserError(LoadErrorMessage, error)) .SelectMany(Interactions.Errors.Handle) .Subscribe(); loadCommand .ToProperty(this, x => x.Readme, out _readme); Appearing .Take(1) .Select(_ => Unit.Default) .InvokeReactiveCommand(loadCommand); this.WhenAnyValue(x => x.Readme) .Where(x => x != null) .SelectMany(ConvertToWebView) .Subscribe(LoadContent); this.WhenAnyValue(x => x.Readme) .Select(x => x != null) .Subscribe(x => _actionButton.Enabled = x); NavigationItem.RightBarButtonItem = _actionButton; this.WhenActivated(d => { d(_actionButton.GetClickedObservable() .Subscribe(ShareButtonPress)); }); }
public GistFileViewController( string gistId, string filename, Octokit.Gist gist = null, IApplicationService applicationService = null, IAlertDialogService alertDialogService = null, IMessageService messageService = null) : base(false) { _gistId = gistId; _filename = filename; _gist = gist; _applicationService = applicationService ?? Locator.Current.GetService <IApplicationService>(); _alertDialogService = alertDialogService ?? Locator.Current.GetService <IAlertDialogService>(); messageService = messageService ?? Locator.Current.GetService <IMessageService>(); Title = System.IO.Path.GetFileName(filename); var actionButton = new UIBarButtonItem(UIBarButtonSystemItem.Action) { Enabled = false }; NavigationItem.RightBarButtonItem = actionButton; var loadCommand = ReactiveCommand.CreateFromTask(Load); loadCommand .ThrownExceptions .Select(HandleLoadError) .SelectMany(Interactions.Errors.Handle) .Subscribe(); this.OnActivation(d => { d(this.WhenAnyValue(x => x.Gist) .Select(x => x != null) .Subscribe(x => actionButton.Enabled = x)); d(actionButton .GetClickedObservable() .Subscribe(CreateActionSheet)); d(loadCommand .IsExecuting .Subscribe(x => actionButton.Enabled = !x)); }); Appearing .Take(1) .Select(_ => Unit.Default) .InvokeReactiveCommand(loadCommand); }
public NotificationsView() { _segmentBarButton = new UIBarButtonItem(_viewSegment); EmptyView = new Lazy <UIView>(() => new EmptyListView(Octicon.Inbox.ToImage(64f), "No new notifications.")); _markButton = new UIBarButtonItem(string.Empty, UIBarButtonItemStyle.Plain, (s, e) => ViewModel.ReadSelectedCommand.ExecuteIfCan()); _segmentToolbar = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) }; _markToolbar = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _markButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) }; ToolbarItems = _segmentToolbar; _editButton = new UIBarButtonItem(UIBarButtonSystemItem.Edit, (s, e) => StartEditing()); _cancelButton = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (s, e) => StopEditing()); this.WhenActivated(d => { d(this.WhenAnyValue(x => x.ViewModel.GroupedNotifications) .SelectMany(x => x) .SelectMany(x => x.Notifications) .Select(x => x.WhenAnyValue(y => y.IsSelected)) .Merge() .Select(_ => ViewModel.GroupedNotifications.SelectMany(x => x.Notifications).Any(x => x.IsSelected)) .Where(x => TableView.Editing) .Subscribe(x => { _markButton.Title = x ? "Mark Selected as Read" : "Read All as Read"; })); d(this.WhenAnyValue(x => x.ViewModel.GroupedNotifications) .Where(x => x.Count == 0 && TableView.Editing) .Subscribe(_ => StopEditing())); d(this.WhenAnyValue(x => x.ViewModel.GroupedNotifications) .Subscribe(x => _editButton.Enabled = x.Count > 0)); d(this.WhenAnyValue(x => x.ViewModel.ActiveFilter) .Subscribe(x => { _viewSegment.SelectedSegment = x; NavigationItem.SetRightBarButtonItem((_viewSegment.SelectedSegment != 2) ? _editButton : null, true); })); }); Appearing .Where(_ => NavigationController != null) .Subscribe(x => NavigationController.SetToolbarHidden(false, x)); Disappearing .Where(_ => NavigationController != null) .Subscribe(x => NavigationController.SetToolbarHidden(true, x)); }
private void AppearPropertyChanged(bool oldValue, bool newValue) { if (!oldValue && newValue && IsVisible) { MakeAppear(this); Appearing?.Invoke(); } else if (oldValue && !newValue && IsVisible) { MakeDisappear(this); Disappearing?.Invoke(); } }
public override void ViewDidLoad() { base.ViewDidLoad(); var tableViewSource = new GistTableViewSource(TableView, ViewModel.Items); TableView.Source = tableViewSource; Appearing .Take(1) .Select(_ => ViewModel.LoadCommand.Execute()) .Switch() .Take(1) .Catch(Observable.Return(false)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(SetItemsPresent); this.WhenActivated(d => { if (ShowSearchBar) { d(_repositorySearchBar.Value.GetChangedObservable() .Subscribe(x => ViewModel.SearchText = x)); } d(ViewModel.ItemSelected .Select(x => GistViewController.FromGist(x.Gist)) .Subscribe(x => NavigationController.PushViewController(x, true))); d(ViewModel.WhenAnyValue(x => x.HasMore) .Subscribe(x => TableView.TableFooterView = x ? _loading : null)); d(tableViewSource.RequestMore .InvokeCommand(ViewModel.LoadMoreCommand)); d(ViewModel.LoadCommand .Select(_ => ViewModel.Items.Changed) .Switch() .Select(_ => Unit.Default) .Throttle(TimeSpan.FromMilliseconds(100), RxApp.MainThreadScheduler) .Where(_ => TableView.LastItemVisible()) .InvokeCommand(ViewModel.LoadMoreCommand)); d(ViewModel.LoadCommand.Merge(ViewModel.LoadMoreCommand) .Select(_ => Unit.Default) .Throttle(TimeSpan.FromMilliseconds(100), RxApp.MainThreadScheduler) .Where(_ => TableView.LastItemVisible()) .InvokeCommand(ViewModel.LoadMoreCommand)); }); }
public LoginViewController() : base(true) { Title = "Login"; Appearing.Take(1).Subscribe(_ => LoadRequest()); OnActivation(d => { this.WhenAnyObservable(x => x.ViewModel.LoginCommand.IsExecuting) .SubscribeStatus("Logging in...") .AddTo(d); }); }
public SettingsViewController() { Title = "Settings"; _registerPushNotifications = ReactiveCommand.CreateFromTask <bool>(RegisterPushNotifications); _registerPushNotifications .ThrownExceptions .Select(error => new UserError(RegisterNotificationsError, error)) .SelectMany(Interactions.Errors.Handle) .Subscribe(); _registerPushNotifications.Subscribe(_ => CreateTable()); Appearing.Subscribe(_ => CreateTable()); }
public override void ViewDidLoad() { base.ViewDidLoad(); var tableViewSource = new RepositoryTableViewSource(TableView); TableView.Source = tableViewSource; Appearing .Take(1) .Select(_ => Unit.Default) .InvokeCommand(ViewModel.LoadCommand); this.WhenActivated(d => { d(ViewModel.LoadCommand.IsExecuting .Subscribe(Loading)); d(_trendingTitleButton.GetClickedObservable() .Subscribe(_ => ShowLanguages())); d(ViewModel.WhenAnyValue(x => x.SelectedLanguage) .Subscribe(x => _trendingTitleButton.Text = x.Name)); d(ViewModel.RepositoryItemSelected .Select(x => new RepositoryViewController(x.Owner, x.Name)) .Subscribe(x => NavigationController.PushViewController(x, true))); d(ViewModel.WhenAnyValue(x => x.Items).Subscribe(items => { var sections = items.Select(item => { var tsi = new TableSectionInformation <RepositoryItemViewModel, RepositoryCellView>( new ReactiveList <RepositoryItemViewModel>(item.Item2), RepositoryCellView.Key, (float)UITableView.AutomaticDimension); tsi.Header = new TableSectionHeader(() => CreateHeaderView(item.Item1), 26f); return(tsi); }); tableViewSource.Data = sections.ToList(); })); }); }
public PullRequestDiffViewController( string username, string repository, int pullRequestId, string path, string patch, string commit, IApplicationService applicationService = null, INetworkActivityService networkActivityService = null, IMarkdownService markdownService = null) : base(false) { _applicationService = applicationService ?? Locator.Current.GetService <IApplicationService>(); _networkActivityService = networkActivityService ?? Locator.Current.GetService <INetworkActivityService>(); _markdownService = markdownService ?? Locator.Current.GetService <IMarkdownService>(); _username = username; _repository = repository; _pullRequestId = pullRequestId; _path = path; _patch = patch; _commit = commit; Title = string.IsNullOrEmpty(_path) ? "Diff" : System.IO.Path.GetFileName(_path); var loadComments = ReactiveCommand.CreateFromTask( _ => _applicationService.GitHubClient.PullRequest.ReviewComment.GetAll(_username, _repository, _pullRequestId)); loadComments .ThrownExceptions .Select(error => new UserError("Unable to load comments.", error)) .SelectMany(Interactions.Errors.Handle) .Subscribe(); loadComments .Subscribe(comments => _comments.Reset(comments)); var loadAll = ReactiveCommand.CreateCombined(new[] { loadComments }); Appearing .Take(1) .Select(_ => Unit.Default) .InvokeReactiveCommand(loadAll); }
public override void ViewDidLoad() { base.ViewDidLoad(); var tableViewSource = new RepositoryTableViewSource(TableView, ViewModel.Items); TableView.Source = tableViewSource; Appearing .Take(1) .Subscribe(_ => LoadData()); this.WhenActivated(d => { d(_repositorySearchBar.GetChangedObservable() .Subscribe(x => ViewModel.SearchText = x)); d(ViewModel.RepositoryItemSelected .Select(x => new RepositoryViewController(x.Owner, x.Name)) .Subscribe(x => NavigationController.PushViewController(x, true))); d(ViewModel.WhenAnyValue(x => x.HasMore) .Subscribe(x => TableView.TableFooterView = x ? _loading : null)); d(tableViewSource.RequestMore .InvokeReactiveCommand(ViewModel.LoadMoreCommand)); d(ViewModel.LoadCommand .Select(_ => ViewModel.Items.Changed) .Switch() .Select(_ => Unit.Default) .Throttle(TimeSpan.FromMilliseconds(100), RxApp.MainThreadScheduler) .Where(_ => TableView.LastItemVisible()) .InvokeReactiveCommand(ViewModel.LoadMoreCommand)); d(ViewModel.LoadCommand.Merge(ViewModel.LoadMoreCommand) .Select(_ => Unit.Default) .Throttle(TimeSpan.FromMilliseconds(100), RxApp.MainThreadScheduler) .Where(_ => TableView.LastItemVisible()) .InvokeReactiveCommand(ViewModel.LoadMoreCommand)); }); }
public void SendAppearing() { // Only fire appearing if the page has been added to the windows // Visual Hierarchy // The window/application will take care of re-firing this appearing // if it needs to var window = this.FindParentOfType <Window>(); if (window?.Parent == null) { return; } if (_hasAppeared) { return; } _hasAppeared = true; if (IsBusy) { if (IsPlatformEnabled) { MessagingCenter.Send(this, BusySetSignalName, true); } else { _pendingActions.Add(() => MessagingCenter.Send(this, BusySetSignalName, true)); } } OnAppearing(); Appearing?.Invoke(this, EventArgs.Empty); var pageContainer = this as IPageContainer <Page>; pageContainer?.CurrentPage?.SendAppearing(); FindApplication(this)?.OnPageAppearing(this); }
protected BaseDialogViewController() : base(UITableViewStyle.Grouped) { SlideUpTitle = new SlideUpTitleView(44f) { Offset = 100f }; NavigationItem.TitleView = SlideUpTitle; HeaderView = new ImageAndTitleHeaderView(); _backgroundHeaderView = new UIView(); Appearing .Where(x => ToolbarItems != null && NavigationController != null) .Subscribe(x => NavigationController.SetToolbarHidden(false, x)); Disappearing .Where(x => ToolbarItems != null && NavigationController != null) .Subscribe(x => NavigationController.SetToolbarHidden(true, x)); Disappearing .Where(_ => NavigationController != null) .Subscribe(_ => NavigationController.NavigationBar.ShadowImage = null); }
protected TableViewController(UITableViewStyle style = UITableViewStyle.Plain) : base(style) { Appearing .Take(1) .Select(_ => this.WhenAnyValue(x => x.ViewModel)) .Switch() .OfType <ILoadableViewModel>() .Select(x => x.LoadCommand) .Subscribe(x => x.ExecuteNow()); OnActivation(disposable => { this.WhenAnyValue(x => x.ViewModel) .OfType <IProvidesTitle>() .Select(x => x.WhenAnyValue(y => y.Title)) .Switch() .Subscribe(x => Title = x) .AddTo(disposable); }); }
public void SendAppearing() { if (_hasAppeared) { return; } _hasAppeared = true; if (IsBusy) { MessagingCenter.Send(this, BusySetSignalName, true); } OnAppearing(); Appearing?.Invoke(this, EventArgs.Empty); var pageContainer = this as IPageContainer <Page>; pageContainer?.CurrentPage?.SendAppearing(); }
public EnterpriseSupportViewController(IAlertDialogFactory alertDialogFactory) { this.WhenAnyValue(x => x.ViewModel.SubmitFeedbackCommand) .Switch() .Subscribe(_ => { var ctrl = new MFMailComposeViewController(); ctrl.SetSubject("CodeHub Support"); ctrl.SetToRecipients(new [] { "*****@*****.**" }); ctrl.Finished += (sender, e) => DismissViewController(true, () => { if (e.Result == MFMailComposeResult.Sent) { alertDialogFactory.Alert("Sent!", "Thanks for your feedback!"); } }); PresentViewController(ctrl, true, null); }); Appearing .Select(_ => NavigationController) .Where(x => x != null) .Subscribe(x => x.NavigationBar.ShadowImage = new UIImage()); }
public BranchesAndTagsViewController( string username, string repository, SelectedView selectedView = SelectedView.Branches) { _branchesViewController = new BranchesViewController(username, repository); _tagsViewController = new TagsViewController(username, repository); OnActivation(d => { d(_viewSegment .GetChangedObservable() .Subscribe(SegmentValueChanged)); }); Appearing .Take(1) .Select(_ => (int)selectedView) .Do(x => _viewSegment.SelectedSegment = x) .Do(SegmentValueChanged) .Subscribe(); NavigationItem.TitleView = _viewSegment; }
public FileSourceViewController( string username, string repository, string path, string sha, ShaType shaType, bool forceBinary = false, IApplicationService applicationService = null, IAlertDialogService alertDialogService = null, IMessageService messageService = null) : base(false) { _username = username; _repository = repository; _path = path; _sha = sha; _shaType = shaType; _forceBinary = forceBinary; _applicationService = applicationService ?? Locator.Current.GetService <IApplicationService>(); _alertDialogService = alertDialogService ?? Locator.Current.GetService <IAlertDialogService>(); messageService = messageService ?? Locator.Current.GetService <IMessageService>(); Title = System.IO.Path.GetFileName(path); var extension = System.IO.Path.GetExtension(path); _isMarkdown = MarkdownExtensions.Contains(extension); var actionButton = new UIBarButtonItem(UIBarButtonSystemItem.Action) { Enabled = false }; NavigationItem.RightBarButtonItem = actionButton; var loadCommand = ReactiveCommand.CreateFromTask(Load); loadCommand .ThrownExceptions .Select(HandleLoadError) .SelectMany(Interactions.Errors.Handle) .Subscribe(); this.OnActivation(d => { d(this.WhenAnyValue(x => x.Content) .Select(x => x != null) .Subscribe(x => actionButton.Enabled = x)); d(actionButton .GetClickedObservable() .Subscribe(_ => CreateActionSheet(actionButton))); d(loadCommand .IsExecuting .Subscribe(x => actionButton.Enabled = !x)); }); Appearing .Take(1) .Select(_ => Unit.Default) .InvokeReactiveCommand(loadCommand); _messageBus = messageService.Listen <Core.Messages.SourceEditMessage>(_ => { Content = null; loadCommand.ExecuteNow(); }); }
protected virtual void OnAppearing() => Appearing?.Invoke(this, EventArgs.Empty);
internal void InvokeAppearing() { Appearing?.Invoke(this, new PageAppearingEventArgs()); }
public override void RunPresentationAnimation() { base.RunPresentationAnimation(); Appearing?.Invoke(); }