mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-23 14:52:24 +00:00
57 lines
1.4 KiB
Mathematica
57 lines
1.4 KiB
Mathematica
|
//
|
||
|
// NetworkInfoCell.m
|
||
|
// ZeroTier One
|
||
|
//
|
||
|
// Created by Grant Limberg on 8/7/16.
|
||
|
// Copyright © 2016 ZeroTier, Inc. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "NetworkInfoCell.h"
|
||
|
#import "ServiceCom.h"
|
||
|
#import "ShowNetworksViewController.h"
|
||
|
#import "Network.h"
|
||
|
|
||
|
@implementation NetworkInfoCell
|
||
|
|
||
|
- (void)drawRect:(NSRect)dirtyRect {
|
||
|
[super drawRect:dirtyRect];
|
||
|
|
||
|
// Drawing code here.
|
||
|
}
|
||
|
|
||
|
- (IBAction)onConnectCheckStateChanged:(NSButton*)sender
|
||
|
{
|
||
|
if(sender.state == NSOnState) {
|
||
|
[self joinNetwork:self.networkIdField.stringValue];
|
||
|
}
|
||
|
else {
|
||
|
[self leaveNetwork:self.networkIdField.stringValue];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- (IBAction)deleteNetwork:(NSButton*)sender;
|
||
|
{
|
||
|
[self leaveNetwork:self.networkIdField.stringValue];
|
||
|
[self.parent deleteNetworkFromList:self.networkIdField.stringValue];
|
||
|
}
|
||
|
|
||
|
- (IBAction)onAllowStatusChanged:(NSButton*)sender
|
||
|
{
|
||
|
[self joinNetwork:self.networkIdField.stringValue];
|
||
|
}
|
||
|
|
||
|
- (void)joinNetwork:(NSString*)nwid
|
||
|
{
|
||
|
[[ServiceCom sharedInstance] joinNetwork:nwid
|
||
|
allowManaged:(self.allowManaged.state == NSOnState)
|
||
|
allowGlobal:(self.allowGlobal.state == NSOnState)
|
||
|
allowDefault:![Network defaultRouteExists:_parent.networkList] && (self.allowDefault.state == NSOnState)];
|
||
|
}
|
||
|
|
||
|
- (void)leaveNetwork:(NSString*)nwid
|
||
|
{
|
||
|
[[ServiceCom sharedInstance] leaveNetwork:nwid];
|
||
|
}
|
||
|
|
||
|
@end
|