public GenericParamVM(GenericParamOptions options, ModuleDef ownerModule, IDecompilerManager decompilerManager, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.origOptions = options; this.Number = new UInt16VM(a => { OnPropertyChanged(nameof(FullName)); HasErrorUpdated(); }); this.TypeDefOrRefAndCAsVM = new TypeDefOrRefAndCAsVM <GenericParamConstraint>(dnSpy_AsmEditor_Resources.EditGenericParameterConstraint, dnSpy_AsmEditor_Resources.CreateGenericParameterConstraint, ownerModule, decompilerManager, ownerType, ownerMethod); this.CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerManager); this.GPVarianceVM = new EnumListVM(EnumVM.Create(typeof(GPVariance))); var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerManager) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) { typeSigCreatorOptions.CanAddGenericMethodVar = true; } this.TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); Reinitialize(); }
public GenericParamVM(GenericParamOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.origOptions = options; this.number = new UInt16VM(a => { OnPropertyChanged("FullName"); HasErrorUpdated(); }); this.typeDefOrRefAndCAsVM = new TypeDefOrRefAndCAsVM <GenericParamConstraint>("Edit Generic Parameter Constraint", "Create Generic Parameter Constraint", ownerModule, language, ownerType, ownerMethod); this.customAttributesVM = new CustomAttributesVM(ownerModule, language); this.gpVarianceVM = new EnumListVM(EnumVM.Create(typeof(GPVariance))); var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) { typeSigCreatorOptions.CanAddGenericMethodVar = true; } this.typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); Reinitialize(); }
public CANamedArgumentVM(ModuleDef ownerModule, CANamedArgument namedArg, TypeSigCreatorOptions options) { this.ownerModule = ownerModule; this.originalNamedArg = namedArg.Clone(); this.constantTypeEnumListVM = new EnumListVM(ConstantTypeVM.CreateEnumArray(validTypes), (a, b) => OnConstantTypeChanged()); this.namedArgTypeEnumListVM = new EnumListVM(EnumVM.Create(typeof(NamedArgType)), (a, b) => OnNamedArgTypeChanged()); InitializeFrom(namedArg, options); this.modified = false; }
public AppSettingsPageImpl(IBackgroundImageSettingsService backgroundImageSettingsService, IPickFilename pickFilename, IPickDirectory pickDirectory, ImageSettingsInfo[] settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (settings.Length == 0) { throw new ArgumentException(); } Debug.Assert(settings.All(a => a.Lazy.Value.UserVisible)); this.backgroundImageSettingsService = backgroundImageSettingsService ?? throw new ArgumentNullException(nameof(backgroundImageSettingsService)); this.pickFilename = pickFilename ?? throw new ArgumentNullException(nameof(pickFilename)); this.pickDirectory = pickDirectory ?? throw new ArgumentNullException(nameof(pickDirectory)); Settings = new ObservableCollection <Settings>(settings.OrderBy(a => a.Lazy.Value.UIOrder).Select(a => new Settings(a))); stretchVM = new EnumListVM(EnumVM.Create(false, typeof(Stretch)), (a, b) => currentItem.RawSettings.Stretch = (Stretch)stretchVM.SelectedItem); stretchDirectionVM = new EnumListVM(stretchDirectionList, (a, b) => currentItem.RawSettings.StretchDirection = (StretchDirection)stretchDirectionVM.SelectedItem); imagePlacementVM = new EnumListVM(imagePlacementList, (a, b) => currentItem.RawSettings.ImagePlacement = (ImagePlacement)imagePlacementVM.SelectedItem); opacityVM = new DoubleVM(a => { if (!opacityVM.HasError) { currentItem.RawSettings.Opacity = FilterOpacity(opacityVM.Value); } }); horizontalOffsetVM = new DoubleVM(a => { if (!horizontalOffsetVM.HasError) { currentItem.RawSettings.HorizontalOffset = FilterOffset(horizontalOffsetVM.Value); } }); verticalOffsetVM = new DoubleVM(a => { if (!verticalOffsetVM.HasError) { currentItem.RawSettings.VerticalOffset = FilterOffset(verticalOffsetVM.Value); } }); leftMarginWidthPercentVM = new DoubleVM(a => { if (!leftMarginWidthPercentVM.HasError) { currentItem.RawSettings.LeftMarginWidthPercent = FilterMarginPercent(leftMarginWidthPercentVM.Value); } }); rightMarginWidthPercentVM = new DoubleVM(a => { if (!rightMarginWidthPercentVM.HasError) { currentItem.RawSettings.RightMarginWidthPercent = FilterMarginPercent(rightMarginWidthPercentVM.Value); } }); topMarginHeightPercentVM = new DoubleVM(a => { if (!topMarginHeightPercentVM.HasError) { currentItem.RawSettings.TopMarginHeightPercent = FilterMarginPercent(topMarginHeightPercentVM.Value); } }); bottomMarginHeightPercentVM = new DoubleVM(a => { if (!bottomMarginHeightPercentVM.HasError) { currentItem.RawSettings.BottomMarginHeightPercent = FilterMarginPercent(bottomMarginHeightPercentVM.Value); } }); maxHeightVM = new DoubleVM(a => { if (!maxHeightVM.HasError) { currentItem.RawSettings.MaxHeight = FilterLength(maxHeightVM.Value); } }); maxWidthVM = new DoubleVM(a => { if (!maxWidthVM.HasError) { currentItem.RawSettings.MaxWidth = FilterLength(maxWidthVM.Value); } }); zoomVM = new DoubleVM(a => { if (!zoomVM.HasError) { currentItem.RawSettings.Zoom = FilterZoom(zoomVM.Value); } }); intervalVM = new DefaultConverterVM <TimeSpan>(a => { if (!intervalVM.HasError) { currentItem.RawSettings.Interval = intervalVM.Value; } }); CurrentItem = Settings.FirstOrDefault(a => a.Id == backgroundImageSettingsService.LastSelectedId) ?? Settings[0]; }