internal VirtualUISink(VirtualUI virtualUI) { m_VirtualUI = virtualUI; }
public VirtualUI() : base() { if (LibHandle != IntPtr.Zero) { IntPtr pAddressOfFunctionToCall = GetProcAddress(LibHandle, "DllGetInstance"); GetInstance = (funcGetInstance)Marshal.GetDelegateForFunctionPointer( pAddressOfFunctionToCall, typeof(funcGetInstance)); GetInstance(ref m_VirtualUI); virtualUIEventSink = new VirtualUISink(this); connectionPointContainer = (System.Runtime.InteropServices.ComTypes.IConnectionPointContainer)m_VirtualUI; Guid virtualUIEventsInterfaceId = typeof(IEvents).GUID; connectionPointContainer.FindConnectionPoint(ref virtualUIEventsInterfaceId, out connectionPoint); if (connectionPoint != null) connectionPoint.Advise((IEvents)virtualUIEventSink, out connectionCookie); } m_BrowserInfo = new BrowserInfo(m_VirtualUI); m_DevServer = new DevServer(m_VirtualUI); if (!g_virtualUIExists) { g_virtualUIExists = true; g_virtualUI = new VirtualUI(); } }
private void Initialize() { try { if (initVUI) { groupBox3.AllowDrop = true; txtSuspend.Text = suspendTime.ToString(); vui = new Cybele.Thinfinity.VirtualUI(); vui.ClientSettings.CursorVisible = true; vui.ClientSettings.MouseMoveGestureStyle = MouseMoveGestureStyle.MM_STYLE_RELATIVE; vui.OnClose += vui_OnClose; vui.Start(); vui.StdDialogs = false; fPopup = new frmPopup(); NormalGroupBck = groupBox3.BackColor; // -- The given name, is how the model shown this object in the model reference. ro = new Cybele.Thinfinity.JSObject("ro"); ro.Events.Add("button_click").AddArgument("data", IJSDataType.JSDT_JSON); ro.Events.Add("JsROCopy"); //.AddArgument("data", IJSDataType.JSDT_JSON); ro.Events.Add("JsROPaste"); //.AddArgument("data", IJSDataType.JSDT_JSON); if (vui.Active) { // -- Adding properties, methods and events. ro.Properties.Add("int").AsInt = 3; ro.Properties.Add("float").AsFloat = 2.5f; ro.Properties.Add("boolean").AsBool = true; ro.Properties.Add("string").AsString = "Hello world"; //ro.Properties.Add("JSON").AsJSON = "{'x':42}"; // Cybele.Thinfinity.JSObject sub_ro = new Cybele.Thinfinity.JSObject("sub_ro"); Cybele.Thinfinity.IJSObject data = ro.Objects.Add("data"); data.Properties.Add("height").AsInt = 1; data.Properties.Add("scale").AsFloat = 44.1235f; data.Properties.Add("isReady").AsBool = false; data.Properties.Add("phrase").AsString = "bye world"; data.Properties.Add("band").AsString = "Marillion"; //data.Properties.R //sub_ro.Properties.Add("JSON").AsJSON = "{'x':455}"; ro.Methods.Add("GetValue") .OnCall(new Cybele.Thinfinity.JSCallback(delegate(IJSObject parent, IJSMethod Method) { })).ReturnValue.AsString = "ss"; ro.Properties.Add("backgroundColor").OnSet(new JSBinding(delegate(IJSObject parent, IJSProperty prop) { string value = prop.AsString; })).AsString = ""; ro.Properties.Add("copy") //.OnGet(new JSBinding( // // This anonymous procedure do the actual get // delegate(IJSObject Parent, IJSProperty Prop) // { // Prop.AsString = "#" // + this.BackColor.R.ToString("X2") // + this.BackColor.G.ToString("X2") // + this.BackColor.B.ToString("X2"); // })) .OnSet(new JSBinding( // This anonymous procedure do the actual set delegate(IJSObject Parent, IJSProperty Prop) { string value = Prop.AsString; lblJsRO.Text = "Callback copy: " + value; })).AsString = ""; ro.Properties.Add("paste") //.OnGet(new JSBinding( // // This anonymous procedure do the actual get // delegate(IJSObject Parent, IJSProperty Prop) // { // Prop.AsString = "#" // + this.BackColor.R.ToString("X2") // + this.BackColor.G.ToString("X2") // + this.BackColor.B.ToString("X2"); // })) .OnSet(new JSBinding( // This anonymous procedure do the actual set delegate(IJSObject Parent, IJSProperty Prop) { string value = Prop.AsString; lblJsRO.Text = "Callback paste: " + value; })).AsString = ""; //ro.Events.Add("dragEnter");//.AddArgument("type", IJSDataType.JSDT_STRING); //ro.Properties.Add("dragRaw").OnSet(new JSBinding(delegate(IJSObject parent, IJSProperty prop) //{ // string s = prop.AsString; //})); vui.OnDragFile += vui_OnDragFile; ro.ApplyModel(); } else { Console.WriteLine("VirtualUI is not ready"); } } //this.ActiveControl = textBox1; //BackgroundWorker t = new BackgroundWorker(); //t.DoWork += runWork; //t.RunWorkerCompleted += taskCompleted; //t.WorkerReportsProgress = true; //System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; //Cursor.Hide(); //t.RunWorkerAsync(); vui.OnUploadEnd += vui_OnUploadEnd; } catch (Exception ex) { Console.WriteLine(ex.Message); } //if (Clipboard.ContainsImage()) //{ // //System.Drawing.Image returnImage = null; // pictureBox1.Image = Clipboard.GetImage(); // //Windows.ApplicationModel.DataTransfer.Clipboard.GetContent(); //} }