胡超1 1 year ago
parent
commit
0892515367
  1. 28
      CPF_Cef/Devices/WindowStalker.cs
  2. 4
      CPF_Cef/FrmMain.cs
  3. 6
      CPF_Cef/MainModel.cs
  4. 2
      CPF_Cef/Parame.cs

28
CPF_Cef/Devices/WindowStalker.cs

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace AksWebBrowser.Devices
{
public class WindowStalker
{
[DllImport("libX11")]
private static extern bool XRaiseWindow(IntPtr display, IntPtr window);
[DllImport("libX11")]
private static extern IntPtr XOpenDisplay(string displayName);
[DllImport("libX11")]
private static extern IntPtr XDefaultRootWindow(IntPtr display);
public static void BringWindowToFront()
{
IntPtr display = XOpenDisplay(null);
IntPtr rootWindow = XDefaultRootWindow(display);
XRaiseWindow(display, rootWindow);
}
}
}

4
CPF_Cef/FrmMain.cs

@ -89,8 +89,8 @@ namespace AksWebBrowser
//浏览器大小 //浏览器大小
Parame.webBrowser.Width = w; Parame.webBrowser.Width = w;
Parame.webBrowser.Height = h; Parame.webBrowser.Height = h;
Parame.webBrowser.Url = "http://127.0.0.1:8096/#/main-out"; //Parame.webBrowser.Url = "http://127.0.0.1:8096/#/main-out";
//Parame.webBrowser.Url = "http://192.168.0.34:8078/#/main-out"; Parame.webBrowser.Url = "http://192.168.0.34:8078/#/main-out";
//Parame.webBrowser.Url = Application.StartupPath + @"\html\index.html"; //Parame.webBrowser.Url = Application.StartupPath + @"\html\index.html";
//开发者工具暂时只能支持Windows //开发者工具暂时只能支持Windows
//webBrowser.ShowDev(); //webBrowser.ShowDev();

6
CPF_Cef/MainModel.cs

@ -1072,10 +1072,8 @@ namespace AksWebBrowser
{ {
try try
{ {
Task.Run(() => // 在你的窗口或应用程序需要时调用
{ Bash("/usr/bin/python3 /usr/bin/onboard");
Bash("/usr/bin/python3 /usr/bin/onboard");
});
return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "唤醒键盘成功" + "\"}"; return "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + code + "\",\"message\":\"seccse\",\"code\":\"200\",\"status\":true,\"data\":\"" + "唤醒键盘成功" + "\"}";
} }
catch (Exception ex) catch (Exception ex)

2
CPF_Cef/Parame.cs

@ -19,7 +19,7 @@ namespace AksWebBrowser
public static Window frm { get; set; } public static Window frm { get; set; }
public static List<Func> FuncObject { get; set; } public static List<Func> FuncObject { get; set; }
//接口地址 //接口地址
public static string apiUrl ="http://127.0.0.1:8098"; // "http://192.168.0.34:92"; public static string apiUrl = "http://192.168.0.34:92";// "http://127.0.0.1:8098";
//授权key //授权key
public static string key = "1"; public static string key = "1";
//硬件Ip //硬件Ip

Loading…
Cancel
Save