Exemple #1
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            ProductInfo  = new ProductInfo(this, CurrentLine.OfType <BaseOffer>());
            OrderWarning = new InlineEditWarning(UiScheduler, Manager);

            //если это отправленный заказ редактор не должен работать
            var currentOrderLine = new NotifyValue <OrderLine>();

            if (IsCurrentOrder)
            {
                currentOrderLine = CurrentLine.Select(v => (OrderLine)v).ToValue();
                currentOrderLine.Subscribe(v => CurrentLine.Value = v);
            }
            editor             = new Editor(OrderWarning, Manager, currentOrderLine, Lines.Cast <IList>().ToValue());
            OnlyWarningVisible = new NotifyValue <bool>(User.IsPreprocessOrders && IsCurrentOrder);
            CurrentLine.OfType <BaseOffer>()
            .Throttle(Consts.LoadOrderHistoryTimeout, Scheduler)
            .Select(x => RxQuery(s => BaseOfferViewModel.LoadOrderHistory(s, Cache, Settings.Value, x, Address)))
            .Switch()
            .Subscribe(HistoryOrders, CloseCancellation.Token);

            FilterItems.Select(p => p.Changed()).Merge().Throttle(Consts.FilterUpdateTimeout, UiScheduler)
            .Select(_ => Filter())
            .Subscribe(Lines, CloseCancellation.Token);
        }