-
Notifications
You must be signed in to change notification settings - Fork 9
/
AppDelegate.m
52 lines (39 loc) · 1.31 KB
/
AppDelegate.m
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
47
48
49
50
51
52
//
// AppDelegate.m
// SDNet
//
// Created by Steven Degutis on 5/27/09.
// Copyright 2009 Thoughtful Tree Software. All rights reserved.
//
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize isWaiting;
@synthesize results;
- (void) applicationDidFinishLaunching:(NSNotification*)notification {
manager = [[SDTwitterTaskManager manager] retain];
manager.delegate = self;
manager.successSelector = @selector(twitterManager:resultsReadyForTask:);
manager.failSelector = @selector(twitterManager:failedForTask:);
manager.maxConcurrentTasks = 3;
}
- (IBAction) runTask:(id)sender {
manager.username = [userField stringValue];
manager.password = [passField stringValue];
SDTwitterTask *basicTask = [SDTwitterTask taskWithManager:manager];
basicTask.type = [[taskTypeButton selectedItem] tag];
[basicTask run];
self.isWaiting = YES;
}
- (void) twitterManager:(SDTwitterTaskManager*)manager resultsReadyForTask:(SDTwitterTask*)task {
self.isWaiting = NO;
self.results = task.results;
}
- (void) twitterManager:(SDTwitterTaskManager*)manager failedForTask:(SDTwitterTask*)task {
self.isWaiting = NO;
self.results = nil;
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert setMessageText:@"Error"];
[alert setInformativeText:[task.error localizedDescription]];
[alert runModal];
}
@end