protected override sealed PropertyBasedSaveConfigWidget OnCreateSaveConfigWidgetT() { PropertyCollection props1 = CreateSavePropertyCollection(); PropertyCollection props2 = props1.Clone(); PropertyCollection props3 = props1.Clone(); ControlInfo configUI1 = CreateSaveConfigUI(props2); ControlInfo configUI2 = configUI1.Clone(); PropertyBasedSaveConfigWidget widget = new PropertyBasedSaveConfigWidget(this, props3, configUI2); return(widget); }
protected override PropertyBasedSaveConfigToken GetSaveConfigTokenFromSerializablePortionT(object portion) { PropertyCollection props1 = CreateSavePropertyCollection(); PropertyCollection props2 = props1.Clone(); Pair <string, object>[] nameValues = (Pair <string, object>[])portion; foreach (Pair <string, object> nameValue in nameValues) { Property property = props2[nameValue.First]; if (property.ReadOnly) { property.ReadOnly = false; property.Value = nameValue.Second; property.ReadOnly = true; } else { property.Value = nameValue.Second; } } PropertyBasedSaveConfigToken newToken = CreateDefaultSaveConfigToken(); newToken.Properties.CopyCompatibleValuesFrom(props2, true); return(newToken); }
public PropertyCollection CreateSavePropertyCollection() { PropertyCollection props = OnCreateSavePropertyCollection(); // Perform any necessary validation here. Right now there's nothing special to do. return(props.Clone()); }
protected override sealed PropertyBasedSaveConfigToken OnCreateDefaultSaveConfigTokenT() { PropertyCollection props = CreateSavePropertyCollection(); PropertyCollection props1 = props.Clone(); PropertyBasedSaveConfigToken token = new PropertyBasedSaveConfigToken(props1); return(token); }
public ControlInfo CreateConfigUI(PropertyCollection props) { PropertyCollection props2 = props.Clone(); using (props2.__Internal_BeginEventAddMoratorium()) { ControlInfo configUI1 = OnCreateConfigUI(props2); ControlInfo configUI2 = configUI1.Clone(); return(configUI2); } }
public PropertyBasedSaveConfigWidget(PropertyBasedFileType fileType, PropertyCollection props, ControlInfo configUI) : base(fileType) { this.originalProps = props.Clone(); this.configUI = configUI.Clone(); // Make sure that the properties in props and configUI are not the same objects foreach (Property property in props) { PropertyControlInfo pci = this.configUI.FindControlForPropertyName(property.Name); if (pci != null) { if (object.ReferenceEquals(property, pci.Property)) { throw new ArgumentException("Property references in propertyCollection must not be the same as those in configUI"); } } } SuspendLayout(); this.configUIControl = (Control)this.configUI.CreateConcreteControl(this); this.configUIControl.SuspendLayout(); this.configUIControl.TabIndex = 0; // Set up data binding foreach (Property property in this.originalProps) { PropertyControlInfo pci = this.configUI.FindControlForPropertyName(property.Name); if (pci == null) { throw new InvalidOperationException("Every property must have a control associated with it"); } else { Property controlsProperty = pci.Property; // ASSUMPTION: We assume that the concrete WinForms Control holds a reference to // the same Property instance as the ControlInfo it was created from. controlsProperty.ValueChanged += ControlsProperty_ValueChanged; } } this.Controls.Add(this.configUIControl); this.configUIControl.ResumeLayout(false); ResumeLayout(false); PerformLayout(); }
public override sealed EffectConfigDialog CreateConfigDialog() { PropertyCollection props1 = CreatePropertyCollection(); PropertyCollection props2 = props1.Clone(); PropertyCollection props3 = props1.Clone(); ControlInfo configUI1 = CreateConfigUI(props2); ControlInfo configUI2 = configUI1.Clone(); PropertyCollection windowProps = PropertyBasedEffectConfigDialog.CreateWindowProperties(); windowProps[ControlInfoPropertyNames.WindowTitle].Value = this.Name; OnCustomizeConfigUIWindowProperties(windowProps); PropertyCollection windowProps2 = windowProps.Clone(); PropertyBasedEffectConfigDialog pbecd = new PropertyBasedEffectConfigDialog(props3, configUI2, windowProps2); pbecd.Icon = GetConfigDialogIcon(); return(pbecd); }
/// <summary> /// Deep clone of this instance. /// </summary> /// <returns>A new copy of this Material.</returns> public virtual Material Clone() { var material = (Material)MemberwiseClone(); if (Properties != null) { material.Properties = Properties.Clone(); // Duplicate texture stacks foreach (var property in Properties) { if (property.Value is MaterialTextureStack) { material.Properties[property.Key] = ((MaterialTextureStack)(property.Value)).Clone(); } } } return(material); }
public PropertyBasedEffectConfigDialog(PropertyCollection propertyCollection, ControlInfo configUI, PropertyCollection windowProperties) : base(propertyCollection) { this.windowProperties = windowProperties.Clone(); this.configUI = (ControlInfo)configUI.Clone(); // Make sure that the properties in props and configUI are not the same objects foreach (Property property in propertyCollection) { PropertyControlInfo pci = this.configUI.FindControlForPropertyName(property.Name); if (pci != null && object.ReferenceEquals(property, pci.Property)) { throw new ArgumentException("Property references in propertyCollection must not be the same as those in configUI"); } } SuspendLayout(); this.okButton = new Button(); this.cancelButton = new Button(); this.cancelButton.Name = "cancelButton"; this.configUIPanel = new Panel(); this.configUIControl = (Control)this.configUI.CreateConcreteControl(this); this.configUIControl.Location = new Point(0, 0); this.configUIPanel.SuspendLayout(); this.configUIControl.SuspendLayout(); this.okButton.Name = "okButton"; this.okButton.AutoSize = true; this.okButton.Click += OkButton_Click; this.okButton.Text = PdnResources.GetString("Form.OkButton.Text"); this.okButton.FlatStyle = FlatStyle.System; this.cancelButton.AutoSize = true; this.cancelButton.Click += CancelButton_Click; this.cancelButton.Text = PdnResources.GetString("Form.CancelButton.Text"); this.cancelButton.FlatStyle = FlatStyle.System; this.configUIPanel.Name = "configUIPanel"; this.configUIPanel.TabStop = false; this.configUIPanel.Controls.Add(this.configUIControl); this.configUIControl.Name = "configUIControl"; this.etchedLine = new EtchedLine(); this.etchedLine.Name = "etchedLine"; Controls.AddRange( new Control[] { this.okButton, this.cancelButton, this.etchedLine, this.configUIPanel }); int tabIndex = 0; this.configUIControl.TabIndex = tabIndex; ++tabIndex; // Set up data binding foreach (Property property in this.properties) { PropertyControlInfo pci = this.configUI.FindControlForPropertyName(property.Name); if (pci == null) { throw new InvalidOperationException("Every property must have a control associated with it"); } else { Property controlsProperty = pci.Property; // ASSUMPTION: We assume that the concrete WinForms Control holds a reference to // the same Property instance as the ControlInfo it was created from. controlsProperty.ValueChanged += ControlsProperty_ValueChanged; } } this.okButton.TabIndex = tabIndex; ++tabIndex; this.cancelButton.TabIndex = tabIndex; ++tabIndex; AcceptButton = this.okButton; CancelButton = this.cancelButton; bool isSizable = (bool)this.windowProperties[ControlInfoPropertyNames.WindowIsSizable].Value; FormBorderStyle = isSizable ? FormBorderStyle.Sizable : FormBorderStyle.FixedDialog; Text = (string)this.windowProperties[ControlInfoPropertyNames.WindowTitle].Value; ClientSize = new Size(UI.ScaleWidth(defaultClientWidth96Dpi), UI.ScaleHeight(defaultClientHeight96Dpi)); this.configUIControl.ResumeLayout(false); this.configUIPanel.ResumeLayout(false); ResumeLayout(false); PerformLayout(); }
internal ControlInfo(PropertyCollection controlProperties) { this.controlProperties = controlProperties.Clone(); }
private void Initialize(PropertyCollection propertyCollection) { this.Properties = propertyCollection.Clone(); }
public PropertyBasedSaveConfigToken(PropertyCollection props) { this.properties = props.Clone(); }