KMVerificationInfoViewController.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // KMVerificationInfoViewController.m
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by 王帅 on 2018/5/11.
  6. //
  7. #import "KMVerificationInfoViewController.h"
  8. #import <PDF_Reader_Pro-Swift.h>
  9. #import "VerificationManager.h"
  10. @interface KMVerificationInfoViewController ()
  11. @property (nonatomic, assign) IBOutlet NSTextField *label;
  12. @property (nonatomic, assign) IBOutlet NSTextField *licenseLabel;
  13. @property (nonatomic, assign) IBOutlet NSTextField *license;
  14. @property (nonatomic, assign) IBOutlet NSTextField *deviceLabel;
  15. @property (nonatomic, assign) IBOutlet NSTextField *device;
  16. @property (nonatomic, assign) IBOutlet KMCustomButton *continueButton;
  17. @property (assign) IBOutlet NSButton *unbindButton;
  18. @property (nonatomic, retain) CALayer *continueButtonLayer;
  19. @end
  20. @implementation KMVerificationInfoViewController
  21. #pragma mark Init Methods
  22. - (instancetype)init {
  23. if (self = [super initWithNibName:@"KMVerificationInfoViewController" bundle:nil]) {
  24. }
  25. return self;
  26. }
  27. - (void)dealloc {
  28. }
  29. #pragma mark Setter Methods
  30. - (void)loadView {
  31. [super loadView];
  32. // Do view setup here.
  33. self.continueButton.wantsLayer = YES;
  34. self.continueButton.layer.masksToBounds = YES;
  35. self.continueButton.layer.cornerRadius = 1.0;
  36. self.label.stringValue = NSLocalizedString(@"Successful Activation!", nil);
  37. self.licenseLabel.stringValue = NSLocalizedString(@"License ID:", nil);
  38. self.deviceLabel.stringValue = NSLocalizedString(@"UUID:", nil);
  39. self.continueButton.title = NSLocalizedString(@"Continue", nil);
  40. [self.continueButton setTitleColor:[NSColor whiteColor]];
  41. self.unbindButton.title = NSLocalizedString(@"Unbind License Code", nil);
  42. NSString *cdkey = [VerificationManager manager].detailInfo[@"device"][@"cdkey"];
  43. NSString *unique_sn = [VerificationManager manager].detailInfo[@"device"][@"unique_sn"];
  44. self.license.stringValue = cdkey ? : @"";
  45. self.device.stringValue = unique_sn ? : @"";
  46. self.continueButtonLayer = [CALayer layer];
  47. [self.continueButton.layer addSublayer:self.continueButtonLayer];
  48. self.continueButtonLayer.frame = CGRectMake(0, 0, CGRectGetWidth(_continueButton.bounds), CGRectGetHeight(_continueButton.bounds));
  49. self.continueButtonLayer.backgroundColor = [KMAppearance KMColor_Status_Sel].CGColor;
  50. self.continueButtonLayer.cornerRadius = 0;
  51. self.continueButtonLayer.hidden = YES;
  52. __block KMVerificationInfoViewController *blockSelf = self;
  53. self.continueButton.mouseMoveCallback = ^(BOOL mouseEntered) {
  54. if (mouseEntered)
  55. blockSelf.continueButtonLayer.hidden = NO;
  56. else
  57. blockSelf.continueButtonLayer.hidden = YES;
  58. };
  59. [self.label setTextColor:[KMAppearance KMColor_Layout_H0]];
  60. [self.licenseLabel setTextColor:[KMAppearance KM_242424_Color75]];
  61. [self.deviceLabel setTextColor:[KMAppearance KM_242424_Color75]];
  62. [self.license setTextColor:[KMAppearance KM_242424_Color75]];
  63. [self.device setTextColor:[KMAppearance KM_242424_Color75]];
  64. }
  65. #pragma mark - IBAction
  66. - (IBAction)continueButtonAction:(id)sender {
  67. if (self.callback) {
  68. self.callback();
  69. }
  70. }
  71. - (IBAction)unbindAction:(NSButton *)sender {
  72. if (self.unbindAction) {
  73. self.unbindAction();
  74. }
  75. }
  76. @end