internal Component GetComponent(object cbackend, string name, string type) { try { lock (components) { if (cbackend == null) { return(null); } Component c = (Component)components [cbackend]; if (c != null) { return(c); } // If the remote object is already disposed, don't try to create a // local component. if (cbackend is ObjectWrapper && ((ObjectWrapper)cbackend).IsDisposed) { return(null); } if (cbackend is Wrapper.Action) { c = new ActionComponent(this, cbackend, name); ((ObjectWrapper)cbackend).Frontend = c; } else if (cbackend is Wrapper.ActionGroup) { c = new ActionGroupComponent(this, cbackend, name); ((Wrapper.ActionGroup)cbackend).Frontend = c; } else if (cbackend is ObjectWrapper) { c = new WidgetComponent(this, cbackend, name, type != null ? GetComponentType(type) : null); ((ObjectWrapper)cbackend).Frontend = c; } else if (cbackend == null) { throw new System.ArgumentNullException("cbackend"); } else { throw new System.InvalidOperationException("Invalid component type: " + cbackend.GetType()); } components [cbackend] = c; return(c); } } catch (System.Runtime.Remoting.RemotingException) { // There may be a remoting exception if the remote wrapper // has already been disconnected when trying to create the // component frontend. This may happen since calls are // dispatched in the GUI thread, so they may be delayed. return(null); } }
internal void NotifySignalChanged(Wrapper.Action action, string name, Signal oldSignal, Signal signal) { ActionComponent c = (ActionComponent)app.GetComponent(action, name, null); if (c != null && SignalChanged != null) { SignalChanged(this, new ComponentSignalEventArgs(project, c, oldSignal, signal)); } }
internal ComponentType (Application app, ActionComponent action) { this.action = action; this.app = app; this.name = action.Name; this.description = action.Label != null ? action.Label.Replace ("_", "") : action.Name; this.icon = action.Icon; this.className = "Gtk.Action"; this.category = "Actions / " + action.ActionGroup.Name; this.targetGtkVersion = "2.4"; // Not version-specific }
internal ComponentType(Application app, ActionComponent action) { this.action = action; this.app = app; this.name = action.Name; this.description = action.Label != null?action.Label.Replace("_", "") : action.Name; this.icon = action.Icon; this.className = "Gtk.Action"; this.category = "Actions / " + action.ActionGroup.Name; this.targetGtkVersion = "2.4"; // Not version-specific }
public ActionComponent[] GetActions() { Wrapper.ActionCollection acts = ((Wrapper.ActionGroup)backend).Actions; ArrayList comps = new ArrayList(acts.Count); for (int n = 0; n < acts.Count; n++) { ActionComponent ac = (ActionComponent)app.GetComponent(acts[n], null, null); if (ac != null) { comps.Add(ac); } } return((ActionComponent[])comps.ToArray(typeof(ActionComponent))); }
internal Component GetComponent (object cbackend, string name, string type) { try { lock (components) { Component c = (Component) components [cbackend]; if (c != null) return c; // If the remote object is already disposed, don't try to create a // local component. if (cbackend is ObjectWrapper && ((ObjectWrapper)cbackend).IsDisposed) return null; if (cbackend is Wrapper.Action) { c = new ActionComponent (this, cbackend, name); ((ObjectWrapper)cbackend).Frontend = c; } else if (cbackend is Wrapper.ActionGroup) { c = new ActionGroupComponent (this, cbackend, name); ((Wrapper.ActionGroup)cbackend).Frontend = c; } else if (cbackend is ObjectWrapper) { c = new WidgetComponent (this, cbackend, name, type != null ? GetComponentType (type) : null); ((ObjectWrapper)cbackend).Frontend = c; } else if (cbackend == null) throw new System.ArgumentNullException ("cbackend"); else throw new System.InvalidOperationException ("Invalid component type: " + cbackend.GetType ()); components [cbackend] = c; return c; } } catch (System.Runtime.Remoting.RemotingException) { // There may be a remoting exception if the remote wrapper // has already been disconnected when trying to create the // component frontend. This may happen since calls are // dispatched in the GUI thread, so they may be delayed. return null; } }