public MeasuringLoader(DeviceContext deviceContext, MeasuringSubscriptionSet measuringSubscriptionSet, IMeasuringMonitor measuringMonitor, RelayCommand dependentCommand, FragmentOptionToggleCommandViewModel readCycleCommand) { _deviceContext = deviceContext; _measuringSubscriptionSet = measuringSubscriptionSet; _measuringMonitor = measuringMonitor; this._dependentCommand = dependentCommand; _readCycleCommand = readCycleCommand; }
public MeasuringMonitorViewModel(IMeasuringGroupViewModelFactory measuringGroupViewModelFactory, IFragmentOptionsViewModel fragmentOptionsViewModel, Func <IFragmentOptionGroupViewModel> fragmentOptionGroupViewModelgetFunc, Func <IFragmentOptionCommandViewModel> fragmentOptionCommandViewModelgetFunc, IApplicationSettingsService applicationSettingsService) { _measuringGroupViewModelFactory = measuringGroupViewModelFactory; _applicationSettingsService = applicationSettingsService; MeasuringGroupViewModels = new ObservableCollection <IMeasuringGroupViewModel>(); FragmentOptionsViewModel = fragmentOptionsViewModel; MeasuringElementViewModels = new ObservableCollection <IMeasuringElementViewModel>(); IFragmentOptionGroupViewModel fragmentOptionGroupViewModel = fragmentOptionGroupViewModelgetFunc(); fragmentOptionGroupViewModel.NameKey = "Loading"; IFragmentOptionCommandViewModel fragmentOptionCommandViewModel = fragmentOptionCommandViewModelgetFunc(); fragmentOptionCommandViewModel.TitleKey = "Load"; _readCommand = new RelayCommand(() => _loader.ExecuteLoad(), () => DeviceContext.DataProviderContainer.DataProvider.IsSuccess && !this._loader.IsLoadInProgress); fragmentOptionCommandViewModel.OptionCommand = this._readCommand; fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconInboxIn; fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel); _readCycleCommand = new FragmentOptionToggleCommandViewModel(new RelayCommand <bool?>( isCycleLoadingEnabled => { if (isCycleLoadingEnabled.HasValue) { if (isCycleLoadingEnabled.Value) { _loader.StartLoading(); } else { _loader.StopLoading(); } } }, (isCycleLoadingEnabled) => DeviceContext.DataProviderContainer.DataProvider.IsSuccess), () => DeviceContext.DataProviderContainer.DataProvider.IsSuccess); fragmentOptionCommandViewModel = _readCycleCommand; fragmentOptionCommandViewModel.TitleKey = "CycleLoading"; fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconArrowRightLeft; fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel); FragmentOptionsViewModel.FragmentOptionGroupViewModels.Add(fragmentOptionGroupViewModel); fragmentOptionGroupViewModel = fragmentOptionGroupViewModelgetFunc(); fragmentOptionGroupViewModel.NameKey = "Presentation"; fragmentOptionCommandViewModel = new FragmentOptionToggleCommandViewModel(new RelayCommand <bool?>( isAllSelected => { if (isAllSelected.HasValue) { IsListViewSelected = isAllSelected.Value; _loader.SetCurrentGroup(); } })); fragmentOptionCommandViewModel.TitleKey = "ViewAll"; fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconAlignJustify; fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel); fragmentOptionCommandViewModel = fragmentOptionCommandViewModelgetFunc(); fragmentOptionCommandViewModel.TitleKey = "ZoomIn"; fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(() => { Scale += 0.1; }); fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconMagnifyAdd; fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel); fragmentOptionCommandViewModel = fragmentOptionCommandViewModelgetFunc(); fragmentOptionCommandViewModel.TitleKey = "ZoomOut"; fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(() => { Scale -= 0.1; }); fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconMagnifyMinus; fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel); FragmentOptionsViewModel.FragmentOptionGroupViewModels.Add(fragmentOptionGroupViewModel); Scale = 1; }