public override void Bind(IEditorService service) { _edSvc = service; _edSvc.RegisterCustomNotifier(this); _wm = (IWatermarkDefinition)service.GetEditedResource(); NumericBinder.BindValueChanged(numRotation, _wm.Appearance, "Rotation"); NumericBinder.BindValueChanged(numTransparency, _wm.Appearance, "Transparency"); if (_wm.Position.Type == PositionType.Tile) _tile = (ITilePosition)_wm.Position; else if (_wm.Position.Type == PositionType.XY) _xy = (IXYPosition)_wm.Position; if (_tile == null) { _tile = _wm.CreateTilePosition(); rdXY.Checked = true; } else if (_xy == null) { _xy = _wm.CreateXYPosition(); rdTile.Checked = true; } }
public XYPositionEditor(IXYPosition pos, IEditorService service) { InitializeComponent(); _pos = pos; _edSvc = service; try { _init = true; cmbHorizontalAlignment.DataSource = Enum.GetValues(typeof(HorizontalAlignmentType)); cmbVerticalAlignment.DataSource = Enum.GetValues(typeof(VerticalAlignmentType)); cmbHorizontalUnits.DataSource = Enum.GetValues(typeof(UnitType)); cmbVerticalUnits.DataSource = Enum.GetValues(typeof(UnitType)); cmbVerticalAlignment.SelectedItem = _pos.YPosition.Alignment; cmbVerticalUnits.SelectedItem = _pos.YPosition.Unit; numVerticalOffset.Value = Convert.ToDecimal(_pos.YPosition.Offset); cmbHorizontalUnits.SelectedItem = _pos.XPosition.Unit; cmbHorizontalAlignment.SelectedItem = _pos.XPosition.Alignment; numHorizontalOffset.Value = Convert.ToDecimal(_pos.XPosition.Offset); } finally { _init = false; } }
public WatermarkInstanceEditor(IEditorService service, IWatermark watermark) { InitializeComponent(); _edSvc = service; _watermark = watermark; try { _init = true; cmbUsage.DataSource = Enum.GetValues(typeof(UsageType)); cmbUsage.SelectedItem = _watermark.Usage; txtResourceId.Text = _watermark.ResourceId; txtName.Text = _watermark.Name; _ovAppearance = _watermark.AppearanceOverride; chkOverrideAppearance.Checked = (_ovAppearance != null); chkOverridePosition.Checked = (_watermark.PositionOverride != null); if (_ovAppearance == null) _ovAppearance = _watermark.CreateDefaultAppearance(); //Init appearance numOvRotation.Value = Convert.ToDecimal(_ovAppearance.Rotation); numOvTransparency.Value = Convert.ToDecimal(_ovAppearance.Transparency); if (_watermark.PositionOverride == null) { _ovTilePosition = _watermark.CreateDefaultTilePosition(); _ovXyPosition = _watermark.CreateDefaultXYPosition(); } else { if (_watermark.PositionOverride.Type == PositionType.Tile) { _ovXyPosition = _watermark.CreateDefaultXYPosition(); _ovTilePosition = (ITilePosition)_watermark.PositionOverride; rdOvTilePos.Checked = true; } else { _ovXyPosition = (IXYPosition)_watermark.PositionOverride; _ovTilePosition = _watermark.CreateDefaultTilePosition(); rdOvPosXY.Checked = true; } TilePos_CheckedChanged(this, EventArgs.Empty); } Debug.Assert(_ovTilePosition != null); Debug.Assert(_ovXyPosition != null); } finally { _init = false; } }