/// <summary> /// When overridden in a derived class, registers the <see cref="T:System.Web.UI.ScriptDescriptor"/> objects for the control. /// </summary> /// <param name="targetControl">The server control to which the extender is associated.</param> /// <returns> /// An enumeration of <see cref="T:System.Web.UI.ScriptDescriptor"/> objects. /// </returns> protected override IEnumerable <ScriptDescriptor> GetScriptDescriptors(Control targetControl) { var descriptor = new ScriptBehaviorDescriptor("Velyo.Google.Maps.GroundBehavior", targetControl.ClientID); // properties descriptor.AddProperty("clickable", Clickable); descriptor.AddProperty("name", UniqueID); if (_bounds != null) { descriptor.AddProperty("bounds", _bounds.ToScriptData()); } if (Url != null) { descriptor.AddProperty("url", Url); } // events if (Click != null) { descriptor.AddEvent("click", "Velyo.Google.Maps.GroundBehavior.raiseServerClick"); } else if (OnClientClick != null) { descriptor.AddEvent("click", OnClientClick); } yield return(descriptor); }
protected override IEnumerable <System.Web.UI.ScriptDescriptor> GetScriptDescriptors(System.Web.UI.Control targetControl) { ScriptBehaviorDescriptor descriptor = new ScriptBehaviorDescriptor(this.GetType().FullName, targetControl.ClientID); // Make sure this ExtenderControl's ID is pushed down to the client so we can get ahold of it from within JavaScript using $find descriptor.AddProperty("id", this.ClientID); PropertyDescriptorCollection props = TypeDescriptor.GetProperties(this); foreach (PropertyDescriptor prop in props) { ExtenderControlPropertyAttribute propAttr = prop.Attributes[typeof(ExtenderControlPropertyAttribute)] as ExtenderControlPropertyAttribute; if (propAttr != null) { object value = prop.GetValue(this); string name = propAttr.Name ?? prop.Name; if (value != null) { descriptor.AddProperty(name, value); } } ExtenderControlComponentPropertyAttribute compAttr = prop.Attributes[typeof(ExtenderControlComponentPropertyAttribute)] as ExtenderControlComponentPropertyAttribute; if (compAttr != null) { string name = compAttr.Name ?? prop.Name; string controlId = prop.GetValue(this) as string; Control ctrl = this.ResolveControlByID(controlId); if (ctrl != null) { controlId = ctrl.ClientID; } if (!string.IsNullOrEmpty(controlId)) { descriptor.AddComponentProperty(name, controlId); } } ExtenderControlEventAttribute eventAttr = prop.Attributes[typeof(ExtenderControlEventAttribute)] as ExtenderControlEventAttribute; if (eventAttr != null) { string name = eventAttr.Name ?? prop.Name; string handler = prop.GetValue(this) as string; if (handler != null) { descriptor.AddEvent(name, handler); } } } yield return(descriptor); }
/// <summary> /// When overridden in a derived class, registers the <see cref="T:System.Web.UI.ScriptDescriptor"/> objects for the control. /// </summary> /// <param name="targetControl">The server control to which the extender is associated.</param> /// <returns> /// An enumeration of <see cref="T:System.Web.UI.ScriptDescriptor"/> objects. /// </returns> protected override IEnumerable <ScriptDescriptor> GetScriptDescriptors(Control targetControl) { var descriptor = new ScriptBehaviorDescriptor("Velyo.Google.Maps.RectangleBehavior", targetControl.ClientID); // properties descriptor.AddProperty("bounds", Bounds.ToScriptData()); descriptor.AddProperty("clickable", Clickable); descriptor.AddProperty("fillColor", ColorTranslator.ToHtml(FillColor)); descriptor.AddProperty("fillOpacity", FillOpacity); descriptor.AddProperty("geodesic", Geodesic); descriptor.AddProperty("name", UniqueID); descriptor.AddProperty("strokeColor", ColorTranslator.ToHtml(StrokeColor)); descriptor.AddProperty("strokeOpacity", StrokeOpacity); descriptor.AddProperty("strokeWeight", StrokeWeight); descriptor.AddProperty("zIndex", ZIndex); // events if (Click != null) { descriptor.AddEvent("click", "Velyo.Google.Maps.RectangleBehavior.raiseServerClick"); } else if (OnClientClick != null) { descriptor.AddEvent("click", OnClientClick); } if (DoubleClick != null) { descriptor.AddEvent("doubleClick", "Velyo.Google.Maps.RectangleBehavior.raiseServerDoubleClick"); } else if (OnClientDoubleClick != null) { descriptor.AddEvent("doubleClick", OnClientDoubleClick); } if (MouseDown != null) { descriptor.AddEvent("mouseDown", "Velyo.Google.Maps.RectangleBehavior.raiseServerMouseDown"); } else if (OnClientMouseDown != null) { descriptor.AddEvent("mouseDown", OnClientMouseDown); } if (MouseMove != null) { descriptor.AddEvent("mouseMove", "Velyo.Google.Maps.RectangleBehavior.raiseServerMouseMove"); } else if (OnClientMouseMove != null) { descriptor.AddEvent("mouseMove", OnClientMouseMove); } if (MouseOut != null) { descriptor.AddEvent("mouseOut", "Velyo.Google.Maps.RectangleBehavior.raiseServerMouseOut"); } else if (OnClientMouseMove != null) { descriptor.AddEvent("mouseOut", OnClientMouseOut); } if (MouseOver != null) { descriptor.AddEvent("mouseOver", "Velyo.Google.Maps.RectangleBehavior.raiseServerMouseOver"); } else if (OnClientMouseOver != null) { descriptor.AddEvent("mouseOver", OnClientMouseOver); } if (MouseUp != null) { descriptor.AddEvent("mouseUp", "Velyo.Google.Maps.RectangleBehavior.raiseServerMouseUp"); } else if (OnClientMouseUp != null) { descriptor.AddEvent("mouseUp", OnClientMouseUp); } if (RightClick != null) { descriptor.AddEvent("rightClick", "Velyo.Google.Maps.RectangleBehavior.raiseServerRightClick"); } else if (OnClientRightClick != null) { descriptor.AddEvent("rightClick", OnClientRightClick); } yield return(descriptor); }
// TODO ///// <summary> ///// Array of intermediate waypoints. Directions will be calculated from the origin to the destination by way of each waypoint in this array. Optional. ///// </summary> ///// <value>The waypoints.</value> //public DirectionsWaypoint[] Waypoints { get; set; } /// <summary> /// When overridden in a derived class, registers the <see cref="T:System.Web.UI.ScriptDescriptor"/> objects for the control. /// </summary> /// <param name="targetControl">The server control to which the extender is associated.</param> /// <returns> /// An enumeration of <see cref="T:System.Web.UI.ScriptDescriptor"/> objects. /// </returns> protected override IEnumerable <ScriptDescriptor> GetScriptDescriptors(Control targetControl) { var descriptor = new ScriptBehaviorDescriptor("Velyo.Google.Maps.DirectionsBehavior", targetControl.ClientID); // properties descriptor.AddProperty("name", UniqueID); // directions servise properties if (AvoidHighways.HasValue) { descriptor.AddProperty("avoidHighways", AvoidHighways.Value); } if (AvoidTolls.HasValue) { descriptor.AddProperty("avoidTolls", AvoidTolls.Value); } if (_destination != null) { descriptor.AddProperty("destination", _destination.Value); } if (OptimizeWaypoints.HasValue) { descriptor.AddProperty("optimizeWaypoints", OptimizeWaypoints.Value); } if (_origin != null) { descriptor.AddProperty("origin", _origin.Value); } if (ProvideRouteAlternatives.HasValue) { descriptor.AddProperty("provideRouteAlternatives", ProvideRouteAlternatives.Value); } if (Region != null) { descriptor.AddProperty("region", Region); } descriptor.AddProperty("travelMode", TravelMode.ToString()); if (UnitSystem.HasValue) { descriptor.AddProperty("unitSystem", UnitSystem.Value); } //descriptor.AddProperty("waypoints", this.waypoints); // directions renderer properties descriptor.AddProperty("draggable", Draggable); descriptor.AddProperty("hideRouteList", HideRouteList); if (_markerOptions != null) { descriptor.AddProperty("markerOptions", _markerOptions.ToScriptData()); } if (PanelID != null) { descriptor.AddProperty("panelId", PanelID); } if (_polylineOptions != null) { descriptor.AddProperty("polylineOptions", _polylineOptions.ToScriptData()); } descriptor.AddProperty("preserveViewport", PreserveViewport); descriptor.AddProperty("routeIndex", RouteIndex); if (SuppressBicyclingLayer.HasValue) { descriptor.AddProperty("suppressBicyclingLayer", SuppressBicyclingLayer.Value); } if (SuppressInfoWindows.HasValue) { descriptor.AddProperty("suppressInfoWindows", SuppressInfoWindows.Value); } if (SuppressMarkers.HasValue) { descriptor.AddProperty("suppressMarkers", SuppressMarkers.Value); } if (SuppressPolylines.HasValue) { descriptor.AddProperty("suppressPolylines", SuppressPolylines.Value); } // events if (Changed != null) { descriptor.AddEvent("changed", "Velyo.Google.Maps.Directions.DirectionsBehavior.raiseServerChanged"); } else if (OnClientChanged != null) { descriptor.AddEvent("changed", OnClientChanged); } yield return(descriptor); }
/// <summary> /// When overridden in a derived class, registers the <see cref="T:System.Web.UI.ScriptDescriptor"/> objects for the control. /// </summary> /// <param name="targetControl">The server control to which the extender is associated.</param> /// <returns> /// An enumeration of <see cref="T:System.Web.UI.ScriptDescriptor"/> objects. /// </returns> protected override IEnumerable <ScriptDescriptor> GetScriptDescriptors(Control targetControl) { var descriptor = new ScriptBehaviorDescriptor("Velyo.Google.Maps.PolylineBehavior", targetControl.ClientID); #region properties descriptor.AddProperty("clickable", Clickable); descriptor.AddProperty("geodesic", Geodesic); descriptor.AddProperty("name", UniqueID); descriptor.AddProperty("path", (_path != null) ? _path.Select(p => new { lat = p.Latitude, lng = p.Longitude }).ToArray() : null); descriptor.AddProperty("strokeColor", ColorTranslator.ToHtml(StrokeColor)); descriptor.AddProperty("strokeOpacity", StrokeOpacity); descriptor.AddProperty("strokeWeight", StrokeWeight); descriptor.AddProperty("zIndex", ZIndex); #endregion #region events if (Click != null) { descriptor.AddEvent("click", "Velyo.Google.Maps.PolylineBehavior.raiseServerClick"); } else if (OnClientClick != null) { descriptor.AddEvent("click", OnClientClick); } if (DoubleClick != null) { descriptor.AddEvent("doubleClick", "Velyo.Google.Maps.PolylineBehavior.raiseServerDoubleClick"); } else if (OnClientDoubleClick != null) { descriptor.AddEvent("doubleClick", OnClientDoubleClick); } if (MouseDown != null) { descriptor.AddEvent("mouseDown", "Velyo.Google.Maps.PolylineBehavior.raiseServerMouseDown"); } else if (OnClientMouseDown != null) { descriptor.AddEvent("mouseDown", OnClientMouseDown); } if (MouseMove != null) { descriptor.AddEvent("mouseMove", "Velyo.Google.Maps.PolylineBehavior.raiseServerMouseMove"); } else if (OnClientMouseMove != null) { descriptor.AddEvent("mouseMove", OnClientMouseMove); } if (MouseOut != null) { descriptor.AddEvent("mouseOut", "Velyo.Google.Maps.PolylineBehavior.raiseServerMouseOut"); } else if (OnClientMouseOut != null) { descriptor.AddEvent("mouseOut", OnClientMouseOut); } if (MouseOver != null) { descriptor.AddEvent("mouseOver", "Velyo.Google.Maps.PolylineBehavior.raiseServerMouseOver"); } else if (OnClientMouseOver != null) { descriptor.AddEvent("mouseOver", OnClientMouseOver); } if (MouseUp != null) { descriptor.AddEvent("mouseUp", "Velyo.Google.Maps.PolylineBehavior.raiseServerMouseUp"); } else if (OnClientMouseUp != null) { descriptor.AddEvent("mouseUp", OnClientMouseUp); } if (RightClick != null) { descriptor.AddEvent("rightClick", "Velyo.Google.Maps.PolylineBehavior.raiseServerRightClick"); } else if (OnClientRightClick != null) { descriptor.AddEvent("rightClick", OnClientRightClick); } #endregion yield return(descriptor); }
/// <summary> /// Registers the <see cref="T:System.Web.UI.ScriptDescriptor"/> objects for the control and returns an object that contains the <see cref="T:System.Web.UI.ScriptDescriptor"/> objects for the control. /// </summary> /// <param name="targetControl">The server control that the extender is associated with.</param> /// <returns> /// An <see cref="T:System.Collections.IEnumerable"/> collection that contains <see cref="T:System.Web.UI.ScriptDescriptor"/> objects. /// </returns> IEnumerable <ScriptDescriptor> IExtenderControl.GetScriptDescriptors(Control targetControl) { var descriptor = new ScriptBehaviorDescriptor("Velyo.Google.Maps.MarkersBehavior", targetControl.ClientID); // properties descriptor.AddProperty("name", UniqueID); if (_options != null) { descriptor.AddProperty("groupOptions", _options.ToScriptData()); } if (_markers != null) { descriptor.AddProperty("markerOptions", _markers.Select(m => m.ToScriptData()).ToArray()); } if (_infoWindowOptions != null) { descriptor.AddProperty("infoOptions", _infoWindowOptions.ToScriptData()); } // events if (AnimationChanged != null) { descriptor.AddEvent("animationChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerAnimationChanged"); } else if (OnClientAnimationChanged != null) { descriptor.AddEvent("animationChanged", OnClientAnimationChanged); } if (Click != null) { descriptor.AddEvent("click", "Velyo.Google.Maps.MarkersBehavior.raiseServerClick"); } else if (OnClientClick != null) { descriptor.AddEvent("click", OnClientClick); } if (ClickableChanged != null) { descriptor.AddEvent("clickableChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerClickableChanged"); } else if (OnClientClickableChanged != null) { descriptor.AddEvent("clickableChanged", OnClientClickableChanged); } if (CursorChanged != null) { descriptor.AddEvent("cursorChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerCursorChanged"); } else if (OnClientCursorChanged != null) { descriptor.AddEvent("cursorChanged", OnClientCursorChanged); } if (DoubleClick != null) { descriptor.AddEvent("doubleClick", "Velyo.Google.Maps.MarkersBehavior.raiseServerDoubleClick"); } else if (OnClientDoubleClick != null) { descriptor.AddEvent("doubleClick", OnClientDoubleClick); } if (Drag != null) { descriptor.AddEvent("drag", "Velyo.Google.Maps.MarkersBehavior.raiseServerDrag"); } else if (OnClientDrag != null) { descriptor.AddEvent("drag", OnClientDrag); } if (DraggableChanged != null) { descriptor.AddEvent("draggableChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerDraggableChanged"); } else if (OnClientDraggableChanged != null) { descriptor.AddEvent("draggableChanged", OnClientDraggableChanged); } if (DragEnd != null) { descriptor.AddEvent("dragEnd", "Velyo.Google.Maps.MarkersBehavior.raiseServerDragEnd"); } else if (OnClientDragEnd != null) { descriptor.AddEvent("dragEnd", OnClientDragEnd); } if (DragStart != null) { descriptor.AddEvent("dragStart", "Velyo.Google.Maps.MarkersBehavior.raiseServerDragStart"); } else if (OnClientDragStart != null) { descriptor.AddEvent("dragStart", OnClientDragStart); } if (FlatChanged != null) { descriptor.AddEvent("flatChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerFlatChanged"); } else if (OnClientFlatChanged != null) { descriptor.AddEvent("flatChanged", OnClientFlatChanged); } if (IconChanged != null) { descriptor.AddEvent("iconChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerIconChanged"); } else if (OnClientIconChanged != null) { descriptor.AddEvent("iconChanged", OnClientIconChanged); } if (MouseDown != null) { descriptor.AddEvent("mouseDown", "Velyo.Google.Maps.MarkersBehavior.raiseServerMouseDown"); } else if (OnClientMouseDown != null) { descriptor.AddEvent("mouseDown", OnClientMouseDown); } if (MouseOut != null) { descriptor.AddEvent("mouseOut", "Velyo.Google.Maps.MarkersBehavior.raiseServerMouseOut"); } else if (OnClientMouseOut != null) { descriptor.AddEvent("mouseOut", OnClientMouseOut); } if (MouseOver != null) { descriptor.AddEvent("mouseOver", "Velyo.Google.Maps.MarkersBehavior.raiseServerMouseOver"); } else if (OnClientMouseOver != null) { descriptor.AddEvent("mouseOver", OnClientMouseOver); } if (MouseUp != null) { descriptor.AddEvent("mouseUp", "Velyo.Google.Maps.MarkersBehavior.raiseServerMouseUp"); } else if (OnClientMouseUp != null) { descriptor.AddEvent("mouseUp", OnClientMouseUp); } if (PositionChanged != null) { descriptor.AddEvent("positionChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerPositionChanged"); } else if (OnClientPositionChanged != null) { descriptor.AddEvent("positionChanged", OnClientPositionChanged); } if (RightClick != null) { descriptor.AddEvent("rightClick", "Velyo.Google.Maps.MarkersBehavior.raiseServerRightClick"); } else if (OnClientRightClick != null) { descriptor.AddEvent("rightClick", OnClientRightClick); } if (ShadowChanged != null) { descriptor.AddEvent("shadowChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerShadowChanged"); } else if (OnClientShadowChanged != null) { descriptor.AddEvent("shadowChanged", OnClientShadowChanged); } if (ShapeChanged != null) { descriptor.AddEvent("shapeChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerShapeChanged"); } else if (OnClientShapeChanged != null) { descriptor.AddEvent("shapeChanged", OnClientShapeChanged); } if (TitleChanged != null) { descriptor.AddEvent("titleChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerTitleChanged"); } else if (OnClientTitleChanged != null) { descriptor.AddEvent("titleChanged", OnClientTitleChanged); } if (VisibleChanged != null) { descriptor.AddEvent("visibleChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerVisibleChanged"); } else if (OnClientVisibleChanged != null) { descriptor.AddEvent("visibleChanged", OnClientVisibleChanged); } if (ZIndexChanged != null) { descriptor.AddEvent("zindexChanged", "Velyo.Google.Maps.MarkersBehavior.raiseServerZIndexChanged"); } else if (OnClientZIndexChanged != null) { descriptor.AddEvent("zindexChanged", OnClientZIndexChanged); } yield return(descriptor); }