예제 #1
0
        public static void InitializeStaticButtons(ShellViewModel shellViewModel)
        {
            var container = StaticContainer.Container;
            Func <IFragmentOptionGroupViewModel> fragmentOptionGroupViewModelGettingFunc =
                container.Resolve <Func <IFragmentOptionGroupViewModel> >();
            Func <IFragmentOptionCommandViewModel> fragmentOptionCommandViewModelGettingFunc =
                container.Resolve <Func <IFragmentOptionCommandViewModel> >();

            IFragmentOptionGroupViewModel   fragmentOptionGroupViewModel   = fragmentOptionGroupViewModelGettingFunc();
            IFragmentOptionCommandViewModel fragmentOptionCommandViewModel = fragmentOptionCommandViewModelGettingFunc();

            fragmentOptionCommandViewModel.TitleKey      = "Save";
            fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconDisc;
            fragmentOptionCommandViewModel.OptionCommand = shellViewModel.SaveProjectCommand;
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            fragmentOptionCommandViewModel               = fragmentOptionCommandViewModelGettingFunc();
            fragmentOptionCommandViewModel.TitleKey      = "Add";
            fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconAdd;
            fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(() =>
            {
                shellViewModel.NavigateToDeviceAddingCommand.Execute(ApplicationGlobalNames.ADDING_MODE);
            });
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            shellViewModel.ToolBarViewModel.StaticOptionsGroup = fragmentOptionGroupViewModel;
        }
예제 #2
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;
        }
예제 #3
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>();
        }
