1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- //
- // KMCloseAccountWC.swift
- // PDF Reader Pro
- //
- // Created by wanjun on 2024/11/5.
- //
- import Cocoa
- class KMCloseAccountWC: NSWindowController {
-
- @IBOutlet weak var titleLabel: NSTextField!
- @IBOutlet weak var subTitleLabel: NSTextField!
- @IBOutlet weak var productBox: NSBox!
- @IBOutlet weak var productView: NSView!
- @IBOutlet weak var productLabel: NSTextField!
- @IBOutlet weak var proView: NSView!
- @IBOutlet weak var proLabel: NSTextField!
- @IBOutlet weak var aiView: NSView!
- @IBOutlet weak var aiLabel: NSTextField!
- @IBOutlet weak var yesButton: NSButton!
- @IBOutlet weak var cancelButton: NSButton!
- private var viewModel = KMUserInfoVCModel()
-
- static let shared: KMCloseAccountWC = {
- let windowC = KMCloseAccountWC(windowNibName: "KMCloseAccountWC")
- return windowC
- }()
- override func windowDidLoad() {
- super.windowDidLoad()
- // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
-
- // self.window?.backgroundColor = NSColor.gray
-
- languageLocalized()
- initializeUI()
- }
-
- // MARK: Private Method
-
- private func languageLocalized() -> Void {
- titleLabel.stringValue = NSLocalizedString("删除您的账号和相关授权", tableName: "MemberCenterLocalizable", comment: "")
- subTitleLabel.stringValue = NSLocalizedString("注销账号会永久删除一切账号数据,包括您在此账号下购买的其他端的PDF Reader Pro的权益。您确定要继续吗?", tableName: "MemberCenterLocalizable", comment: "")
- productLabel.stringValue = NSLocalizedString("您的产品与服务:", tableName: "MemberCenterLocalizable", comment: "")
- proLabel.stringValue = KMMemberInfo.shared.vip_productName
- aiLabel.stringValue = KMMemberInfo.shared.ai_productName
- cancelButton.title = NSLocalizedString("取消", tableName: "MemberCenterLocalizable", comment: "")
- yesButton.title = NSLocalizedString("删除我的账户", tableName: "MemberCenterLocalizable", comment: "")
- }
-
- private func initializeUI() -> Void {
- titleLabel.textColor = NSColor(named: "000000_0.85")
- titleLabel.font = NSFont.SFProTextSemiboldFont(13)
- subTitleLabel.textColor = NSColor(named: "000000_0.85")
- subTitleLabel.font = NSFont.SFProTextRegularFont(12)
- productBox.borderColor = NSColor(named: "DADBDE") ?? .gray
- productBox.fillColor = .gray
- productLabel.textColor = NSColor(named: "42464D")
- productLabel.font = NSFont.SFProTextRegularFont(13)
- if KMMemberInfo.shared.ai_productName == "" {
- aiView.isHidden = true
- }
- aiLabel.textColor = NSColor(named: "42464D")
- aiLabel.font = NSFont.SFProTextRegularFont(13)
- yesButton.setTitleColor(color: NSColor(named: "000000") ?? NSColor.white, font: NSFont.SFProTextRegularFont(13))
- cancelButton.setTitleColor(color: NSColor(named: "FFFFFF") ?? NSColor.white, font: NSFont.SFProTextRegularFont(13))
- }
-
- // MARK: Button Action
-
- @IBAction func cancelButtonAction(_ sender: NSButton) {
- self.window?.close()
- }
-
- @IBAction func yesButtonAction(_ sender: NSButton) {
- self.window?.close()
- viewModel.deleteAccountWC()
- }
- }
|