コード例 #1
0
 public void Construct(IOrderBuilder orderBuilder, string product,
                       string client, string address, string invoiceData)
 {
     orderBuilder.SetClient(client, address);
     orderBuilder.SetProduct(product);
     orderBuilder.SetInvoiceData(invoiceData);
 }
コード例 #2
0
ファイル: HomeViewModel.cs プロジェクト: y105109/NNReader
        public NewBookmarkDialogViewModel(IOrderBuilder orderBuilder, ILoadableBookmarkService loadableBookmarkService)
        {
            this.Ncode = new ReactiveProperty <string>("")
                         .SetValidateNotifyError(x => string.IsNullOrWhiteSpace(x) ? "Empty" : null)
                         .SetValidateNotifyError(x => loadableBookmarkService.Bookmarks.Any(b => b.Ncode == x) ? "Already has !" : null);

            this.AcceptCommand = this.Ncode.ObserveHasErrors
                                 .Select(x => !x)
                                 .ObserveOnUIDispatcher()
                                 .ToAsyncReactiveCommand();

            this.AcceptCommand.Subscribe(async() =>
            {
                MaterialDesignThemes.Wpf.DialogHost.CloseDialogCommand.Execute(null, null);
                await orderBuilder.From("DownloadingBookmarkInfo")
                .With("Ncode", this.Ncode.Value)
                .DispatchAsync();
                this.Ncode.Value = "";
            });

            this.CancelCommand.Subscribe(async() =>
            {
                MaterialDesignThemes.Wpf.DialogHost.CloseDialogCommand.Execute(null, null);
                this.Ncode.Value = "";
            });
        }
コード例 #3
0
        public ProductItemsViewModel(
            IProductsProvider productsProvider,
            IProductsSearcher productsSearcher,
            IOrderBuilder orderBuilder,
            IPageNavigator pageNavigator)
        {
            Contract.Assert(productsProvider != null);
            Contract.Assert(orderBuilder != null);
            Contract.Assert(pageNavigator != null);

            _productsProvider = productsProvider;
            _productsSearcher = productsSearcher;
            _orderBuilder = orderBuilder;
            _pageNavigator = pageNavigator;
            SearchCommand = new LambdaCommand(
                parameter =>
                {
                    var searchResult = _productsSearcher.Search(SearchQuery);
                    Products = searchResult.Select(CreateProductViewModel);
                });

            GotoOrderCommand = new LambdaCommand(
                _ =>
                {
                    _pageNavigator.NavigateToOrderPage(new OrderViewModel(_orderBuilder.GetOrder(), _pageNavigator));
                });

            InitializeProducts();
        }
コード例 #4
0
 public CustomerAttendant(
     IOrderBuilder orderBuilder,
     IOrderProcessor orderProcessor,
     IOrderService orderService)
 {
     _orderBuilder   = orderBuilder;
     _orderProcessor = orderProcessor;
     _orderService   = orderService;
 }
コード例 #5
0
ファイル: HomeViewModel.cs プロジェクト: y105109/NNReader
        public BookmarkInfoViewModel(IOrderBuilder orderBuilder, IBookmarkInfo bookmarkInfo)
        {
            this.LoadedCommand = new AsyncReactiveCommand()
                                 .WithSubscribe(async() =>
            {
                await orderBuilder.From("LoadingBookmarkSummary")
                .With("Id", bookmarkInfo.Id)
                .DispatchAsync();
            })
                                 .AddTo(this.CompositeDisposable);

            this.Title = bookmarkInfo.ObserveProperty(x => x.Title)
                         .ObserveOnUIDispatcher()
                         .ToReadOnlyReactivePropertySlim()
                         .AddTo(this.CompositeDisposable);

            this.Writer = bookmarkInfo.ObserveProperty(x => x.Writer)
                          .ObserveOnUIDispatcher()
                          .ToReadOnlyReactivePropertySlim()
                          .AddTo(this.CompositeDisposable);

            this.ChapterCount = bookmarkInfo.Chapters.ObserveProperty(x => x.Count)
                                .ObserveOnUIDispatcher()
                                .ToReadOnlyReactivePropertySlim()
                                .AddTo(this.CompositeDisposable);

            this.BookmarkedDate = bookmarkInfo.ObserveProperty(x => x.BookmarkedDate)
                                  .Select(x => $"{x}")
                                  .ObserveOnUIDispatcher()
                                  .ToReadOnlyReactivePropertySlim()
                                  .AddTo(this.CompositeDisposable);

            this.Updating = bookmarkInfo.ObserveProperty(x => x.Status)
                            .Select(x => x == BookmarkInfoStatus.SummaryDownloading || x == BookmarkInfoStatus.ChapterDownloading || x == BookmarkInfoStatus.SummaryLoading || x == BookmarkInfoStatus.ChapterLoading)
                            .ObserveOnUIDispatcher()
                            .ToReadOnlyReactivePropertySlim()
                            .AddTo(this.CompositeDisposable);

            this.UpdateCommand = new AsyncReactiveCommand()
                                 .WithSubscribe(async() =>
            {
                await orderBuilder.From("UpdatingBookmarkChapter")
                .With("Id", bookmarkInfo.Id)
                .DispatchAsync();
            })
                                 .AddTo(this.CompositeDisposable);

            this.ReadCommand = new AsyncReactiveCommand()
                               .WithSubscribe(async() =>
            {
                Transitioner.MoveNextCommand.Execute(null, null);
                await orderBuilder.From("RequestingBookmark")
                .With("Id", bookmarkInfo.Id)
                .DispatchAsync();
            })
                               .AddTo(this.CompositeDisposable);
        }
