コード例 #1
0
        private void OnAddAsResourceExecute()
        {
            if (_selectedUshortsFormatterViewModel == null)
            {
                return;
            }
            if (_isFormatterFromResource)
            {
                return;
            }
            var formatterParametersViewModel = _container.Resolve <IFormatterParametersViewModel>();

            formatterParametersViewModel.IsFromSharedResources            = true;
            formatterParametersViewModel.RelatedUshortsFormatterViewModel = _selectedUshortsFormatterViewModel;

            _sharedResourcesGlobalViewModel.AddAsSharedResource(StaticContainer.Container.Resolve <ISaveFormatterService>().CreateUshortsParametersFormatter(formatterParametersViewModel));
            CurrentResourceString = formatterParametersViewModel.Name;

            IsFormatterFromResource = true;
        }
コード例 #2
0
ファイル: EditorTests.cs プロジェクト: Pepega-corp/Un2
        private void CreateFormatterParametersForResourcesViewModel(int identity)
        {
            ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel =
                _typesContainer.Resolve <ISharedResourcesGlobalViewModel>();
            var formatterViewModel = CreateFormatterViewModel(identity, _typesContainer);

            sharedResourcesGlobalViewModel.AddAsSharedResource(new FormatterParametersViewModel()
            {
                IsFromSharedResources = false,
                Name = "formatter" + identity,
                RelatedUshortsFormatterViewModel = formatterViewModel
            }, false);

            ISaveFormatterService saveFormatterService = _typesContainer.Resolve <ISaveFormatterService>();

            IUshortsFormatter resourceUshortsFormatter =
                saveFormatterService.CreateUshortsParametersFormatter(formatterViewModel);

            resourceUshortsFormatter.Name = "formatter" + identity;
            sharedResourcesGlobalViewModel.UpdateSharedResource(resourceUshortsFormatter);
        }