public NewTootBoxViewModel(IReactiveProperty <Status> inReplyTo, IMastodonClient client) { this.inReplyTo = inReplyTo; this.client = client; InReplyTo = inReplyTo.ToReadOnlyReactiveProperty(); TootCommand = Text.Select(t => t.Length > 0) .ToAsyncReactiveCommand() .WithSubscribe(executeTootCommand); CancelReplyCommand = this.inReplyTo .Select(svm => svm != null) .ToReactiveCommand() .WithSubscribe(() => this.inReplyTo.Value = null); this.inReplyTo.Subscribe(status => { if (status == null) { InReplyToText.Value = null; } else { Status OriginalStatus = status.Reblog ?? status; InReplyToText.Value = $"To: {OriginalStatus.Account.UserName}: {OriginalStatus.Content}"; Text.Value = $"@{OriginalStatus.Account.AccountName} {Text.Value}"; } }); }
public ShoppingItemService() { var items = new[] { new ShoppingItemModel { Id = Guid.Parse("c3c67711-d530-4131-a17c-6427f8f54fba"), Name = "NBI Mug", Description = "A fancy Now Business Intelligence mug that holds coffee. (Do not put non-cofee in the mug, as this will void the warranty.)", Icon = "app_logo.png", Price = 5.99 }, new ShoppingItemModel { Id = Guid.Parse("6a5afb64-2bc6-4b77-8a7d-64908b20e9d8"), Name = "NBI Sweater", Description = "An ugly Now Business Intelligence sweater for the holidays. One-size fits most!", Icon = "app_logo.png", Price = 14.99 }, new ShoppingItemModel { Id = Guid.Parse("8344c27c-78d7-4f86-a3fe-9322d9ae3942"), Name = "NBI Wine Set", Description = "A set of six wine glasses and a bottle opener made out of fine crystal. (Not the bottle opener, that's made from metal.)", Icon = "app_logo.png", Price = 49.99 }, new ShoppingItemModel { Id = Guid.Parse("8532aa12-c90d-42fe-8ab5-af04314d6d2b"), Name = "NBI Calendar", Description = "A day-to-day calendar featuring 365 photos of Now Business Intelligence's employees.", Icon = "app_logo.png", Price = 7.99 } }; _inventoryInternal = new ReactiveProperty <IEnumerable <ShoppingItemModel> >(items); Inventory = _inventoryInternal.ToReadOnlyReactiveProperty(); }
public MenuItemService() { var items = new[] { new MenuItemModel("Home Sample", "Icon.png", () => new LandingPage()), new MenuItemModel("Copy Sample", "Icon.png", () => new CopySamplePage()), new MenuItemModel("Form Sample", "Icon.png", () => new FormSamplePage()), new MenuItemModel("Shopping List Sample", "Icon.png", () => new ShoppingListPage()), new MenuItemModel("Shopping Grid Sample", "Icon.png", () => new ShoppingGridPage()), new MenuItemModel("Shopping Cart Sample", "Icon.png", () => new ShoppingCartPage()), new MenuItemModel("Light Theme Sample", "Icon.png", () => new LightThemeSamplePage()), new MenuItemModel("Dark Theme Sample", "Icon.png", () => new DarkThemeSamplePage()), new MenuItemModel("Custom Theme Sample", "Icon.png", () => new CustomThemeSamplePage()), new MenuItemModel("Service Sample", "Icon.png", () => new ServiceSamplePage()), new MenuItemModel("Assets Sample", "Icon.png", () => new AssetSamplePage()), new MenuItemModel("Custom Renderer Sample", "Icon.png", () => new RendererSamplePage()), new MenuItemModel("Reactive Sample", "Icon.png", () => new ReactiveSamplePage()) }; _menuItemsInternal = new ReactiveProperty <IEnumerable <MenuItemModel> >(items); MenuItems = _menuItemsInternal.ToReadOnlyReactiveProperty(); }