/// <summary> /// Hello /// </summary> /// <param name="message"></param> public void Hello(WinjsLib.Message message) { if (!this.CheckAccess()) { this.Dispatcher.Invoke(DispatcherPriority.Send, new WinjsLib.EventControl.WinjsEvent(Hello), message); return; } Send(message.Response, "欢迎使用WinJs,如有建议或需求,请联系作者[email protected]"); }
/// <summary> /// 开发者模式 /// </summary> /// <param name="message"></param> public void ShowDevTools(WinjsLib.Message message) { if (!this.CheckAccess()) { this.Dispatcher.Invoke(DispatcherPriority.Send, new WinjsLib.EventControl.WinjsEvent(ShowDevTools), message); return; } //WinMs ms = JsonConvert.DeserializeObject<WinMs>(message.Json); webBrowser.WebBrowser.ShowDevTools(); Send(message.Response, null); }
/// <summary> /// 最小化 /// </summary> /// <param name="message"></param> public void Minimize(WinjsLib.Message message) { if (!this.CheckAccess()) { this.Dispatcher.Invoke(DispatcherPriority.Send, new WinjsLib.EventControl.WinjsEvent(Minimize), message); return; } //WinMs ms = JsonConvert.DeserializeObject<WinMs>(message.Json); this.WindowState = System.Windows.WindowState.Minimized; Send(message.Response, null); }
/// <summary> /// 设置高度 /// </summary> /// <param name="message"></param> public void SetHeight(WinjsLib.Message message) { if (!this.CheckAccess()) { this.Dispatcher.Invoke(DispatcherPriority.Send, new WinjsLib.EventControl.WinjsEvent(SetHeight), message); return; } WPFMs ms = JsonConvert.DeserializeObject <WPFMs>(message.Json); this.Height = ms.Height; Send(message.Response, null); }
/// <summary> /// 跳转 /// </summary> /// <param name="message"></param> public void Url(WinjsLib.Message message) { if (!this.CheckAccess()) { this.Dispatcher.Invoke(DispatcherPriority.Send, new WinjsLib.EventControl.WinjsEvent(Url), message); return; } WPFMs ms = JsonConvert.DeserializeObject <WPFMs>(message.Json); this.webBrowser.Load(ms.Url); Send(message.Response, null); }
/// <summary> /// 返回 /// </summary> /// <param name="message"></param> public void Close(WinjsLib.Message message) { if (!this.CheckAccess()) { this.Dispatcher.Invoke(DispatcherPriority.Send, new WinjsLib.EventControl.WinjsEvent(Close), message); return; } //WinMs ms = JsonConvert.DeserializeObject<WinMs>(message.Json); this.Hide(); this.Close(); System.Environment.Exit(0); Send(message.Response, null); }