133 lines
3.7 KiB
Objective-C
133 lines
3.7 KiB
Objective-C
//
|
||
// AlarmViewController.m
|
||
// k-observer-iphone
|
||
//
|
||
// Created by vvv ооо on 26.08.12.
|
||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||
//
|
||
|
||
#import "AlarmViewController.h"
|
||
#import "AppDelegate.h"
|
||
#import "ProfileViewController.h"
|
||
|
||
AppDelegate* appDelegate;
|
||
|
||
@interface AlarmViewController ()
|
||
|
||
@end
|
||
|
||
@implementation AlarmViewController
|
||
|
||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||
{
|
||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||
if (self)
|
||
{
|
||
// Custom initialization
|
||
}
|
||
return self;
|
||
}
|
||
|
||
- (void)viewDidLoad
|
||
{
|
||
[super viewDidLoad];
|
||
// Do any additional setup after loading the view from its nib.
|
||
|
||
UIScrollView *tempScrollView=(UIScrollView *)self.view;
|
||
|
||
tempScrollView.contentSize=CGSizeMake(320, 700);
|
||
|
||
}
|
||
|
||
- (void)viewDidUnload
|
||
{
|
||
[super viewDidUnload];
|
||
// Release any retained subviews of the main view.
|
||
// e.g. self.myOutlet = nil;
|
||
}
|
||
|
||
-(void)viewDidAppear:(BOOL)animated
|
||
{
|
||
if ([appDelegate.observerClient GetMapState] >= 1)
|
||
{
|
||
[appDelegate.profileViewController SwitchAlarmSelector:YES];
|
||
}
|
||
|
||
if ([appDelegate.observerClient GetMapState] == 1)
|
||
{
|
||
[appDelegate.observerClient SetMapState:2];
|
||
[appDelegate.observerClient SendMessage:@"ТРЕВОГА (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
|
||
}
|
||
|
||
}
|
||
|
||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||
{
|
||
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
||
}
|
||
|
||
- (void)finishEditingMessage
|
||
{
|
||
[self.view endEditing:YES];
|
||
self.navigationItem.rightBarButtonItem = nil;
|
||
}
|
||
|
||
- (IBAction)OnRejectPressed
|
||
{
|
||
[appDelegate.observerClient SetMapState:3];
|
||
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: УДАЛЕНИЕ С УИК (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
|
||
[appDelegate.profileViewController SwitchAlarmSelector:YES];
|
||
}
|
||
|
||
- (IBAction)OnThrowPressed
|
||
{
|
||
[appDelegate.observerClient SetMapState:4];
|
||
[appDelegate.profileViewController SwitchAlarmSelector:YES];
|
||
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: ВБРОС (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
|
||
}
|
||
|
||
- (IBAction)OnCarouselPressed
|
||
{
|
||
[appDelegate.observerClient SetMapState:5];
|
||
[appDelegate.profileViewController SwitchAlarmSelector:YES];
|
||
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: КАРУСЕЛЬ (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
|
||
}
|
||
|
||
- (IBAction)OnAssaultPressed
|
||
{
|
||
[appDelegate.observerClient SetMapState:6];
|
||
[appDelegate.profileViewController SwitchAlarmSelector:YES];
|
||
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: НАПАДЕНИЕ (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
|
||
}
|
||
|
||
- (IBAction)OnOtherPressed
|
||
{
|
||
[appDelegate.observerClient SetMapState:2];
|
||
[appDelegate.profileViewController SwitchAlarmSelector:YES];
|
||
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: ДРУГОЕ (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
|
||
}
|
||
|
||
- (IBAction)OnSendAdditionalMessage
|
||
{
|
||
UITextView* textView = (UITextView*)[self.view viewWithTag:2];
|
||
|
||
NSString* msg = textView.text;
|
||
|
||
if (![msg isEqualToString:@""])
|
||
{
|
||
|
||
[textView setText:@""];
|
||
[appDelegate.observerClient SendMessage:msg];
|
||
}
|
||
}
|
||
|
||
- (void)textViewDidBeginEditing:(UITextView *)textView
|
||
{
|
||
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Готово" style:UIBarButtonItemStylePlain target:self action:@selector(finishEditingMessage)];
|
||
|
||
self.navigationItem.rightBarButtonItem = anotherButton;
|
||
}
|
||
|
||
|
||
@end
|