Add Subscribe Class

Subscribe Class Now Can download the Server Profiles To local.
TODO add manual update subscribe and period update subscribe
and finish subscribe manager functions
This commit is contained in:
秦宇航
2017-07-13 22:20:54 +08:00
parent 5027ef621e
commit 75d71ae3a2
5 changed files with 131 additions and 30 deletions
@@ -12,16 +12,30 @@ class SubscribePreferenceWindowController: NSWindowController {
@IBOutlet weak var FeedLabel: NSTextField!
@IBOutlet weak var OKButton: NSButton!
@IBOutlet weak var FeedTextField: NSTextField!
@IBOutlet weak var TokenTextField: NSTextField!
@IBOutlet weak var GroupTextField: NSTextField!
@IBOutlet weak var MaxCountTextField: NSTextField!
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.
// TODO load stored subscribes and prepare the manager
}
@IBAction func onOk(_ sender: NSButton) {
print(FeedTextField.stringValue)
// TODO append to manager and save
var subscribe = Subscribe.init(initUrlString: FeedTextField.stringValue, initGroupName: GroupTextField.stringValue, initToken: TokenTextField.stringValue, initMaxCount: MaxCountTextField.integerValue)
window?.performClose(self)
}
func bindSubscribe(index: Int){
if index >= 0 && index <= SubscribeManager.instance.subscribes.count {
var editSubscribe = SubscribeManager.instance.subscribes[index]
FeedTextField.bind("value", to: editSubscribe, withKeyPath: "subscribeFeed", options: [NSContinuouslyUpdatesValueBindingOption: true])
}
}
}