コード例 #6
0
ファイル: HomeViewModel.cs プロジェクト: y105109/NNReader
        public HomeViewModel(NewBookmarkDialogViewModel newBookmarkDialogViewModel, IOrderBuilder orderBuilder, ILoadableBookmarkService loadableBookmarkService)
        {
            this.NewBookmarkDialogViewModel = newBookmarkDialogViewModel;
            this.Bookmarks = loadableBookmarkService.Bookmarks.ToReadOnlyReactiveCollection(x => new BookmarkInfoViewModel(orderBuilder, x), UIDispatcherScheduler.Default);

            this.IsLoading = loadableBookmarkService.ObserveProperty(x => x.Status)
                             .Select(x => x == BookmarkServiceStatus.BookmarkInfoLoading || x == BookmarkServiceStatus.BookmarkInfoDownloading)
                             .ObserveOnUIDispatcher()
                             .ToReadOnlyReactivePropertySlim();
        }
コード例 #7
0
 public CreateOrderConsumer(IOrderRepository repo
                            , IOrderBuilder orderBuilder, ICustomerBuilder customerBuilder,
                            IMapper mapper)
 {
     this.repo            = repo;
     this.custRepo        = custRepo;
     this.orderBuilder    = orderBuilder;
     this.customerBuilder = customerBuilder;
     this.mapper          = mapper;
 }
