public BasicWindow(Package.StartupInfo info) { InitializeComponent(); Top = 0; Left = 0; Height = SystemParameters.WorkArea.Height; Width = SystemParameters.WorkArea.Width; notifyIcon.Text = "HuiDesktop"; notifyIcon.Icon = Properties.Resources.GlobalIcon; notifyIcon.Visible = true; notifyIcon.MouseClick += NotifyIcon_MouseClick; notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(); notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("DevTools", ContextMenu_DevTools)); notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("刷新", ContextMenu_Reload)); notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("设置", ContextMenu_Settings)); notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("退出", ContextMenu_Exit)); requestHandler = new RequestHandler(); requestHandler.AddPackage(info.fromPackage); foreach (var i in info.dependencies) { requestHandler.AddPackage(Package.PackageManager.packages[i]); } browser = new ChromiumWebBrowser(); browser.BrowserSettings = new BrowserSettings { WindowlessFrameRate = ApplicationInfo.FrameRate, LocalStorage = CefState.Enabled }; AddChild(browser); api = new JsApi(this); browser.RequestHandler = requestHandler; browser.JavascriptObjectRepository.Register("huiDesktop", api, false, new BindingOptions { CamelCaseJavascriptNames = false }); browser.JavascriptObjectRepository.Register("huiDesktopAsync", api, true, new BindingOptions { CamelCaseJavascriptNames = false }); browser.MenuHandler = new NullMenuHandler(); browser.Address = info.url; }
public EasyBasicWindow(JsApi parent) { _parent = parent._parent; _parent.LocationChanged += Window_LocationChanged; _parent.SizeChanged += Window_SizeChanged; }