Example #1
0
        public OscilloscopeJournalViewModel(IValueViewModelFactory valueViewModelFactory,
                                            ILocalizerService localizerService, Func <IBoolValue> boolValueGettingFunc,
                                            ILoadingSequenceLoaderRegistry loadingSequenceLoaderRegistry, IJournalLoaderProvider journalLoaderProvider, OscillogramLoader oscillogramLoader)
        {
            this._valueViewModelFactory    = valueViewModelFactory;
            this._localizerService         = localizerService;
            this._boolValueGettingFunc     = boolValueGettingFunc;
            _loadingSequenceLoaderRegistry = loadingSequenceLoaderRegistry;
            _journalLoaderProvider         = journalLoaderProvider;
            _oscillogramLoader             = oscillogramLoader;
            this.LoadCommand  = new RelayCommand(this.OnLoadExecute);
            this.SelectedRows = new List <int>();
            _loaderHooks      = new LoaderHooks(() =>
            {
                Table = new DynamicDataTable(this.JournalParametersNameList, null, true);
                RaisePropertyChanged(nameof(this.Table));
                RaisePropertyChanged(nameof(this.JournalParametersNameList));
            }, list =>
            {
                List <IFormattedValueViewModel> formattedValueViewModels = new List <IFormattedValueViewModel>();
                int index                   = this.Table.GetCurrentValueCount();
                IBoolValue boolValue        = this._boolValueGettingFunc();
                boolValue.BoolValueProperty = this._oscillogramLoader.TryGetOscillogram(index, out string s, _oscilloscopeViewModel, _oscilloscopeModel, _oscilloscopeViewModel.DeviceContext);
                formattedValueViewModels.Add(this._valueViewModelFactory.CreateFormattedValueViewModel(boolValue));
                formattedValueViewModels.AddRange(list.Select((formattedValue =>
                                                               this._valueViewModelFactory.CreateFormattedValueViewModel(formattedValue))).ToList());

                this.Table.AddFormattedValueViewModel(formattedValueViewModels);
            });
Example #2
0
        public OscilloscopeViewModel(ITypesContainer container, IApplicationGlobalCommands applicationGlobalCommands, IFragmentOptionsViewModel fragmentOptionsViewModel,
                                     Func <IFragmentOptionGroupViewModel> fragmentOptionGroupViewModelgetFunc,
                                     Func <IFragmentOptionCommandViewModel> fragmentOptionCommandViewModelgetFunc
                                     , OscillogramLoader oscillogramLoader)
        {
            this._container = container;
            this._applicationGlobalCommands = applicationGlobalCommands;
            _oscillogramLoader = oscillogramLoader;
            this.OscilloscopeJournalViewModel    = this._container.Resolve <IOscilloscopeJournalViewModel>();
            this.LoadSelectedOscillogramsCommand = new RelayCommand(this.OnLoadSelectedOscillogramsExecute);
            this.ShowOscillogramCommand          = new RelayCommand <object>(this.OnShowOscillogramExecute);
            this.MaxLoadingProgress              = 1;
            this.CurrentLoadingProgress          = 0;
            this._loadingCancellationTokenSource = new CancellationTokenSource();
            this.StopLoadingCommand              = new RelayCommand(this.OnStopLoadingExecute);

            IFragmentOptionGroupViewModel fragmentOptionGroupViewModel = fragmentOptionGroupViewModelgetFunc();

            fragmentOptionGroupViewModel.NameKey = OscilloscopeKeys.OSCILLOSCOPE_JOURNAL;
            IFragmentOptionCommandViewModel fragmentOptionCommandViewModel = fragmentOptionCommandViewModelgetFunc();

            fragmentOptionCommandViewModel.TitleKey = "Load";
            fragmentOptionCommandViewModel.IconKey  = IconResourceKeys.IconInboxIn;
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);
            fragmentOptionCommandViewModel.OptionCommand = this.OscilloscopeJournalViewModel.LoadCommand;

            fragmentOptionCommandViewModel          = fragmentOptionCommandViewModelgetFunc();
            fragmentOptionCommandViewModel.TitleKey = OscilloscopeKeys.LOAD_SELECTED_OSCILLOGRAMS;
            fragmentOptionCommandViewModel.IconKey  = IconResourceKeys.IconDiscDownload;
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);
            fragmentOptionCommandViewModel.OptionCommand = this.LoadSelectedOscillogramsCommand;

            fragmentOptionsViewModel.FragmentOptionGroupViewModels.Add(fragmentOptionGroupViewModel);
            this.FragmentOptionsViewModel = fragmentOptionsViewModel;
            Oscillograms = new List <Oscillogram>();
        }