Esempio n. 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);
            });
Esempio n. 2
0
 public JournalLoader(DeviceContext deviceContext, IUniconJournal uniconJournal, LoaderHooks loaderHooks)
 {
     _deviceContext         = deviceContext;
     _uniconJournal         = uniconJournal;
     _loaderHooks           = loaderHooks;
     _journalRecordFactory  = StaticContainer.Container.Resolve <IJournalRecordFactory>();
     _valueViewModelFactory = StaticContainer.Container.Resolve <IValueViewModelFactory>();
 }
Esempio n. 3
0
        public UniconJournalViewModel(ILocalizerService localizerService,
                                      IFragmentOptionsViewModel fragmentOptionsViewModel,
                                      Func <IFragmentOptionGroupViewModel> fragmentOptionGroupViewModelgetFunc,
                                      Func <IFragmentOptionCommandViewModel> fragmentOptionCommandViewModelgetFunc,
                                      IApplicationGlobalCommands applicationGlobalCommands, ITypesContainer typesContainer, ILogService logService
                                      , IApplicationSettingsService applicationSettingsService, IJournalLoaderProvider journalLoaderProvider,
                                      IValueViewModelFactory valueViewModelFactory)

        {
            _localizerService          = localizerService;
            _applicationGlobalCommands = applicationGlobalCommands;
            _typesContainer            = typesContainer;
            _logService = logService;
            _applicationSettingsService = applicationSettingsService;
            _journalLoaderProvider      = journalLoaderProvider;
            _valueViewModelFactory      = valueViewModelFactory;
            IFragmentOptionGroupViewModel fragmentOptionGroupViewModel = fragmentOptionGroupViewModelgetFunc();

            fragmentOptionGroupViewModel.NameKey = "Device";
            IFragmentOptionCommandViewModel fragmentOptionCommandViewModel = fragmentOptionCommandViewModelgetFunc();

            fragmentOptionCommandViewModel.TitleKey = "Load";
            fragmentOptionCommandViewModel.IconKey  = IconResourceKeys.IconInboxIn;
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);
            LoadCommand = new RelayCommand(OnLoadJournal, CanLoadExecute);
            fragmentOptionCommandViewModel.OptionCommand = LoadCommand;
            fragmentOptionsViewModel.FragmentOptionGroupViewModels.Add(fragmentOptionGroupViewModel);

            fragmentOptionCommandViewModel               = fragmentOptionCommandViewModelgetFunc();
            fragmentOptionCommandViewModel.TitleKey      = "Open";
            fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconDiscUpload;
            fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteLoadJournal);
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            fragmentOptionCommandViewModel               = fragmentOptionCommandViewModelgetFunc();
            fragmentOptionCommandViewModel.TitleKey      = "Save";
            fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconDiscDownload;
            fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteSaveJournal);
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            fragmentOptionCommandViewModel               = fragmentOptionCommandViewModelgetFunc();
            fragmentOptionCommandViewModel.TitleKey      = ApplicationGlobalNames.UiCommandStrings.SAVE_FOR_PRINT;
            fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconPrintText;
            fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteExportJournal);
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            _loaderHooks = new LoaderHooks(
                () => { Table.Values.Clear(); }, list =>
            {
                Table.AddFormattedValueViewModel(list.Select(formattedValue =>
                                                             _valueViewModelFactory.CreateFormattedValueViewModel(formattedValue)).ToList());
            });
            FragmentOptionsViewModel = fragmentOptionsViewModel;
            CanExecuteJournalLoading = true;
        }
Esempio n. 4
0
 public IJournalLoader GetJournalLoader(DeviceContext deviceContext,
                                        IUniconJournal uniconJournal, LoaderHooks loaderHooks)
 {
     return(new JournalLoader(deviceContext, uniconJournal, loaderHooks));
 }