Ejemplo n.º 1
0
        public ArchiveFilterViewModel(XArchiveFilter archiveFilter)
        {
            Title = "Настройки фильтра";
            ClearCommand = new RelayCommand(OnClear);
            SaveCommand = new RelayCommand(OnSave);
            CancelCommand = new RelayCommand(OnCancel);

            StartDate = archiveFilter.StartDate;
            EndDate = archiveFilter.EndDate;
            StartTime = archiveFilter.StartDate;
            EndTime = archiveFilter.EndDate;
            UseSystemDate = archiveFilter.UseSystemDate;
        }
Ejemplo n.º 2
0
        void OnShowFilter()
        {
            if (_archiveFilter == null)
                _archiveFilter = GerFilterFromDefaultState(_archiveDefaultState);

            ArchiveFilterViewModel archiveFilterViewModel = null;

            var result = WaitHelper.Execute(() =>
            {
                archiveFilterViewModel = new ArchiveFilterViewModel(_archiveFilter);
            });

            if (result)
            {
                if (DialogService.ShowModalWindow(archiveFilterViewModel))
                {
                    _archiveFilter = archiveFilterViewModel.GetModel();
                    OnPropertyChanged("IsFilterExists");
                    IsFilterOn = true;
                }
            }
        }
Ejemplo n.º 3
0
        XArchiveFilter GerFilterFromDefaultState(ArchiveDefaultState archiveDefaultState)
        {
            var archiveFilter = new XArchiveFilter()
            {
                StartDate = ArchiveFirstDate,
                EndDate = DateTime.Now
            };

            switch (archiveDefaultState.ArchiveDefaultStateType)
            {
                case ArchiveDefaultStateType.LastHours:
                    if (archiveDefaultState.Count.HasValue)
                        archiveFilter.StartDate = archiveFilter.EndDate.AddHours(-archiveDefaultState.Count.Value);
                    break;

                case ArchiveDefaultStateType.LastDays:
                    if (archiveDefaultState.Count.HasValue)
                        archiveFilter.StartDate = archiveFilter.EndDate.AddDays(-archiveDefaultState.Count.Value);
                    break;

                case ArchiveDefaultStateType.FromDate:
                    if (archiveDefaultState.StartDate.HasValue)
                        archiveFilter.StartDate = archiveDefaultState.StartDate.Value;
                    break;

                case ArchiveDefaultStateType.RangeDate:
                    if (archiveDefaultState.StartDate.HasValue)
                        archiveFilter.StartDate = archiveDefaultState.StartDate.Value;
                    if (archiveDefaultState.EndDate.HasValue)
                        archiveFilter.EndDate = archiveDefaultState.EndDate.Value;
                    break;
            }

            return archiveFilter;
        }