コード例 #8
0
        public ProductViewModel(Product product, IOrderBuilder orderBuilder)
        {
            Contract.Assert(product != null);
            Contract.Assert(orderBuilder != null);

            _orderBuilder = orderBuilder;
            Product = product;

            AddToOrder = new LambdaCommand(parameter => _orderBuilder.AddProduct(Product));
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref = "MainWindow"/> class.
 /// </summary>
 public MainWindow()
 {
     InitializeComponent();
     this.configuration   = new OrderConfiguration();
     this.factory         = configuration.GetFactory();
     this.builder         = configuration.GetBuilder();
     this.validator       = configuration.GetValidator();
     this.database        = configuration.GetDatabase();
     this.builder.Factory = factory;
     this.textBoxClassOfTheTaxi.ItemsSource   = Enum.GetNames(typeof(CarClass));
     this.textBoxClassOfTheTaxi.SelectedIndex = 0;
 }
コード例 #10
0
ファイル: SelectQuery.cs プロジェクト: KrystianD/KDPgDriver
 public SelectQuery(IWhereBuilder whereBuilder,
                    ISelectFromBuilder fromBuilder,
                    IOrderBuilder orderBuilder,
                    LimitBuilder limitBuilder,
                    bool existsQuery)
 {
     _whereBuilder = whereBuilder;
     _fromBuilder  = fromBuilder;
     _orderBuilder = orderBuilder;
     _limitBuilder = limitBuilder;
     _existsQuery  = existsQuery;
 }
コード例 #11
0
        public ChapterViewModel(IOrderBuilder orderBuilder, ILoadableBookmarkService loadableBookmarkService, IChapter chapter)
        {
            this.Id = chapter.Id;

            this.LoadedCommand = new AsyncReactiveCommand()
                                 .WithSubscribe(async() =>
            {
                if (isLoaded)
                {
                    return;
                }
                isLoaded = true;
                await orderBuilder.From("LoadingChapterTitle")
                .With("Id", chapter.Id)
                .DispatchAsync();
            })
                                 .AddTo(this.CompositeDisposable);

            this.IsSelected = new ReactivePropertySlim <bool>().AddTo(this.CompositeDisposable);

            Observable.FromEventPattern <ChapterRequestEventArgs>(h => loadableBookmarkService.ChapterRequested += h, h => loadableBookmarkService.ChapterRequested -= h)
            .Select(x => x.EventArgs.Chapter != null && x.EventArgs.Chapter.Id == chapter.Id)
            .ObserveOnUIDispatcher()
            .Subscribe(x => this.IsSelected.Value = x)
            .AddTo(this.CompositeDisposable);

            this.Title = chapter.ObserveProperty(x => x.Title)
                         .ObserveOnUIDispatcher()
                         .ToReadOnlyReactivePropertySlim()
                         .AddTo(this.CompositeDisposable);

            this.Status = chapter.ObserveProperty(x => x.Status)
                          .Select(x => x.ToString())
                          .ObserveOnUIDispatcher()
                          .ToReadOnlyReactivePropertySlim()
                          .AddTo(this.CompositeDisposable);

            this.IsSelected.Where(x => x).Take(1).SelectMany(x =>
            {
                return(orderBuilder.From("LoadingChapterContent")
                       .With("Id", chapter.Id)
                       .DispatchAsync()
                       .ToObservable());
            })
            .Subscribe()
            .AddTo(this.CompositeDisposable);
        }
コード例 #12
0
        public OrderMiddleware(IMiddleware next, IOrderBuilder orderBuilder, IOrderFormatter orderFormatter,
                               IOrderCache orderCache, IMannersMessageGenerator mannersMessageGenerator) : base(next)
        {
            _orderBuilder            = orderBuilder;
            _orderFormatter          = orderFormatter;
            _orderCache              = orderCache;
            _mannersMessageGenerator = mannersMessageGenerator;

            HandlerMappings = new[]
            {
                new HandlerMapping
                {
                    ValidHandles  = ContainsTextHandle.For("table", "Table", "TABLE"),
                    Description   = "Can I take your order?",
                    EvaluatorFunc = OrderHandler
                }
            };
        }
コード例 #13
0
        public OrderServiceTests()
        {
            this.builder           = Substitute.For <IOrderBuilder>();
            this.orderManager      = Substitute.For <IOrderManager>();
            this.cartManager       = Substitute.For <ICartManager>();
            this.storefrontContext = Substitute.For <IStorefrontContext>();
            this.visitorContext    = Substitute.For <IVisitorContext>();
            var logService = Substitute.For <ILogService <CommonLog> >();

            this.service = new OrderService(
                this.builder,
                logService,
                this.orderManager,
                this.cartManager,
                this.storefrontContext,
                this.visitorContext);

            this.fixture = new Fixture();
        }
コード例 #14
0
        public OrderService(
            IOrderBuilder orderBuilder,
            ILogService <CommonLog> logService,
            IOrderManager orderManager,
            ICartManager cartManager,
            IStorefrontContext storefrontContext,
            IVisitorContext visitorContext)
        {
            Assert.ArgumentNotNull(orderManager, nameof(orderManager));
            Assert.ArgumentNotNull(cartManager, nameof(cartManager));
            Assert.ArgumentNotNull(orderBuilder, nameof(orderBuilder));
            Assert.ArgumentNotNull(storefrontContext, nameof(storefrontContext));
            Assert.ArgumentNotNull(visitorContext, nameof(visitorContext));

            this.orderManager      = orderManager;
            this.logService        = logService;
            this.builder           = orderBuilder;
            this.cartManager       = cartManager;
            this.storefrontContext = storefrontContext;
            this.visitorContext    = visitorContext;
        }
コード例 #15
0
        public ReadingRoomViewModel(IOrderBuilder orderBuilder, ILoadableBookmarkService loadableBookmarkService, IBookmarkInfo bookmarkInfo)
        {
            this.Loading = bookmarkInfo.ObserveProperty(x => x.Status)
                           .Select(x => x == BookmarkInfoStatus.SummaryLoading || x == BookmarkInfoStatus.SummaryDownloading || x == BookmarkInfoStatus.ChapterLoading || x == BookmarkInfoStatus.ChapterDownloading)
                           .ObserveOnUIDispatcher()
                           .ToReadOnlyReactivePropertySlim()
                           .AddTo(this.CompositeDisposable);

            this.BackCommand = new AsyncReactiveCommand()
                               .WithSubscribe(async() =>
            {
                Transitioner.MovePreviousCommand.Execute(null, null);
                await orderBuilder.From("RequestingChapter")
                .With("Id", Guid.Empty)
                .Next("RequestingBookmark")
                .With("Id", Guid.Empty)
                .DispatchAsync();
            })
                               .AddTo(this.CompositeDisposable);

            this.Chapters = bookmarkInfo.Chapters.ToReadOnlyReactiveCollection(x => new ChapterViewModel(orderBuilder, loadableBookmarkService, x), UIDispatcherScheduler.Default)
                            .AddTo(this.CompositeDisposable);

            this.SelectionChangedCommand = new AsyncReactiveCommand <SelectionChangedEventArgs>()
                                           .WithSubscribe(async e =>
            {
                var selectred = e.AddedItems.Cast <ChapterViewModel>().FirstOrDefault();
                await orderBuilder.From("RequestingChapter")
                .With("Id", selectred?.Id ?? Guid.Empty)
                .DispatchAsync();
            })
                                           .AddTo(this.CompositeDisposable);

            this.IsSelected = Observable.FromEventPattern <BookmarkRequestEventArgs>(h => loadableBookmarkService.BookmarkRequested += h, h => loadableBookmarkService.BookmarkRequested -= h)
                              .Select(x => x.EventArgs.Bookmark != null && x.EventArgs.Bookmark.Id == bookmarkInfo.Id)
                              .ObserveOnUIDispatcher()
                              .ToReadOnlyReactivePropertySlim()
                              .AddTo(this.CompositeDisposable);

            this.ChapterTitle = Observable.FromEventPattern <ChapterRequestEventArgs>(h => loadableBookmarkService.ChapterRequested += h, h => loadableBookmarkService.ChapterRequested -= h)
                                .Select(x => x.EventArgs.Chapter?.Title ?? "")
                                .ObserveOnUIDispatcher()
                                .ToReadOnlyReactivePropertySlim()
                                .AddTo(this.CompositeDisposable);

            //this.ChapterContent = new ReactivePropertySlim<string>("").AddTo(this.CompositeDisposable);

            this.ChapterContent = Observable.FromEventPattern <ChapterRequestEventArgs>(h => loadableBookmarkService.ChapterRequested += h, h => loadableBookmarkService.ChapterRequested -= h)
                                  .SelectMany(x =>
            {
                var chapter = x.EventArgs.Chapter;
                if (chapter == null || bookmarkInfo.Chapters.All(c => c.Id != chapter.Id))
                {
                    return(Observable.Return(""));
                }
                return(chapter.ObserveProperty(c => c.Content));
            })
                                  .ObserveOnUIDispatcher()
                                  //.Subscribe(x => this.ChapterContent.Value = x)
                                  .ToReadOnlyReactivePropertySlim()
                                  .AddTo(this.CompositeDisposable);

            this.IsSelected.Where(x => x).Take(1).SelectMany(x =>
            {
                return(orderBuilder.From("LoadingBookmarkChapter")
                       .With("Id", bookmarkInfo.Id)
                       .DispatchAsync()
                       .ToObservable());
            })
            .Subscribe()
            .AddTo(this.CompositeDisposable);
        }
コード例 #16
0
 public OrderScreen()
 {
     _orderBuilder   = new OrderBuilder();
     _saladDecorator = new SaladDecorator();
     _counter        = new BarCounter();
 }
コード例 #17
0
 public ParcelWorker(IOrderBuilder parcelOrderBuilder, ILogger <ParcelWorker> logger)
 {
     _parcelOrderBuilder = parcelOrderBuilder;
     _logger             = logger;
 }
コード例 #18
0
 public OrderBuildDirector(IOrderBuilder builder) => _builder = builder;
コード例 #19
0
 public static IOrderDiapatchable From <TOrder>(this IOrderBuilder self) where TOrder : IOrder
 => self.From(typeof(TOrder));
コード例 #20
0
 public void SetBuilder(IOrderBuilder orderBuilder)
 {
     orderBuilder.Reset();
     _orderBuilder = orderBuilder;
 }
コード例 #21
0
 public ReadingRoomsViewModel(IOrderBuilder orderBuilder, ILoadableBookmarkService loadableBookmarkService)
 {
     this.Bookmarks = loadableBookmarkService.Bookmarks.ToReadOnlyReactiveCollection(x => new ReadingRoomViewModel(orderBuilder, loadableBookmarkService, x));
 }