public ReferenceCtrl(ISymbolInstanceReferenceLibrary libRef, IEditorService edSvc) { InitializeComponent(); _libRef = libRef; _edSvc = edSvc; TextBoxBinder.BindText(txtResourceId, _libRef, "ResourceId"); }
public override void Bind(IEditorService service) { _edsvc = service; _edsvc.RegisterCustomNotifier(this); try { _fsvc = (IFusionService)_edsvc.GetService((int)ServiceType.Fusion); if (service.CurrentConnection.ProviderName.ToUpper() == "MAESTRO.HTTP") { _baseUrl = service.GetCustomProperty("BaseUrl").ToString(); //NOXLATE if (!_baseUrl.EndsWith("/")) //NOXLATE { _baseUrl += "/"; //NOXLATE } } } catch { throw new NotSupportedException(Strings.IncompatibleConnection); } _edsvc.Saved += OnSaved; _flexLayout = (IApplicationDefinition)service.GetEditedResource(); TextBoxBinder.BindText(txtTemplateUrl, _flexLayout, "TemplateUrl"); //NOXLATE TextBoxBinder.BindText(txtTitle, _flexLayout, "Title"); //NOXLATE var templates = _fsvc.GetApplicationTemplates(); InitializeTemplateList(templates); GeneratePreviewUrl(); }
protected override void OnLoad(EventArgs e) { try { _init = true; TextBoxBinder.BindText(txtGeometry, _path, nameof(_path.Geometry)); symFillColor.Bind(_path, nameof(_path.FillColor)); symLineCap.Bind(_path, nameof(_path.LineCap)); symLineColor.Bind(_path, nameof(_path.LineColor)); symLineJoin.Bind(_path, nameof(_path.LineJoin)); symLineMiterLimit.Bind(_path, nameof(_path.LineMiterLimit)); symLineWeight.Bind(_path, nameof(_path.LineWeight)); symLineWeightScalable.Bind(_path, nameof(_path.LineWeightScalable)); IPathGraphic2 path2 = _path as IPathGraphic2; if (path2 != null) { symScaleX.Bind(path2, nameof(path2.ScaleX)); symScaleY.Bind(path2, nameof(path2.ScaleY)); } else { tabControl1.TabPages.Remove(TAB_ADVANCED); } } finally { _init = false; } }
public void Bind(IEditorService service) { _edSvc = service; _edSvc.RegisterCustomNotifier(this); TextBoxBinder.BindText(txtJoinName, _rel, nameof(_rel.Name)); TextBoxBinder.BindText(txtFeatureSource, _rel, nameof(_rel.ResourceId)); TextBoxBinder.BindText(txtSecondaryClass, _rel, nameof(_rel.AttributeClass)); //Init selected classes if (!string.IsNullOrEmpty(_rel.ResourceId)) { _secondaryClasses = _edSvc.CurrentConnection.FeatureService.GetClassNames(_rel.ResourceId, null); if (!string.IsNullOrEmpty(_rel.AttributeClass)) { foreach (var cls in _secondaryClasses) { if (cls.Equals(_rel.AttributeClass)) { _secondaryClass = cls; break; } } } } //CheckBoxBinder.BindChecked(chkForceOneToOne, _rel, "ForceOneToOne"); //CheckBoxBinder is failing me here, so let's do it manually chkForceOneToOne.Checked = _rel.ForceOneToOne; chkForceOneToOne.CheckedChanged += (s, e) => { _rel.ForceOneToOne = chkForceOneToOne.Checked; }; switch (_rel.RelateType) { case RelateTypeEnum.Association: rdAssociation.Checked = true; break; case RelateTypeEnum.Inner: rdInner.Checked = true; break; case RelateTypeEnum.LeftOuter: rdLeftOuter.Checked = true; break; case RelateTypeEnum.RightOuter: rdRightOuter.Checked = true; break; } _rel.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnRelationPropertyChanged, (eh) => _rel.PropertyChanged -= eh); foreach (var join in _rel.RelateProperty) { _propertyJoins.Add(join); } _propertyJoins.ListChanged += new ListChangedEventHandler(OnPropertyJoinListChanged); }
public CalculationSettings(IEditorService edSvc, ClassDefinition cls, IFeatureSource parent, ICalculatedProperty calc) : this() { _edSvc = edSvc; _cls = cls; _parent = parent; TextBoxBinder.BindText(txtExpression, calc, nameof(calc.Expression)); TextBoxBinder.BindText(txtName, calc, nameof(calc.Name)); }
protected override void OnLoad(EventArgs e) { try { _init = true; _frame = _text.Frame; chkTextFrame.Checked = (_frame != null); grpTextFrame.Enabled = chkTextFrame.Checked; if (_frame == null) { _frame = _sym.CreateFrame(); } TextBoxBinder.BindText(txtContent, _text, nameof(_text.Content)); symAlignmentHorizontal.Bind(_text, nameof(_text.HorizontalAlignment)); symAlignmentJustification.Bind(_text, nameof(_text.Justification)); symAlignmentVertical.Bind(_text, nameof(_text.VerticalAlignment)); symAngle.Bind(_text, nameof(_text.Angle)); symFontBold.Bind(_text, nameof(_text.Bold)); symFontFamily.Bind(_text, nameof(_text.FontName)); symFontItalic.Bind(_text, nameof(_text.Italic)); symFontUnderlined.Bind(_text, nameof(_text.Underlined)); symGhostColor.Bind(_text, nameof(_text.GhostColor)); symHeight.Bind(_text, nameof(_text.Height)); symHeightScalable.Bind(_text, nameof(_text.HeightScalable)); symLineSpacing.Bind(_text, nameof(_text.LineSpacing)); symPositionX.Bind(_text, nameof(_text.PositionX)); symPositionY.Bind(_text, nameof(_text.PositionY)); symTextColor.Bind(_text, nameof(_text.TextColor)); symFillColor.Bind(_frame, nameof(_frame.FillColor)); symLineColor.Bind(_frame, nameof(_frame.LineColor)); symOffsetX.Bind(_frame, nameof(_frame.OffsetX)); symOffsetY.Bind(_frame, nameof(_frame.OffsetY)); var text2 = _text as ITextGraphic2; if (text2 != null) { symOverlined.Bind(text2, nameof(text2.Overlined)); symObliqueAngle.Bind(text2, nameof(text2.ObliqueAngle)); symTrackSpacing.Bind(text2, nameof(text2.TrackSpacing)); symMarkup.Bind(text2, nameof(text2.Markup)); } else { tabControl1.TabPages.Remove(TAB_ADVANCED); } } finally { _init = false; } }
public override void Bind(IEditorService service) { service.RegisterCustomNotifier(this); var sym = (ISymbolDefinitionBase)service.GetEditedResource(); TextBoxBinder.BindText(txtName, sym, "Name"); TextBoxBinder.BindText(txtDescription, sym, "Description"); }
public LayerPropertiesCtrl(IBaseMapLayer layer, IEditorService edSvc) : this() { layer.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnLayerChanged, (eh) => layer.PropertyChanged -= eh); _edSvc = edSvc; TextBoxBinder.BindText(txtResourceId, layer, nameof(layer.ResourceId)); TextBoxBinder.BindText(txtName, layer, nameof(layer.Name)); TextBoxBinder.BindText(txtLegendLabel, layer, nameof(layer.LegendLabel)); }
public override void Bind(IEditorService service) { _service = service; _service.RegisterCustomNotifier(this); var lp = _service.GetEditedResource() as ILoadProcedure; var dlp = lp.SubType as IDwfLoadProcedure; TextBoxBinder.BindText(txtCoordinateSystem, dlp, "CoordinateSystem"); }
public override void Bind(IEditorService service) { _service = service; _service.RegisterCustomNotifier(this); var lp = service.GetEditedResource() as ILoadProcedure; var slp = lp.SubType as ISqliteLoadProcedure; TextBoxBinder.BindText(txtCoordinateSystem, slp, "CoordinateSystem"); NumericBinder.BindValueChanged(numGeneralizePercentage, slp, "Generalization"); }
public override void Bind(IEditorService service) { _edSvc = service; _edSvc.RegisterCustomNotifier(this); _dws = (IDrawingSource)service.GetEditedResource(); resDataCtrl.Init(service); resDataCtrl.DataListChanged += new EventHandler(OnResourceDataListChanged); resDataCtrl.ResourceDataMarked += new ResourceDataSelectionEventHandler(OnResourceDataMarked); TextBoxBinder.BindText(txtSourceCs, _dws, nameof(_dws.CoordinateSpace)); MarkSelected(); }
/// <summary> /// Sets the initial state of this editor and sets up any databinding /// within such that user interface changes will propagate back to the /// model. /// </summary> /// <param name="service"></param> public override void Bind(IEditorService service) { service.RegisterCustomNotifier(this); _edSvc = service; _compSym = (ICompoundSymbolDefinition)_edSvc.GetEditedResource(); _compSym.PurgeSimpleSymbolAttributes(); TextBoxBinder.BindText(txtName, _compSym, "Name"); TextBoxBinder.BindText(txtDescription, _compSym, "Description"); foreach (var symRef in _compSym.SimpleSymbol) { AddSymbolReference(symRef); } }
public override void Bind(IEditorService service) { _service = service; var lp = service.GetEditedResource() as ILoadProcedure; Debug.Assert(lp != null); service.RegisterCustomNotifier(this); var shplp = lp.SubType as IShpLoadProcedure; TextBoxBinder.BindText(txtCoordinateSystem, shplp, "CoordinateSystem"); NumericBinder.BindValueChanged(numGeneralizePercentage, shplp, "Generalization"); CheckBoxBinder.BindChecked(chkConvertToSdf, shplp, "ConvertToSdf"); }
public override void Bind(IEditorService service) { _service = service; var lp = service.GetEditedResource() as ILoadProcedure; Debug.Assert(lp != null); service.RegisterCustomNotifier(this); var sdflp = lp.SubType as ISdfLoadProcedure; TextBoxBinder.BindText(txtCoordinateSystem, sdflp, "CoordinateSystem"); NumericBinder.BindValueChanged(numGeneralizePercentage, sdflp, "Generalization"); cmbSdfConflictStrategy.DataSource = Enum.GetValues(typeof(SdfKeyTreatmentType)); ComboBoxBinder.BindSelectedIndexChanged(cmbSdfConflictStrategy, "SelectedItem", sdflp, "SdfKeyTreatment"); }
public override void Bind(IEditorService service) { _edsvc = service; _edsvc.RegisterCustomNotifier(this); var res = service.GetEditedResource() as ILayerDefinition; Debug.Assert(res != null); _rl = res.SubLayer as IRasterLayerDefinition; Debug.Assert(_rl != null); TextBoxBinder.BindText(txtFeatureSource, _rl, nameof(_rl.ResourceId)); TextBoxBinder.BindText(txtFeatureClass, _rl, nameof(_rl.FeatureName)); TextBoxBinder.BindText(txtGeometry, _rl, nameof(_rl.Geometry)); _rl.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnRasterLayerPropertyChanged, (eh) => _rl.PropertyChanged -= eh); }
public override void Bind(IEditorService service) { service.RegisterCustomNotifier(this); _service = service; _loadProc = _service.GetEditedResource() as ILoadProcedure; _fProc = _loadProc.SubType; TextBoxBinder.BindText(txtTargetRoot, _fProc, "RootPath"); CheckBoxBinder.BindChecked(chkCreateFeatureSources, _fProc, "GenerateSpatialDataSources"); CheckBoxBinder.BindChecked(chkCreateLayers, _fProc, "GenerateLayers"); TextBoxBinder.BindText(txtFeatureSourceRoot, _fProc, "SpatialDataSourcesPath"); TextBoxBinder.BindText(txtFeatureFolderName, _fProc, "SpatialDataSourcesFolder"); TextBoxBinder.BindText(txtLayerRoot, _fProc, "LayersPath"); TextBoxBinder.BindText(txtLayerFolderName, _fProc, "LayersFolder"); _fProc.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnLoadProcedurePropertyChanged, (eh) => _fProc.PropertyChanged -= eh); }
public GroupPropertiesCtrl(ITileSetDefinition map, IBaseMapGroup group) : this() { _init = true; try { _mdf = map; _el = group; group.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnGroupChanged, (eh) => group.PropertyChanged -= eh); txtName.Text = group.Name; TextBoxBinder.BindText(txtLegendLabel, group, nameof(group.LegendLabel)); } finally { _init = false; } }
internal void Bind(ISearchCommand searchCommandType, IEditorService service) { cmbTargetFrame.DataSource = Enum.GetValues(typeof(TargetType)); _init = true; Bind(service); _cmd = searchCommandType; _wl = (IWebLayout)_edsvc.GetEditedResource(); var wlMap = _wl.Map; wlMap.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebMapLayoutPropertyChanged, (eh) => wlMap.PropertyChanged -= eh); LoadLayers(); if (!string.IsNullOrEmpty(_cmd.Layer)) { foreach (var lyr in _layers) { if (lyr.Name == _cmd.Layer) { txtLayer.Text = _cmd.Layer; txtLayer.Tag = lyr.ResourceId; } } } TextBoxBinder.BindText(txtFrame, _cmd, nameof(_cmd.TargetFrame)); ComboBoxBinder.BindSelectedIndexChanged(cmbTargetFrame, nameof(cmbTargetFrame.SelectedItem), _cmd, nameof(_cmd.Target)); TextBoxBinder.BindText(txtLayer, _cmd, nameof(_cmd.Layer)); TextBoxBinder.BindText(txtFilter, _cmd, nameof(_cmd.Filter)); TextBoxBinder.BindText(txtPrompt, _cmd, nameof(_cmd.Prompt)); NumericBinder.BindValueChanged(numLimit, _cmd, nameof(_cmd.MatchLimit)); UpdateColumns(); foreach (var col in _cmd.ResultColumns.Column) { _columns.Add(col); } grdOutputColumns.DataSource = _columns; _columns.AddingNew += OnAddingNewColumn; _columns.ListChanged += OnColumnsChanged; }
internal void Bind(IInvokeUrlCommand invokeUrlCommandType, IEditorService service) { cmbTargetFrame.DataSource = Enum.GetValues(typeof(TargetType)); Bind(service); service.RegisterCustomNotifier(this); TextBoxBinder.BindText(txtUrl, invokeUrlCommandType, nameof(invokeUrlCommandType.URL)); TextBoxBinder.BindText(txtFrame, invokeUrlCommandType, nameof(invokeUrlCommandType.TargetFrame)); ComboBoxBinder.BindSelectedIndexChanged(cmbTargetFrame, nameof(cmbTargetFrame.SelectedItem), invokeUrlCommandType, nameof(invokeUrlCommandType.Target)); CheckBoxBinder.BindChecked(chkDisableIfEmpty, invokeUrlCommandType, nameof(invokeUrlCommandType.DisableIfSelectionEmpty)); foreach (var p in invokeUrlCommandType.AdditionalParameter) { _params.Add(p); } grdParameters.DataSource = _params; _params.ListChanged += OnParamsListChanged; _params.AddingNew += OnAddingNew; lstLayers.DataSource = invokeUrlCommandType.LayerSet.Layer; invokeUrlCommandType.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnCommandPropertyChanged, (eh) => invokeUrlCommandType.PropertyChanged -= eh); _cmd = invokeUrlCommandType; }
internal void Bind(IInvokeScriptCommand invokeScriptCommandType, IEditorService service) { _edsvc = service; TextBoxBinder.BindText(txtScript, invokeScriptCommandType, "Script"); }
public override void Bind(IEditorService service) { _edsvc = service; _edsvc.RegisterCustomNotifier(this); _edsvc.Saved += OnSaved; _wl = (IWebLayout)_edsvc.GetEditedResource(); GeneratePreviewUrl(); _view = _wl.Map.InitialView; if (_view == null) { _view = _wl.CreateDefaultView(); chkCustomView.Checked = false; } else { chkCustomView.Checked = true; } CheckInitialView(); var wl2 = _wl as IWebLayout2; if (wl2 != null) { CheckBoxBinder.BindChecked(chkPingServer, wl2, nameof(wl2.EnablePingServer)); } else { chkPingServer.Visible = false; } TextBoxBinder.BindText(numX, _view, nameof(_view.CenterX)); TextBoxBinder.BindText(numY, _view, nameof(_view.CenterY)); TextBoxBinder.BindText(numScale, _view, nameof(_view.Scale)); TextBoxBinder.BindText(txtBrowserTitle, _wl, nameof(_wl.Title)); TextBoxBinder.BindText(txtMapDefinition, _wl.Map, nameof(_wl.Map.ResourceId)); TextBoxBinder.BindText(txtInitialTaskPaneUrl, _wl.TaskPane, nameof(_wl.TaskPane.InitialTask)); CheckBoxBinder.BindChecked(chkContextMenu, _wl.ContextMenu, nameof(_wl.ContextMenu.Visible)); CheckBoxBinder.BindChecked(chkLegend, _wl.InformationPane, nameof(_wl.InformationPane.LegendVisible)); CheckBoxBinder.BindChecked(chkProperties, _wl.InformationPane, nameof(_wl.InformationPane.PropertiesVisible)); CheckBoxBinder.BindChecked(chkStatusBar, _wl.StatusBar, nameof(_wl.StatusBar.Visible)); CheckBoxBinder.BindChecked(chkTaskPane, _wl.TaskPane, nameof(_wl.TaskPane.Visible)); CheckBoxBinder.BindChecked(chkTaskBar, _wl.TaskPane.TaskBar, nameof(_wl.TaskPane.TaskBar.Visible)); CheckBoxBinder.BindChecked(chkToolbar, _wl.ToolBar, nameof(_wl.ToolBar.Visible)); CheckBoxBinder.BindChecked(chkZoomControl, _wl.ZoomControl, nameof(_wl.ZoomControl.Visible)); ComboBoxBinder.BindSelectedIndexChanged(cmbHyperlinkTarget, nameof(cmbHyperlinkTarget.SelectedItem), _wl.Map, nameof(_wl.Map.HyperlinkTarget)); TextBoxBinder.BindText(txtHyperlinkFrame, _wl.Map, nameof(_wl.Map.HyperlinkTargetFrame)); TextBoxBinder.BindText(numInfoPaneWidth, _wl.InformationPane, nameof(_wl.InformationPane.Width)); TextBoxBinder.BindText(numTaskPaneWidth, _wl.TaskPane, nameof(_wl.TaskPane.Width)); _wl.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => _wl.PropertyChanged -= eh); _view.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => _view.PropertyChanged -= eh); var wlMap = _wl.Map; wlMap.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => wlMap.PropertyChanged -= eh); var ctx = _wl.ContextMenu; ctx.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => ctx.PropertyChanged -= eh); var info = _wl.InformationPane; info.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => info.PropertyChanged -= eh); var stat = _wl.StatusBar; stat.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => stat.PropertyChanged -= eh); var tpane = _wl.TaskPane; tpane.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => tpane.PropertyChanged -= eh); var tbar = tpane.TaskBar; tbar.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => tbar.PropertyChanged -= eh); var toolbar = _wl.ToolBar; toolbar.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => toolbar.PropertyChanged -= eh); var zoom = _wl.ZoomControl; zoom.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnWebLayoutPropertyChanged, (eh) => zoom.PropertyChanged -= eh); }
/// <summary> /// Initializes the editor /// </summary> /// <param name="widget"></param> /// <param name="context"></param> /// <param name="edsvc"></param> public void Setup(IWidget widget, FlexibleLayoutEditorContext context, IEditorService edsvc) { TextBoxBinder.BindText(txtName, widget, nameof(widget.Name)); TextBoxBinder.BindText(txtType, widget, nameof(widget.Type)); TextBoxBinder.BindText(txtLocation, widget, nameof(widget.Location)); }
public override void Bind(IEditorService service) { cmbBackgroundColor.ResetColors(); _service = service; _service.RegisterCustomNotifier(this); _map = (IMapDefinition)service.GetEditedResource(); var mdf3 = _map as IMapDefinition3; if (mdf3 == null) { pnlTileSource.Visible = false; } else { switch (mdf3.TileSourceType) { case TileSourceType.External: rdExternal.Checked = true; break; case TileSourceType.Inline: rdInline.Checked = true; break; default: //Default to none rdNone.Checked = true; break; } } var bmeta = new Binding("Text", _map, "Metadata"); bmeta.Parse += (sender, e) => { e.Value = META_START + e.Value + META_END; }; bmeta.Format += (sender, e) => { if (e.Value != null) { var str = e.Value.ToString(); if (str.StartsWith(META_START) && str.EndsWith(META_END)) { e.Value = str.Substring(META_START.Length, str.Length - (META_START.Length + META_END.Length)); } } }; TextBoxBinder.BindText(txtDescription, bmeta); TextBoxBinder.BindText(txtCoordinateSystem, _map, "CoordinateSystem"); //ColorComboBox requires custom databinding cmbBackgroundColor.CurrentColor = _map.BackgroundColor; cmbBackgroundColor.SelectedIndexChanged += (sender, e) => { _map.BackgroundColor = cmbBackgroundColor.CurrentColor; }; PropertyChangedEventHandler mapChanged = (sender, e) => { if (e.PropertyName == "BackgroundColor") { cmbBackgroundColor.CurrentColor = _map.BackgroundColor; } else if (e.PropertyName == "Extents") { UpdateExtentsFromMap(); } }; _map.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(mapChanged, (eh) => _map.PropertyChanged -= eh); txtLowerX.Text = _map.Extents.MinX.ToString(CultureInfo.InvariantCulture); txtLowerY.Text = _map.Extents.MinY.ToString(CultureInfo.InvariantCulture); txtUpperX.Text = _map.Extents.MaxX.ToString(CultureInfo.InvariantCulture); txtUpperY.Text = _map.Extents.MaxY.ToString(CultureInfo.InvariantCulture); txtLowerX.TextChanged += (s, e) => { if (_updatingExtents) { return; } if (txtLowerX.Text.EndsWith(".")) //Maybe typing in decimals atm { return; } double d; if (double.TryParse(txtLowerX.Text, out d)) { _map.Extents.MinX = d; } }; txtLowerY.TextChanged += (s, e) => { if (_updatingExtents) { return; } if (txtLowerY.Text.EndsWith(".")) //Maybe typing in decimals atm { return; } double d; if (double.TryParse(txtLowerY.Text, out d)) { _map.Extents.MinY = d; } }; txtUpperX.TextChanged += (s, e) => { if (_updatingExtents) { return; } if (txtUpperX.Text.EndsWith(".")) //Maybe typing in decimals atm { return; } double d; if (double.TryParse(txtUpperX.Text, out d)) { _map.Extents.MaxX = d; } }; txtUpperY.TextChanged += (s, e) => { if (_updatingExtents) { return; } if (txtUpperY.Text.EndsWith(".")) //Maybe typing in decimals atm { return; } double d; if (double.TryParse(txtUpperY.Text, out d)) { _map.Extents.MaxY = d; } }; PropertyChangedEventHandler extChange = (sender, e) => { UpdateExtentsFromMap(); OnResourceChanged(); }; var ext = _map.Extents; ext.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(extChange, (eh) => ext.PropertyChanged -= eh); }
public void Bind(IEditorService service) { _service = service; _service.RegisterCustomNotifier(this); var lyr = service.GetEditedResource() as ILayerDefinition; Debug.Assert(lyr != null); _dlayer = lyr.SubLayer as IDrawingLayerDefinition; Debug.Assert(_dlayer != null); TextBoxBinder.BindText(txtDrawingSource, _dlayer, nameof(_dlayer.ResourceId)); cmbSheet.DisplayMember = "Title"; //NOXLATE cmbSheet.ValueMember = "Name"; //NOXLATE cmbSheet.DataSource = _sheets; PopulateSheets(); cmbSheet_SelectedIndexChanged(this, EventArgs.Empty); ComboBoxBinder.BindSelectedIndexChanged(cmbSheet, nameof(cmbSheet.SelectedValue), _dlayer, nameof(_dlayer.Sheet)); var minBinding = new Binding(nameof(txtMinScale.Text), _dlayer, nameof(_dlayer.MinScale)); var maxBinding = new Binding(nameof(txtMaxScale.Text), _dlayer, nameof(_dlayer.MaxScale)); minBinding.Format += (sender, ce) => { if (ce.DesiredType != typeof(string)) { return; } ce.Value = Convert.ToDouble(ce.Value); }; minBinding.Parse += (sender, ce) => { if (ce.DesiredType != typeof(double)) { return; } double val; if (!double.TryParse(ce.Value.ToString(), out val)) { return; } ce.Value = val; }; maxBinding.Format += (sender, ce) => { if (ce.DesiredType != typeof(string)) { return; } ce.Value = Convert.ToDouble(ce.Value); }; maxBinding.Parse += (sender, ce) => { if (ce.DesiredType != typeof(double)) { return; } double val; if (!double.TryParse(ce.Value.ToString(), out val)) { return; } ce.Value = val; }; TextBoxBinder.BindText(txtMinScale, minBinding); TextBoxBinder.BindText(txtMaxScale, maxBinding); //This is not the root object so no change listeners have been subscribed _dlayer.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(OnDrawingLayerPropertyChanged, (eh) => _dlayer.PropertyChanged -= eh); }