// // KMProductPromotionViewController.swift // PDF Reader Pro // // Home--运营活动 模块 // Created by wanjun on 2022/10/18. // import Cocoa class KMProductPromotionViewController: NSViewController { @IBOutlet weak var activitiesBox: KMBox! @IBOutlet weak var activitiesImageView: NSImageView! @IBOutlet weak var activitiesCloseButton: NSButton! override func viewDidLoad() { super.viewDidLoad() // Do view setup here. activitiesBox.cornerRadius = 8.0 self.activitiesCloseButton.isHidden = true self.activitiesBox.downCallback = {(downEntered: Bool, mouseBox: KMBox, event) -> Void in if downEntered { self.activitiesButtonAction() } } self.activitiesBox.moveCallback = {(mouseEntered: Bool, mouseBox: KMBox) -> Void in // if mouseEntered { // self.activitiesCloseButton.isHidden = false // } else { // self.activitiesCloseButton.isHidden = true // } } } // MARK: Action func activitiesButtonAction() { // 点击运营活动 let httpUrl: NSURL = NSURL.init(string: "https://www.pdfreaderpro.com/store/pdftecheditor")! let tWorkSpace: NSWorkspace = NSWorkspace.shared if !tWorkSpace.open(httpUrl as URL) { tWorkSpace.open(httpUrl as URL) } } @IBAction func activitiesCloseButtonAction(_ sender: NSButton) { self.activitiesBox.removeFromSuperview() } }