protected string GMap1_ServerEvent(object s, GAjaxServerEventOtherArgs e)
 {
     string js = string.Empty;
     switch (e.eventName)
     {
         case "Click":
             GLatLng latlng = new GLatLng(
             Convert.ToDouble(e.eventArgs[2], new System.Globalization.CultureInfo("en-US", false)),
             Convert.ToDouble(e.eventArgs[3], new System.Globalization.CultureInfo("en-US", false)));
             GInfoWindow window = new GInfoWindow(latlng, string.Format("Window Size (px): ({0},{1}). Close Me.", e.eventArgs[0], e.eventArgs[1]));
             GListener listener = new  GListener(window.ID, GListener.Event.infowindowclose,
                                             string.Format(
                                                 @"
                                                    function()
                                                    {{
                                                       var ev = new serverEvent('InfoWindowClose', {0});
                                                       ev.addArg('My Argument');
                                                        ev.send();
                                                    }}
                                                 ",
                                                 window.ID));
             js = window.ToString(e.who) + listener.ToString();
             break;
         case "InfoWindowClose":
             js = string.Format
             ("alert('{0}: {1} - {2} - {3}')", e.eventName, e.point, e.eventArgs[0], DateTime.Now);
             break;
     }
     return js;
 }
Esempio n. 2
0
        protected string GMap1_ServerEvent(object s, GAjaxServerEventOtherArgs e)
        {
            string js = string.Empty;

            switch (e.eventName)
            {
            case "Click":
                GLatLng latlng = new GLatLng(
                    Convert.ToDouble(e.eventArgs[2], new System.Globalization.CultureInfo("en-US", false)),
                    Convert.ToDouble(e.eventArgs[3], new System.Globalization.CultureInfo("en-US", false)));

                GInfoWindowOptions options = new GInfoWindowOptions();
                options.onCloseFn = string.Format(@"
                function()
                {{
                    var ev = new serverEvent('InfoWindowClose', {0});
                    ev.addArg('My Argument');
                    ev.send();
                }}
            ", GMap1.GMap_Id);
                GInfoWindow window = new GInfoWindow(latlng, string.Format("Window Size (px): ({0},{1}). Close Me.", e.eventArgs[0], e.eventArgs[1]), options);

                //guardar punto
                Session["lat"] = latlng.lat.ToString();
                Session["lng"] = latlng.lng.ToString();

                js = window.ToString(e.who);
                break;
            }
            return(js);
        }
Esempio n. 3
0
        protected string GMap1_ServerEvent(object s, GAjaxServerEventOtherArgs e)
        {
            string js = string.Empty;

            switch (e.eventName)
            {
            case "Click":
                GLatLng latlng = new GLatLng(
                    Convert.ToDouble(e.eventArgs[2], new System.Globalization.CultureInfo("en-US", false)),
                    Convert.ToDouble(e.eventArgs[3], new System.Globalization.CultureInfo("en-US", false)));
                GInfoWindow window   = new GInfoWindow(latlng, string.Format("Window Size (px): ({0},{1}). Close Me.", e.eventArgs[0], e.eventArgs[1]));
                GListener   listener = new  GListener(window.ID, GListener.Event.infowindowclose,
                                                      string.Format(
                                                          @"
                                                           function()
                                                           {{
                                                              var ev = new serverEvent('InfoWindowClose', {0});
                                                              ev.addArg('My Argument');
                                                               ev.send();
                                                           }}
                                                        ",
                                                          window.ID));
                js = window.ToString(e.who) + listener.ToString();
                break;

            case "InfoWindowClose":
                js = string.Format
                         ("alert('{0}: {1} - {2} - {3}')", e.eventName, e.point, e.eventArgs[0], DateTime.Now);
                break;
            }
            return(js);
        }
Esempio n. 4
0
        protected string locationGMap_ServerEvent(object s, GAjaxServerEventOtherArgs e)
        {
            switch (e.eventName)
            {
            case "myDragEnd":
                string zoomLevel = e.eventArgs[0];

                Session["HiddenFieldX"] = e.eventArgs[2];        // Coordinates swapped on client request
                Session["HiddenFieldY"] = e.eventArgs[1];        //
                Session.Remove("Location");

                GLatLng point = new GLatLng(Convert.ToDouble(e.eventArgs[2], new System.Globalization.CultureInfo("en-US", false)),
                                            Convert.ToDouble(e.eventArgs[1], new System.Globalization.CultureInfo("en-US", false)));

                return("clearOverlays();");
            }

            return(string.Empty);
        }