void OnGUI() { if (DesignerObject == null) { return; } var control = DesignerObject as Control; if (control != null && (control.Disposing || control.IsDisposed) || !UnityEngine.Application.isPlaying) { DesignerObject = null; return; } scrollPosition = GUILayout.BeginScrollView(scrollPosition); if (designer == null || designer.Value != DesignerObject) { designer = new ObjectDesigner(DesignerObject); } var newObject = designer.Draw((int)position.width - 8, int.MaxValue); if (newObject != null) { DesignerObject = newObject; } GUILayout.EndScrollView(); }
public ObjectDesigner() { Guid guid = new Guid("50000004-0000-1000-0001-0000836BD2D2"); Hashtable runningObjects = GetActiveObjectList(DefaultMonikerName); foreach (DictionaryEntry de in runningObjects) { string progId = de.Key.ToString(); if (progId.IndexOf("{") != -1) { // Convert a class id into a friendly prog Id progId = ConvertClassIdToProgId(de.Key.ToString()); } object getObj = GetActiveObject(progId); if (getObj != null) { this._objectDesigner = getObj as IObjectDesigner; if (this._objectDesigner == null) { throw new Exception("Could not connect to Dynamics NAV"); } } } }
// Public Methods (2) /// <summary> /// Begins advising the linked <see cref="Org.Edgerunner.Dynamics.Nav.CSide.Client"/> of new events from the source. /// </summary> /// <param name="source">The source.</param> public void Advise(ref IObjectDesigner source) { // Late bind connection point subscription // Subscribe for connection point event IConnectionPointContainer container = source as IConnectionPointContainer; container.FindConnectionPoint(ref _IID, out _ConnectionPoint); _ConnectionPoint.Advise(this, out _Cookie); }
public ObjectDesignerTest(String serverNam, String dbName, String companyName, int codePage) { Hashtable runningObjects = GetActiveObjectList(DefaultMonikerName); this.codepage = codePage; foreach (DictionaryEntry de in runningObjects) { string progId = de.Key.ToString(); if (progId.IndexOf("{") != -1) { // Convert a class id into a friendly prog Id progId = ConvertClassIdToProgId(de.Key.ToString()); } object getObj = GetActiveObject(progId); if (getObj != null) { this._objectDesigner = getObj as IObjectDesigner; if (this._objectDesigner == null) { throw new Exception("Could not connect to Dynamics NAV"); } else { String company, server, db; company = GetCompanyName(); db = GetDatabaseName(); server = GetServerName(); if ((company == companyName) && (db == dbName) && (server.ToUpper() == serverNam.ToUpper())) { break; } else { this._objectDesigner = null; } } } else { //Console.WriteLine("!!!!!FAILED TO fetch: " + progId); } } if (this._objectDesigner == null) { throw new Exception("Could not connect to Dynamics NAV"); } }
public static void CheckInterface(object obj) { IObjectDesigner designer = obj as IObjectDesigner; Debug.WriteLineIf(designer != null, "Is IObjectDesigner");//* INSCallbackEnum callbackEnum = obj as INSCallbackEnum; Debug.WriteLineIf(callbackEnum != null, "Is INSCallbackEnum"); INSRec rec = obj as INSRec; Debug.WriteLineIf(rec != null, "Is INSRec"); INSAppBase appBase = obj as INSAppBase; Debug.WriteLineIf(appBase != null, "Is INSAppBase");//* INSApplication app = obj as INSApplication; Debug.WriteLineIf(app != null, "Is INSApplication");//* INSForm form = obj as INSForm; Debug.WriteLineIf(form != null, "Is INSForm"); INSHook hook = obj as INSHook; Debug.WriteLineIf(hook != null, "Is INSHook"); INSHyperlink hyper = obj as INSHyperlink; Debug.WriteLineIf(hyper != null, "Is INSHyperlink");//* INSMenuButton menub = obj as INSMenuButton; Debug.WriteLineIf(menub != null, "Is INSMenuButton"); INSTable table = obj as INSTable; Debug.WriteLineIf(table != null, "Is INSTable"); IConnectionPointContainer conn = obj as IConnectionPointContainer; Debug.WriteLineIf(conn != null, "Is IConnectionPointContainer"); }
//private const string ObjectDesignerGuid = "50000004-0000-1000-0001-0000836BD2D2"; public ObjectDesignerTest() { Hashtable runningObjects = GetActiveObjectList(DefaultMonikerName); foreach (DictionaryEntry de in runningObjects) { string progId = de.Key.ToString(); if (progId.IndexOf("{") != -1) { // Convert a class id into a friendly prog Id progId = ConvertClassIdToProgId(de.Key.ToString()); } object getObj = GetActiveObject(progId); if (getObj != null) { INSApplication app = getObj as INSApplication; IObjectDesigner objDis = getObj as IObjectDesigner; INSAppBase appBase = getObj as INSAppBase; INSHyperlink hyp = getObj as INSHyperlink; //Debug.WriteLine("App.="+app.GetType().FullName); if (hyp != null) { int handle; hyp.GetNavWindowHandle(out handle); Debug.WriteLine("WindowHandle=" + handle.ToString()); } if (appBase != null) { int res = 0; try { //res = appBase.Error("What<???"); } catch (Exception) {} //appBase.proc6(); //appBase.GetInfos(out a, out b,out c, out d); Debug.WriteLine("Appbase="); Debug.Indent(); Debug.WriteLine("res=" + res); //Debug.WriteLine("b=" + b); //Debug.WriteLine("c=" + c); //Debug.WriteLine("d=" + d); Debug.Unindent(); } if (objDis != null) { String version; int res = objDis.GetDatabaseName(out version); Debug.WriteLine("ObjDis=" + version); } if (app != null) { INSForm form; Debug.WriteLine("appGetform=" + app.GetForm(out form).ToString()); String hyperlink; if (form != null) { form.GetID(out hyperlink); /*form.GetButtons(out button); * if (button != null) * { * //button.proc3("Run"); * //button.proc4(0,"MyButtonB","MyButtonC"); * //Debug.WriteLine("Button="+button. * } * */ INSRec rec; CallBack callback = new CallBack(); form.GetRec(out rec); rec.EnumFieldValues(callback); Debug.WriteLine("form=" + form.ToString()); if (hyperlink != null) { Debug.WriteLine("FormID=" + hyperlink); } } } //this._objectDesigner = getObj as IObjectDesigner; } else { //Console.WriteLine("!!!!!FAILED TO fetch: " + progId); } } /* * if (this._objectDesigner == null) * { * throw new Exception("Could not connect to Dynamics NAV"); * } * */ }