public override void ViewDidLoad (){
			this.Title = "My ID Key";
			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
			NavigationItem.SetRightBarButtonItem (scanButton,false);
			this.SetupButtons ();
			base.ViewDidLoad ();
		}
		public override void ViewDidLoad (){

			base.ViewDidLoad ();
			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

			this.confirmationCodeButton.TouchUpInside += (sender, e) => {
				this.appDelegate.GoToView(this.appDelegate.confirmationView);
			};

			this.resendButton.TouchUpInside += (sender, e) => {
				this.appDelegate.alert.showOkAlert("Resend Verification","");
			};

		}
		public override void ViewDidLoad (){
			this.Title = "Settings";
			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
			base.ViewDidLoad ();

		}
		public CustomCellTableSource(List<CustomCellGroup> cellGroupList)
		{
			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
			this.CellGroups = cellGroupList;
		}
		public override void ViewDidLoad (){
			SetupButtons ();
			this.Title = "Contact Detail";
			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
			this.contactPictureImage.Layer.CornerRadius = 32.0f;
			base.ViewDidLoad ();
		}
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();
			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
			var g = new UITapGestureRecognizer(() => View.EndEditing(true));
			View.AddGestureRecognizer(g);

			confCodeInput.Selected = true;

			done.TouchUpInside += (sender, e) => {
				confCodeInput.ShouldReturn += (textField) => { 
					textField.ResignFirstResponder();
					return true;
				};
				ShowProcessingView();
				StartProcessing();
			};
		}
		public override void ViewDidLoad()
		{

			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

			NavigationItem.SetRightBarButtonItem(filterButton, false);
			NavigationItem.SetLeftBarButtonItem(cancelButton, false);

			AddTableRefresh();
			ButtonActions();

			base.ViewDidLoad();
			search.CancelButtonClicked += (sender, e) => {
				search.Text = "";
				search.ResignFirstResponder();
				search.SetShowsCancelButton(false, true);
				PopulateTableWithExistingContactsData();
				AddTableRefresh();
			};
			search.TextChanged += async (object sender, UISearchBarTextChangedEventArgs e) => {
				search.SetShowsCancelButton(true, true);
				string searchText = e.SearchText.ToLower();
				Console.WriteLine("Search text = " + e.SearchText);
				if (!e.SearchText.Equals("")) {
					if (filter == "Securecom users") {
						new Thread(new System.Threading.ThreadStart(() => InvokeOnMainThread(() => ProcessSearchOnSecurecomContacts(searchText)))).Start();
					} else if (filter == "Show All") {
							ProcessSearchOnAllContacts(searchText);
						}

				} else {
					PopulateTableWithExistingContactsData();
				}
				AddTableRefresh();
			};
		}
		public override void ViewDidLoad()
		{
			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
			this.registerMode = this.appDelegate.MODE_REGISTER_PHONE;
			this.EmailRegisterView.ContentSize = new SizeF(320, 700);
			this.PhoneRegisterView.ContentSize = new SizeF(320, 700);
			base.ViewDidLoad();

			var g = new UITapGestureRecognizer(() => View.EndEditing(true));
			View.AddGestureRecognizer(g);
	
			this.Continue.TouchUpInside += (sender, e) => {
				appDelegate.GoToView(appDelegate.verificationView);
			};

			this.PhChooseOptionButton.TouchUpInside += (sender, e) => {
				PickRegisterOption();
			};

			this.EmChooseOptionButton.TouchUpInside += (sender, e) => {
				PickRegisterOption();
			};

			this.PhRegister.TouchUpInside += (sender, e) => {
				ConfirmPhoneRegistration();
			};

			this.EmRegister.TouchUpInside += (sender, e) => {
				ConfirmEmailRegistration();
			};

			this.Edit.TouchUpInside += (sender, e) => {
				this.processingView.Hidden = true;
				this.PhPhoneNumberInput.BecomeFirstResponder();
			};

			this.EmEmailInput.ShouldReturn += (textField) => {
				textField.ResignFirstResponder();
				return true;
			};

			this.PhPhoneNumberInput.ShouldReturn += (textField) => { 
				textField.ResignFirstResponder();
				return true;
			};

			this.Continue.TouchUpInside += (sender, e) => {
				String phoneNumber = PhPhoneNumberInput.Text;
				bool isEmail = false;
				phoneNumber = (registerMode == 0) ? PhPhoneNumberInput.Text : EmEmailInput.Text;
				isEmail = (registerMode != 0);
				appDelegate.CreateMessageManager(phoneNumber);
				try{
					MessageManager.CreateAccount(phoneNumber, isEmail);
				}catch(WebException we){
					appDelegate.GoToView(appDelegate.registrationView);
					UIAlertView alert = new UIAlertView("Error!", "Please enter a valid phone number!", null, "Ok");
					alert.Show();
				}
			};
		}
		public override void ViewDidLoad()
		{

			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
			NavigationItem.SetRightBarButtonItem(lockButton, false);
			this.center = NSNotificationCenter.DefaultCenter;

			EndEditing();
			SetupButtons();

			InitExpandableTextView();
			AddExpandableAccessoryView();
			SetExpandableTextViewSize();

			var g = new UITapGestureRecognizer(() => View.EndEditing(true));
			View.AddGestureRecognizer(g);

			center.AddObserver(
				UIKeyboard.WillHideNotification, (notify) => { 
				try {
					isKeyboardVisible = false;
					var keyboardBounds = (NSValue)notify.UserInfo.ObjectForKey(UIKeyboard.BoundsUserInfoKey);
					var keyboardSize = keyboardBounds.RectangleFValue;
					this.keyboardHeight = keyboardSize.Height;
					SetTableSize();
					AnimateToolbar();	
				} catch (Exception ex) {
					Console.Write(ex.Message);
				}
			}
			);	


			center.AddObserver(
				UIKeyboard.WillShowNotification, (notify) => { 
				try {
					this.toolbarFakeMessage.Hidden = true;
					this.accessoryTextView.BecomeFirstResponder();

					isKeyboardVisible = true;

					var keyboardBounds = (NSValue)notify.UserInfo.ObjectForKey(UIKeyboard.BoundsUserInfoKey);
					var keyboardSize = keyboardBounds.RectangleFValue;
					this.keyboardHeight = keyboardSize.Height;

					CheckEmptyTextView();
					SetTableSize();

					this.accessoryTextView.BecomeFirstResponder();
				} catch (Exception ex) {
					Console.Write(ex.Message);
				}
			}
			);	
		}
		public override void ViewDidLoad (){
			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
			SetupUiElements ();
			base.ViewDidLoad ();
		}
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();
			this.appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

			appDelegate.chatView.setThreadID(0);

			ShowEditButton();

			this.composeButton.Clicked += (sender, e) => {
				ComposeAction();
			};
		
			this.editButton.Clicked += (sender, e) => {
				ShowDoneButton();
			};

			this.doneButton.Clicked += (sender, e) => {
				ShowEditButton();
			};

			this.keysButton.Clicked += (sender, e) => {
				this.appDelegate.GoToView(this.appDelegate.myIdKeyView);
			};


			this.markAllReadButton.Clicked += (sender, e) => {
				this.appDelegate.alert.showOkAlert("Mark All Read", "Marking all chat messages as read.");
			};

			settingsButton.Clicked += (sender, e) => {
				//this.appDelegate.GoToView(this.appDelegate.settingsView);
				SettingsAction();
			};

			search.CancelButtonClicked += (sender, e) => {
				search.Text = "";
				search.ResignFirstResponder();
				search.SetShowsCancelButton(false, true);
				PopulateTable();
			};

			search.TextChanged += async (object sender, UISearchBarTextChangedEventArgs e) => {
				search.SetShowsCancelButton(true, true);
				String searchText = e.SearchText.ToLower();
				if (e.SearchText.Equals("")) {
					PopulateTable();
					return;
				}
				List<CustomCellGroup> mCellGroups = new List<CustomCellGroup>();
				CustomCellGroup mTableCellGroup = new CustomCellGroup();
				int count = 0;
				foreach (PushChatThread thread in pct) {
					if (String.IsNullOrEmpty(thread.Number))
						continue;
					if (!thread.Number.ToLower().Contains(searchText) && !thread.DisplayName.ToLower().Contains(searchText))
						continue;
					
					ChatCell chatCell = ChatCell.Create();
					chatCell.SetHeader(thread.DisplayName + " (" + thread.Number + ")");
					chatCell.SetSubheading(thread.Snippet);
					chatCell.SetThreadID(thread.ID);
					chatCell.SetNumber(thread.Number);
					chatCell.SetAvatar(null);
					DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(thread.TimeStamp / 1000).ToLocalTime();
					chatCell.SetLabelTime(epoch.ToString("HH:mm"));
					chatCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
					mTableCellGroup.Cells.Insert(count, chatCell);
					count++;
				}
					
				mTableCellGroup.Name = (count == 0) ? "No Results" : "Search Results";
				mCellGroups.Add(mTableCellGroup);

				source = new CustomCellTableSource(mCellGroups);
				source.RowSelectedAction = RowSelected;
				source.DeleteAction = DeleteSelected;
				source.DeleteTitle = "Delete";
				table.Source = source;
				table.ReloadData();
			};

		}