-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAppDelegate.m
executable file
·159 lines (125 loc) · 5.26 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
//
// AppDelegate.m
// RombergLab
//
// Created by Jorge Rey Martínez on 29/11/15.
// Copyright © 2015 Jorge Rey Martínez. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
@synthesize myWindowControllerA;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
[self.MenuModo setEnabled:NO];
//ASUNTOS LEGALES Y SEGURIDAD
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
if (! [defaults boolForKey:@"notFirstRun"]) {
[defaults setBool:YES forKey:@"notFirstRun"];
NSAlert *alert = [[NSAlert alloc] init];
NSString *userLocale = [[NSLocale currentLocale] localeIdentifier];
NSString *userLanguage = [userLocale substringToIndex:2];
if([userLanguage isEqualToString:@"es"]){
[alert setMessageText:@"Pulse OK si está de acuerdo con los términos de uso de este programa.\r\rSi continua ejecutando este progama acepta dichos términos.\r\rNo use este programa si no está de acuerdo con sus términos de uso"];
[alert setInformativeText:@"Puede encontrar estos términos en el menú 'Acerca' de esta aplicacion"];
}
else{
[alert setMessageText:@"Press OK if you are in agreement with the terms of use of this software.\r\rIf you continue using this software you accept this terms.\r\rDo not use this software if you are not in agreement with this terms"];
[alert setInformativeText:@"You can find this terms written on the 'About' menu of this software"];
}
[alert addButtonWithTitle:@"OK"];
[alert runModal];
}
else {
// [defaults setBool:NO forKey:@"notFirstRun"]; //ACTIVAR SOLO EN PRUEBAS
}
// FIN LEGALES SEGUIR NORMAL
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reconectaActivo:)
name:@"ConexiónApagada"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(menuModoActivo:)
name:@"MenuModoActivo"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(menuModoInactivo:)
name:@"MenuModoInactivo"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(iniciarlibre:)
name:@"PruebaTerminada"
object:nil];
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
- (IBAction)menuconexion:(id)sender{
if (reconectarOn){
[[NSNotificationCenter defaultCenter]
postNotificationName:@"MenuConexión"
object:nil];}
}
-(void)reconectaActivo:(id)sender{
reconectarOn = YES;
}
-(void)iniciarlibre:(id)sender{
[self performSelector: @selector(itemnormal:) withObject:self afterDelay: 0.0];
}
-(void)menuModoActivo:(id)sender{
[self.MenuModo setEnabled:YES];
}
-(void)menuModoInactivo:(id)sender{
[self.MenuModo setEnabled:NO];
}
- (IBAction)itemweb:(id)sender{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://mlibra.com/"]];
}
- (IBAction)itemwebValidation:(id)sender {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://doi.org/10.1080/00016489.2016.1204665"]];
}
- (IBAction)itemwebNormalization:(id)sender {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://doi.org/10.1007/s00405-018-5170-6"]];
}
- (IBAction)itemnormal:(id)sender {
[[NSNotificationCenter defaultCenter]
postNotificationName:@"ItemNormal"
object:nil];
}
- (IBAction)itemposturografia:(id)sender {
[[NSNotificationCenter defaultCenter]
postNotificationName:@"ItemPosturografia"
object:nil];
}
- (IBAction)lostest:(id)sender {
[[NSNotificationCenter defaultCenter]
postNotificationName:@"ItemLosTest"
object:nil];
}
- (IBAction)losduro:(id)sender {
[[NSNotificationCenter defaultCenter]
postNotificationName:@"ItemLosDuro"
object:nil];
}
- (IBAction)losmedio:(id)sender {
[[NSNotificationCenter defaultCenter]
postNotificationName:@"ItemLosMedio"
object:nil];
}
- (IBAction)losflojo:(id)sender{
[[NSNotificationCenter defaultCenter]
postNotificationName:@"ItemLosFlojo"
object:nil];
}
- (IBAction)itemexit:(id)sender{
[[NSNotificationCenter defaultCenter]
postNotificationName:@"Terminando"
object:nil];
}
- (IBAction)externalData:(id)sender {
NSStoryboard *storyBoard = [NSStoryboard storyboardWithName:@"Main" bundle:nil]; // get a reference to the storyboard
myWindowControllerA = [storyBoard instantiateControllerWithIdentifier:@"SextaVentana"]; // instantiate your window controller
[myWindowControllerA showWindow:self];
}
@end