예제 #4
0
        public IFragmentOptionsViewModel CreateConfigurationFragmentOptionsViewModel(
            IRuntimeConfigurationViewModel runtimeConfigurationViewModel, ITypesContainer container,
            IDeviceConfiguration deviceConfiguration)
        {
            _runtimeConfigurationViewModel = runtimeConfigurationViewModel;
            _container           = container;
            _deviceConfiguration = deviceConfiguration;
            Func <IFragmentOptionGroupViewModel> fragmentOptionGroupViewModelGettingFunc =
                container.Resolve <Func <IFragmentOptionGroupViewModel> >();
            Func <IFragmentOptionCommandViewModel> fragmentOptionCommandViewModelGettingFunc =
                container.Resolve <Func <IFragmentOptionCommandViewModel> >();

            IFragmentOptionsViewModel fragmentOptionsViewModel = container.Resolve <IFragmentOptionsViewModel>();


            fragmentOptionsViewModel.FragmentOptionGroupViewModels =
                new ObservableCollection <IFragmentOptionGroupViewModel>();


            IFragmentOptionGroupViewModel fragmentOptionGroupViewModel =
                fragmentOptionGroupViewModelGettingFunc();



            //группа устройство
            fragmentOptionGroupViewModel.NameKey = ApplicationGlobalNames.UiGroupingStrings.DEVICE_STRING_KEY;
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels = new List <IFragmentOptionCommandViewModel>();

            IFragmentOptionCommandViewModel fragmentOptionCommandViewModel =
                fragmentOptionCommandViewModelGettingFunc();


            fragmentOptionCommandViewModel.TitleKey = ApplicationGlobalNames.UiCommandStrings.READ_STRING_KEY;
            fragmentOptionCommandViewModel.IconKey  = IconResourceKeys.IconInboxIn;
            this.ReadConfigurationCommand           = new RelayCommand(() => OnExecuteReadConfiguration(true),
                                                                       () => _runtimeConfigurationViewModel.DeviceContext.DataProviderContainer.DataProvider.IsSuccess &&
                                                                       !this._isQueryInProgress);
            fragmentOptionCommandViewModel.OptionCommand = this.ReadConfigurationCommand;
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            fragmentOptionCommandViewModel               = fragmentOptionCommandViewModelGettingFunc();
            fragmentOptionCommandViewModel.TitleKey      = ConfigurationKeys.TRANSFER_FROM_DEVICE_TO_LOCAL_STRING_KEY;
            fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconChevronRight;
            fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteTransferFromDeviceToLocal,
                                                                            () => _runtimeConfigurationViewModel.DeviceContext.DataProviderContainer.DataProvider.IsSuccess);
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            fragmentOptionCommandViewModel          = fragmentOptionCommandViewModelGettingFunc();
            fragmentOptionCommandViewModel.TitleKey = ConfigurationKeys.WRITE_LOCAL_VALUES_TO_DEVICE_STRING_KEY;
            fragmentOptionCommandViewModel.IconKey  = IconResourceKeys.IconInboxOut;
            WriteConfigurationCommand =
                new RelayCommand(OnExecuteWriteLocalValuesToDevice,
                                 () => _runtimeConfigurationViewModel.DeviceContext.DataProviderContainer.DataProvider.IsSuccess &&
                                 !this._isQueryInProgress);
            fragmentOptionCommandViewModel.OptionCommand = this.WriteConfigurationCommand;
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);


            fragmentOptionsViewModel.FragmentOptionGroupViewModels.Add(fragmentOptionGroupViewModel);
            fragmentOptionGroupViewModel = fragmentOptionGroupViewModelGettingFunc();
            //группа файл
            fragmentOptionGroupViewModel.NameKey = ApplicationGlobalNames.UiGroupingStrings.FILE_STRING_KEY;
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels = new List <IFragmentOptionCommandViewModel>();

            fragmentOptionCommandViewModel               = fragmentOptionCommandViewModelGettingFunc();
            fragmentOptionCommandViewModel.TitleKey      = ConfigurationKeys.LOAD_FROM_FILE_STRING_KEY;
            fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconDiscUpload;
            fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteLoadConfiguration);
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            fragmentOptionCommandViewModel               = fragmentOptionCommandViewModelGettingFunc();
            fragmentOptionCommandViewModel.TitleKey      = ConfigurationKeys.SAVE_CONFUGURATION_STRING_KEY;
            fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconDiscDownload;
            fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteSaveConfiguration);
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            fragmentOptionCommandViewModel               = fragmentOptionCommandViewModelGettingFunc();
            fragmentOptionCommandViewModel.TitleKey      = ConfigurationKeys.EXPORT_CONFUGURATION_STRING_KEY;
            fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconPrintText;
            fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteExportConfiguration);
            fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);

            fragmentOptionsViewModel.FragmentOptionGroupViewModels.Add(fragmentOptionGroupViewModel);

            // // группа дерево
            // fragmentOptionGroupViewModel = fragmentOptionGroupViewModelGettingFunc();
            // fragmentOptionGroupViewModel.NameKey = ApplicationGlobalNames.UiGroupingStrings.TREE_STRING_KEY;
            // fragmentOptionGroupViewModel.FragmentOptionCommandViewModels = new List<IFragmentOptionCommandViewModel>();
            //
            // fragmentOptionCommandViewModel = fragmentOptionCommandViewModelGettingFunc();
            // fragmentOptionCommandViewModel.TitleKey = ConfigurationKeys.EXPAND_LEVEL_STRING_KEY;
            // fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconStepInto;
            // fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteExpandLevel);
            // fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);
            //
            //
            // fragmentOptionCommandViewModel = fragmentOptionCommandViewModelGettingFunc();
            // fragmentOptionCommandViewModel.TitleKey = ConfigurationKeys.COLLAPSE_LEVEL_STRING_KEY;
            // fragmentOptionCommandViewModel.IconKey = IconResourceKeys.IconStepOut;
            // fragmentOptionCommandViewModel.OptionCommand = new RelayCommand(OnExecuteCollapseLevel);
            // fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);


            //fragmentOptionsViewModel.FragmentOptionGroupViewModels.Add(fragmentOptionGroupViewModel);

            // группа базовые уставки
            if (runtimeConfigurationViewModel.BaseValuesViewModel.BaseValueViewModels.Any())
            {
                fragmentOptionGroupViewModel = fragmentOptionGroupViewModelGettingFunc();

                fragmentOptionGroupViewModel.NameKey = ApplicationGlobalNames.UiGroupingStrings.BASE_VALUES_STRING_KEY;
                fragmentOptionGroupViewModel.FragmentOptionCommandViewModels =
                    new List <IFragmentOptionCommandViewModel>();
                foreach (var baseValueViewModel in runtimeConfigurationViewModel.BaseValuesViewModel.BaseValueViewModels
                         )
                {
                    fragmentOptionCommandViewModel               = fragmentOptionCommandViewModelGettingFunc();
                    fragmentOptionCommandViewModel.TitleKey      = baseValueViewModel.Name;
                    fragmentOptionCommandViewModel.IconKey       = IconResourceKeys.IconBaseValuesTransfer;
                    fragmentOptionCommandViewModel.OptionCommand = baseValueViewModel.OnBaseValueApply;
                    fragmentOptionGroupViewModel.FragmentOptionCommandViewModels.Add(fragmentOptionCommandViewModel);
                }

                fragmentOptionsViewModel.FragmentOptionGroupViewModels.Add(fragmentOptionGroupViewModel);
            }


            return(fragmentOptionsViewModel);
        }
예제 #5
0
        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;
        }