Пример #1
0
func (mw *MyDialog) SetExitHide(exit bool) (err error) {
	mw.Closing().Attach(func(canceled *bool, reason walk.CloseReason) {
		reason = walk.CloseReasonUnknown
		var closingPublisher walk.CloseEventPublisher
		// 不关闭程序
		*canceled = exit
		closingPublisher.Publish(canceled, reason)
		// 隐藏程序,显示托盘
		mw.Hide()
	})

	return nil
}
Пример #2
0
func (mw *MyDialog) setExitHide(exit bool) (err error) {
	if exit {
		mw.Closing().Attach(func(canceled *bool, reason walk.CloseReason) {
			reason = walk.CloseReasonUnknown
			var closingPublisher walk.CloseEventPublisher
			// 不关闭程序
			*canceled = true
			closingPublisher.Publish(canceled, reason)
			// 隐藏程序,显示托盘
			mw.Hide()
			mw.ni.SetVisible(true)
		})
	}
	return nil
}