Blame view

Twear/Setting/NFC/GenerateBlankVC.swift 1.56 KB
66e7e76d   yangbin   NFC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  //
  //  GenerateBlankVC.swift
  //  Twear
  //
  //  Created by yangbin on 2022/2/12.
  //
  
  import UIKit
  
  class GenerateBlankVC: UIViewController {
      @IBOutlet weak var label: UILabel!
      var count: Int = 0
      override func viewDidLoad() {
          super.viewDidLoad()
          title = LocString("生成空白模拟卡")
          
          GCDTimer.shared.scheduledDispatchTimer(WithTimerName: "GenerateBlankNFC", timeInterval: 1, queue: .main, repeats: true) {[weak self] in
              self?.loading()
          }
          // Do any additional setup after loading the view.
      }
      
      func loading() {
          count += 1
          label.text = "\(LocString("正在生成..."))\(count*20)%"
          if count == 5 {
              GCDTimer.shared.cancleTimer(WithTimerName: "GenerateBlankNFC")
              self.showAlert(title: LocString("详情"), message: LocString("请找管理员写入数据,否则将会影响使用"), confirmText: LocString("知道了"), cancelText: nil, confirm: {[weak self] action in
                  let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "NFCMessageVC")
                  self?.navigationController?.pushViewController(vc, animated: true)
              })
          }
      }
      
  
      /*
      // MARK: - Navigation
  
      // In a storyboard-based application, you will often want to do a little preparation before navigation
      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
          // Get the new view controller using segue.destination.
          // Pass the selected object to the new view controller.
      }
      */
  
  }