/// <summary> /// Protected method for raising the PluginEvent event /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">Event arguments</param> protected virtual void OnPluginEvent(object sender, GEEventArgs e) { if (this.PluginEvent != null) { this.PluginEvent(sender, e); } }
/// <summary> /// Called when the Plugin is Ready, rasies OnPluginReady /// </summary> /// <param name="plugin">The plugin instance</param> /// <param name="e">Event arguments</param> private void External_PluginReady(dynamic plugin, GEEventArgs e) { // plugin is the 'ge' object passed from javascript this.geplugin = plugin; if (null != this.geplugin) { // The data is just the version info e.Message = "PluginVersion"; try { e.Data = this.geplugin.getPluginVersion(); } catch (RuntimeBinderException ex) { Debug.WriteLine(ex.ToString(), "GEWebBrowser"); throw; } } // set the ready property this.pluginIsReady = true; // Raise the ready event this.OnPluginReady(this, e); }
/// <summary> /// Protected method for raising the KmlEvent event /// </summary> /// <param name="kmlEvent">the kml event</param> /// <param name="e">The eventid</param> protected virtual void OnKmlEvent(object kmlEvent, GEEventArgs e) { if (this.KmlEvent != null) { this.KmlEvent(kmlEvent, e); } }
/// <summary> /// Protected method for raising the KmlLoaded event /// </summary> /// <param name="kmlObject">The kmlObject object</param> /// <param name="e">Event arguments</param> protected virtual void OnKmlLoaded(object kmlObject, GEEventArgs e) { if (this.KmlLoaded != null) { this.KmlLoaded(kmlObject, e); } }
/// <summary> /// Protected method for raising the ScriptError event /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">Event arguments.</param> protected virtual void OnScriptError(object sender, GEEventArgs e) { if (this.ScriptError != null) { this.ScriptError(this, e); } }
/// <summary> /// Protected method for raising the PluginReady event /// </summary> /// <param name="ge">The plugin object</param> /// <param name="e">The Event arguments</param> protected virtual void OnPluginReady(object ge, GEEventArgs e) { if (this.PluginReady != null) { this.PluginReady(ge, e); } }
/// <summary> /// Can be called from javascript to invoke method /// </summary> /// <param name="name">the name of method to be called</param> /// <param name="parameters">array of parameter objects</param> public void InvokeCallBack(string name, object parameters) { try { object[] objArr; if (parameters.GetType().Name == "__ComObject") { objArr = DispatchHelpers.GetObjectArrayFrom__COMObjectArray(parameters); } else { objArr = (object[])parameters; } GEEventArgs ea = new GEEventArgs(objArr); MethodInfo info = this.GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic); info.Invoke(this, new object[] { ea }); } catch (RuntimeBinderException ex) { Debug.WriteLine("InvokeCallBack: " + ex.ToString(), "External"); ////throw; } }
/// <summary> /// Protected method for raising the ViewEvent event /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">Event arguments.</param> protected virtual void OnViewEvent(object sender, GEEventArgs e) { if (this.ViewEvent != null) { this.ViewEvent(this, e); } }
/// <summary> /// Protected method for capturing fetched IKmlObjects /// </summary> /// <param name="e">The Event arguments</param> protected virtual void OnFetchKmlSynchronous(GEEventArgs e) { lock (KmlDictionary) { KmlDictionary[e.Data] = e.ApiObject; ResetDictionary[e.Data].Set(); } }
/// <summary> /// Protected method for raising the KmlLoaded event /// </summary> /// <param name="e">The Event arguments</param> protected virtual void OnKmlLoaded(GEEventArgs e) { object kmlObject = ((object[])e.Tag)[0]; if (this.KmlLoaded != null) { this.KmlLoaded(kmlObject, e); } }
/// <summary> /// Protected method for raising the PluginReady event /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">Event arguments.</param> protected virtual void OnPluginReady(object sender, GEEventArgs e) { EventHandler <GEEventArgs> handler = this.PluginReady; if (handler != null) { handler(this, e); } }
/// <summary> /// Protected method for raising the KmlEvent event /// </summary> /// <param name="kmlEvent">The kmlEvent object</param> /// <param name="e">The Event arguments</param> protected virtual void OnKmlEvent(dynamic kmlEvent, GEEventArgs e) { EventHandler <GEEventArgs> handler = this.KmlEvent; if (handler != null) { handler(this, e); } }
/// <summary> /// Protected method for raising the KmlLoaded event /// </summary> /// <param name="e">The Event arguments</param> protected virtual void OnFetchKml(GEEventArgs e) { EventHandler <GEEventArgs> handler = this.KmlLoaded; dynamic kmlObject = e.ApiObject; if (handler != null) { handler(this, new GEEventArgs(kmlObject)); } }
/// <summary> /// Protected method for capturing fetched IKmlObjects /// </summary> /// <param name="e">The Event arguments</param> protected virtual void OnKmlFetched(GEEventArgs e) { object kmlObject = ((object[])e.Tag)[0]; string url = (string)((object[])e.Tag)[1]; lock (KmlObjectCache) { KmlObjectCache[url] = kmlObject; GEWebBrowser.KmlObjectCacheSyncEvents[url].Set(); } }
/// <summary> /// Called when there is a script error in the window /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">Event arguments</param> private void Window_Error(object sender, HtmlElementErrorEventArgs e) { // Handle the original error e.Handled = true; // Build the error data GEEventArgs ea = new GEEventArgs(); ea.Message = "Document Error"; ea.Data = "line " + e.LineNumber.ToString() + " - " + e.Description; ////string badline = Properties.Resources.Plugin.Split('\n')[e.LineNumber - 1]; // Bubble the error this.OnScriptError(e.ToString(), ea); }
/// <summary> /// Handles the external plug-in ready event. /// Sets the various fields and raise the PluginReady event. /// Wires up the form closing event /// </summary> /// <param name="sender">The external class</param> /// <param name="e">The event arguments</param> private void OnExternal_PluginReady(object sender, GEEventArgs e) { if (null == e.ApiObject) { throw new Exception("GEPlugin is null or not an object"); } this.plugin = e.ApiObject; this.PluginIsReady = true; this.PluginReady(this, e); Form parent = this.FindForm(); if (parent != null) { parent.FormClosing += this.OnForm_Closing; } }
/// <summary> /// Called when there is a viewchange event /// </summary> /// <param name="sender">the GEView object</param> /// <param name="e">The event arguments</param> private void External_ViewEvent(object sender, GEEventArgs e) { this.OnViewEvent(sender, e); }
/// <summary> /// Called when there is a GEPlugin event /// </summary> /// <param name="sender">The plugin object</param> /// <param name="e">The event arguments</param> private void External_PluginEvent(object sender, GEEventArgs e) { this.OnPluginEvent(sender, e); }
/// <summary> /// Called when there is a Kml event /// </summary> /// <param name="kmlEvent">the kml event</param> /// <param name="e">The event arguments</param> private void External_KmlEvent(object kmlEvent, GEEventArgs e) { this.OnKmlEvent(kmlEvent, e); }
/// <summary> /// Protected method for raising the KmlLoaded event /// </summary> /// <param name="e">The Event arguments</param> protected virtual void OnKmlLoaded(GEEventArgs e) { EventHandler<GEEventArgs> handler = this.KmlLoaded; dynamic kmlObject = ((object[])e.ApiObject)[0]; if (handler != null) { handler(this, new GEEventArgs(kmlObject)); } }
void geWebBrowser1_ViewEvent(object sender, GEEventArgs e) { ////Debug.WriteLine(string.Format("GEView: {0}", e.Message), "Form1"); }
/// <summary> /// Called whenever the Ready event is raised by the assoicated GEWebBorwser /// </summary> /// <param name="sender">The GEWebBorwser instance</param> /// <param name="e">The event arguments</param> private void Gewb_PluginReady(object sender, GEEventArgs e) { this.SynchronizeOptions(); }
/// <summary> /// Can be called from javascript to invoke method in managed code. /// </summary> /// <param name="name">the name of the managed method to be called</param> /// <param name="parameters">array of parameter objects</param> public void InvokeCallback(string name, dynamic parameters) { try { object[] data; if (parameters.GetType().Name == "__ComObject") { data = new object[] { (dynamic)parameters.kmlObject, (string)parameters.url }; } else { data = (object[])parameters; } GEEventArgs ea = new GEEventArgs(data); MethodInfo info = this.GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic); info.Invoke(this, new object[] { ea }); } catch (RuntimeBinderException rbex) { Debug.WriteLine("InvokeCallBack: " + rbex.Message, "External"); } catch (NullReferenceException nrex) { Debug.WriteLine("InvokeCallBack: " + nrex.Message, "External"); } }
/// <summary> /// Protected method for raising the KmlEvent event /// </summary> /// <param name="kmlEvent">The kmlEvent object</param> /// <param name="e">The Event arguments</param> protected virtual void OnKmlEvent(dynamic kmlEvent, GEEventArgs e) { EventHandler<GEEventArgs> handler = this.KmlEvent; if (handler != null) { handler(this, e); } }
/// <summary> /// Protected method for raising the PluginReady event /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">Event arguments.</param> protected virtual void OnPluginReady(object sender, GEEventArgs e) { EventHandler<GEEventArgs> handler = this.PluginReady; if (handler != null) { handler(this, e); } }
/// <summary> /// Protected method for raising the PluginEvent event /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">Event arguments.</param> protected virtual void OnPluginEvent(object sender, GEEventArgs e) { if (this.PluginEvent != null) { this.PluginEvent(this, e); } }
/// <summary> /// Called when a Kml/Kmz file has loaded /// </summary> /// <param name="kmlFeature">The kml feature</param> /// <param name="e">Event arguments</param> private void External_KmlLoaded(object kmlFeature, GEEventArgs e) { this.OnKmlLoaded(kmlFeature, e); }
void geWebBrowser1_ScriptError(object sender, GEEventArgs e) { //MessageBox.Show(e.Data, e.Message); }
void geWebBrowser1_KmlLoaded(object sender, GEEventArgs e) { dynamic kml = sender; if (null != kml) { // add any kml to the plug-in and tree ge.getFeatures().appendChild(kml); kmlTreeView1.ParseKmlObject(kml); } }
void geWebBrowser1_KmlEvent(object sender, GEEventArgs e) { dynamic mouseEvent = sender; //process action cases... switch (e.Data) { case "click": break; case "dblclick": break; case "mouseover": break; case "mousedown": if (mouseEvent.getTarget().getType() == "KmlPlacemark" && !dragInfo.Dragging) { // test for placemark by id... // if this is removed then all placemarks would be dragable if (mouseEvent.getTarget().getId() != "dpm") { return; } dragInfo.Placemark = mouseEvent.getTarget(); dragInfo.Dragging = true; Debug.WriteLine("Pick-up", "Form1"); } break; case "mouseup": if (dragInfo.Dragging) { mouseEvent.preventDefault(); Debug.WriteLine("Drop", "Form1"); } dragInfo.Dragging = false; break; case "mouseout": break; case "mousemove": if (dragInfo.Dragging) { mouseEvent.preventDefault(); dynamic point = dragInfo.Placemark.getGeometry(); point.setLatitude(mouseEvent.getLatitude()); point.setLongitude(mouseEvent.getLongitude()); } break; default: break; } }
/// <summary> /// Protected method for raising the KmlLoaded event /// </summary> /// <param name="e">The Event arguments</param> protected virtual void OnFetchKml(GEEventArgs e) { EventHandler<GEEventArgs> handler = this.KmlLoaded; dynamic kmlObject = e.ApiObject; if (handler != null) { handler(this, new GEEventArgs(kmlObject)); } }
/// <summary> /// Protected method for raising the ScriptError event /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">Event arguments</param> protected virtual void OnScriptError(object sender, GEEventArgs e) { if (this.ScriptError != null) { this.ScriptError(sender, e); } }
/// <summary> /// Protected method for capturing fetched IKmlObjects /// </summary> /// <param name="e">The Event arguments</param> protected virtual void OnKmlFetched(GEEventArgs e) { object[] result = e.ApiObject; if (result.Length == 2) { dynamic kmlObject = result[0]; string url = (string)result[1]; lock (KmlObjectCache) { KmlObjectCache[url] = kmlObject; GEWebBrowser.KmlObjectCacheSyncEvents[url].Set(); } } }
/// <summary> /// Protected method for raising the PluginReady event /// </summary> /// <param name="sender">The browser instance holding the plugin</param> /// <param name="e">Event arguments</param> protected virtual void OnPluginReady(object sender, GEEventArgs e) { if (this.PluginReady != null) { this.PluginReady(sender, e); } }
void geWebBrowser1_PluginReady(object sender, GEEventArgs e) { GEWebBrowser browser = sender as GEWebBrowser; ge = browser.GetPlugin(); // with the default setting the same as loading http://localhost:8080/defualt.kml geWebBrowser1.FetchKmlLocal("netlink.kml"); }
/// <summary> /// Protected method for raising the viewchange events /// </summary> /// <param name="sender">The GEView object</param> /// <param name="e">Event arguments</param> protected virtual void OnViewEvent(object sender, GEEventArgs e) { if (this.ViewEvent != null) { this.ViewEvent(sender, e); } }
/// <summary> /// Called when the document has a ScriptError /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">Event arguments</param> private void External_ScriptError(object sender, GEEventArgs e) { this.OnScriptError(sender, e); }