示例#1
0
        protected override void OnInitialize()
        {
            Invoker.SaftyInvoke <DefaultPresenter>(p =>
            {
                //register ribbon buttons, 并非最佳作法, 导致 CommandBindings.Clear() 然后再重新加入  CommandBindings.AddRange();
                p.CommandBindings.Add(new CommandBinding(WPF.ApplicationFramework.ApplicationCommands.ExportSvcLevelData, OnExportSvcLevelDataExecuted,
                                                         (d, e) => { e.CanExecute = AnalyisComplete; }));
                p.NotifyOfPropertyChange(() => CommandBindings);
                p.PropertyChanged += InvokerPropertyChanged;
            });

            _enquiryRange = new DateRange(_schedule.Start.AddDays(Global.HeadDayAmount), _schedule.End.AddDays(Global.TailDayAmount));

            _serviceQueueContainer = _staffingCalculatorModel.Preparing(_schedule.Id, _enquiryRange, ConvertTo); // 读取预测数据
            _serviceQueuesView     = CollectionViewSource.GetDefaultView(_serviceQueueContainer.GetEntities());

            WhenReady.SaftyInvoke(d => d(_serviceQueueContainer, SwitchView));
            Pop();
            _combinedServiceQueues = new StatisticRaw(new CombinedServiceQueueStatistic(_serviceQueueContainer.Values, _serviceQueueContainer.CoverageDays), ConvertTo);
            _combinedServiceQueues.SetForceastValues();
            _combinedServiceQueues.Items3 = CollectionViewSource.GetDefaultView(_combinedServiceQueues.Items).Self(v =>
            {
                v.Filter = d => d.SaftyGetProperty <bool, IVisibleLinerData>(
                    line => line.Category == _selectedCategory);
            });

            base.OnInitialize();
            FullyFetch();

            #region 合併SQ做估算的code
            //new Thread(() =>
            //{
            //    IEnumerable[] lines = { new List<IStaffingStatistic>() };
            //    var action = new Action(() => StaffingStatistics = CollectionViewSource.GetDefaultView(lines[0]));
            //    _serviceQueueContainer.Output2(out lines[0], ref action);
            //    UIThread.Invoke(action);
            //}).Start();
            #endregion
        }
示例#2
0
        protected override void LoadContent()
        {
            WhenReady?.Invoke(this, Content);

            base.LoadContent();
        }