private void ProcessCmdLogin(string argv) { try { //获取登录的参数 JSONArray param = (JSONArray)JSONConvert.DeserializeArray(argv); string userName = param[0].ToString(); string userPwd = param[1].ToString(); m_Xmpp.Username = userName; m_Xmpp.Server = "im1.Stalk.com"; m_Xmpp.Port = 5222; m_Xmpp.Password = Function.EncryptMD5(userPwd).ToUpper(); m_Xmpp.Resource = "STalkClient"; m_Xmpp.AutoResolveConnectServer = true; m_Xmpp.ConnectServer = null; m_Xmpp.AutoAgents = false; m_Xmpp.AutoPresence = false; m_Xmpp.AutoRoster = false; m_Xmpp.SocketConnectionType = XMPPProtocol.net.SocketConnectionType.Direct; m_Xmpp.Open(); } catch { } }
void m_WebBrowser_JavaScriptExternalCall(object sender, JavaScriptExternalEventArgs args) { switch (args.strId) { case "FormShow": // this.Show(); //m_WebBrowser.Visible = true; base.Opacity = 100; break; case "FormClose": this.Close(); break; case "FormMinSize": this.WindowState = FormWindowState.Minimized; break; case "FormMaxSize": if (this.WindowState == FormWindowState.Normal) { this.WindowState = FormWindowState.Maximized; } else if (this.WindowState == FormWindowState.Maximized) { this.WindowState = FormWindowState.Normal; } break; case "FormNormalSize": this.WindowState = FormWindowState.Normal; break; case "FormMove": //移动窗口消息 ReleaseCapture(); SendMessage(this.Handle, Win32.WM_SYSCOMMAND, Win32.SC_MOVE + Win32.HTCAPTION, 0); break; case "FormSetTitle": //设置标题 try { JSONArray param = (JSONArray)JSONConvert.DeserializeArray(args.strArg); base.Text = param[0].ToString(); } catch { } break; case "FormSetMaxSize": //设置标题 try { JSONArray param = (JSONArray)JSONConvert.DeserializeArray(args.strArg); int width = Convert.ToInt32(param[0]); int height = Convert.ToInt32(param[1]); this.MaximumSize = new Size(width, height); } catch { } break; case "FormSetSize": try { JSONArray param = (JSONArray)JSONConvert.DeserializeArray(args.strArg); int width = Convert.ToInt32(param[0]); int height = Convert.ToInt32(param[1]); this.Width = width; this.Height = height; } catch { } break; case "FormSetMinSize": //设置标题 try { JSONArray param = (JSONArray)JSONConvert.DeserializeArray(args.strArg); int width = Convert.ToInt32(param[0]); int height = Convert.ToInt32(param[1]); this.MinimumSize = new Size(width, height); } catch { } break; case "MessageBox": try { JSONArray param = (JSONArray)JSONConvert.DeserializeArray(args.strArg); JSONObject option = (JSONObject)param[0]; DialogResult result = MessageBox.Show(option["Message"].ToString(), option["Title"].ToString(), (MessageBoxButtons)Convert.ToInt16(option["Button"]), (MessageBoxIcon)Convert.ToInt16(option["Icon"])); if (!string.IsNullOrEmpty(option["CallBack"].ToString())) { JSCall(option["CallBack"].ToString(), result.ToString()); } } catch { } break; default: break; } OnExternalCall(args); }