// Copyright 2011 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"github.com/lxn/walk"
	"AD-Control/public"
)

func menuInit(ni * walk.NotifyIcon){
	menuInitPower(ni)
	menuInitSoftwareInstall(ni)
	menuInitUserTools(ni)
	menuInitFileShares(ni)

}
func userappInit(){

}
func main() {
	//adserver := public.ADServerDeamon

	public.SendServerReport("Start User")
	userappInit()
	mw, err := walk.NewMainWindow()
	if err != nil {
		public.PrintLog(err)
	}

	// We load our icon from a file.
	icon, err := walk.Resources.Icon(`AD-Control.ico`)
	//icon, err := walk.Resources.Icon(`C:\Windows\SystemApps\Microsoft.Windows.SecHealthUI_cw5n1h2txyewy\Assets\Account.theme-light.ico`)
	if err != nil {
		public.PrintLog(err)
	}

	// Create the notify icon and make sure we clean it up on exit.
	ni, err := walk.NewNotifyIcon(mw)
	if err != nil {
		public.PrintLog(err)
	}
	defer ni.Dispose()

	// Set the icon and a tool tip text.
	if err := ni.SetIcon(icon); err != nil {
		public.PrintLog(err)
	}
	if err := ni.SetToolTip("Click for info or use the context menu to exit."); err != nil {
		public.PrintLog(err)
	}
	menuInit(ni)

	// The notify icon is hidden initially, so we have to make it visible.
	if err := ni.SetVisible(true); err != nil {
		public.PrintLog(err)
	}


	// Run the message loop.
	mw.Run()
}
func close(){
	public.PrintLog("触发关闭")
}