dev-resources.site
for different kinds of informations.
Creating desktop applications in Golang
Published at
6/11/2023
Categories
cef
energy
gui
go
Author
yanghy
Author
6 person written this
yanghy
open
package main
import (
"embed"
"fmt"
"github.com/energye/energy/v2/cef"
"github.com/energye/energy/v2/cef/ipc"
"github.com/energye/energy/v2/cef/ipc/context"
"github.com/energye/energy/v2/common"
"github.com/energye/energy/v2/pkgs/assetserve"
"github.com/energye/golcl/lcl/rtl/version"
)
//go:embed resources
var resources embed.FS
func main() {
cef.GlobalInit(nil, &resources)
cefApp := cef.NewApplication()
cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html"
if common.IsLinux() {
cef.BrowserWindow.Config.IconFS = "resources/icon.png"
} else {
cef.BrowserWindow.Config.IconFS = "resources/icon.ico"
}
if !common.IsDarwin() {
cef.BrowserWindow.Config.EnableHideCaption = true
}
cef.BrowserWindow.Config.Title = "Energy Vue + ElementUI Demo"
cef.BrowserWindow.Config.Width = 1200
chromiumConfig := cef.BrowserWindow.Config.ChromiumConfig()
chromiumConfig.SetEnableMenu(false)
ipc.On("window-state", func(context context.IContext) {
bw := cef.BrowserWindow.GetWindowInfo(context.BrowserId())
state := context.ArgumentList().GetIntByIndex(0)
if state == 0 {
bw.Minimize()
} else if state == 1 {
bw.Maximize()
}
})
ipc.On("window-close", func(context context.IContext) {
bw := cef.BrowserWindow.GetWindowInfo(context.BrowserId())
bw.CloseBrowserWindow()
})
ipc.On("os-info", func(context context.IContext) {version.OSVersion.ToString())
context.Result(version.OSVersion.ToString())
})
cef.BrowserWindow.SetBrowserInit(func(event *cef.BrowserEvent, window cef.IBrowserWindow) {
//
})
cef.SetBrowserProcessStartAfterCallback(func(b bool) {
server := assetserve.NewAssetsHttpServer()
server.PORT = 22022
server.AssetsFSName = "resources"
server.Assets = &resources
go server.StartHttpServer()
})
cef.Run(cefApp)
}
energy Article's
30 articles in total
Expanded literacy and the current state of software
read article
Building Your Own Smart Meter: A DIY Guide
read article
AI in Energy Management: Transforming the Future of Energy Efficiency
read article
Solar Battery Generator Market to Develop New Trend and Growth Story
read article
RENEWABLE ENERGY ZONES APPENDIX 3: AN IN-DEPTH LOOK
read article
CPEC Energy Projects In Pakistan: Impact And Future Prospects
read article
Solar Energy for Your Home and Business
read article
Cordycep Gum Energizing and Invigorating with a Healthy Mouth Biome Boost
read article
The Magic of Wireless Power Transmission Unleashing Teslas Vision
read article
Top Solar Companies in the USA
read article
Jacketed Liposome Extruder||Nanotechnology
read article
Advancing Energy Efficiency with Kinto Power Electric Co., Ltd
read article
How to Choose the Right Wind Generator for Your Needs
read article
Innovative Uses for Foldable Solar Panels in Outdoor Activities
read article
Powering Progress: The Role of Wind Turbines in Clean Energy
read article
The Best NAD Supplements for Boosting Your Energy and Staying Active
read article
Constant Micro Power Energy System
read article
Live Average Carbon Intensity rating with Octopus Home Mini in Home Assistant
read article
The Importance of Maintaining Energy Levels
read article
Distributed Energy Resource Management System Market Size
read article
Shaping the Future of Energy: Aluminum Air Batteries Market Trends
read article
Unleashing the Power of 48 Volt Solar Panels: A Gateway to Clean and Efficient Home Energy
read article
Decoding Capacitor Trends: A Deep Dive into the High-Voltage Market
read article
The Role Of Government Policies In Encouraging Businesses To Transition To Green Energy
read article
5G Technology and Lithium-ion Batteries: A Symbiotic Relationship
read article
Top Companies Reinventing the Energy Sector Via Blockchains
read article
Performative performance
read article
Sustainable Software Engineering for a greener digital world
read article
Creating desktop applications in Golang
currently reading
Building cross platform desktop applications using JavaScript, HTML, and CSS in GO
read article
Featured ones: