KMAccountExceptionWindowController.swift 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // KMAccountExceptionWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lizhe on 2023/9/4.
  6. //
  7. import Cocoa
  8. var accountExceptionController: KMAccountExceptionWindowController?
  9. var accountExceptionMainWindow: NSWindow?
  10. class KMAccountExceptionWindowController: NSWindowController {
  11. @IBOutlet weak var accountExceptionView: KMAccountExceptionView!
  12. override func windowDidLoad() {
  13. super.windowDidLoad()
  14. self.setup()
  15. // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
  16. }
  17. //MARK: 打开文件
  18. static func show(window: NSWindow) -> KMAccountExceptionWindowController {
  19. let controller: KMAccountExceptionWindowController = KMAccountExceptionWindowController.init(windowNibName: "KMAccountExceptionWindowController")
  20. window.beginSheet(controller.window!)
  21. controller.window?.center()
  22. accountExceptionController = controller
  23. accountExceptionMainWindow = window
  24. return controller
  25. }
  26. func setup() {
  27. self.window?.contentView?.backgroundColor(NSColor.km_init(hex: "#FFFFFF"))
  28. self.accountExceptionView.cancelAction = { view in
  29. cancellationMainWindow?.endSheet(view.window!)
  30. view.window?.close()
  31. accountExceptionMainWindow = nil
  32. accountExceptionController = nil
  33. }
  34. }
  35. }