/// <summary> /// On load initialise the example /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); //Subscribe to the keyboard events NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidHideNotification, HandleKeyboardDidHide); NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, HandleKeyboardDidShow); //Remove the keyboard if the screen is tapped var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { this.View.EndEditing(true); }); this.View.AddGestureRecognizer(tap); //Create the chat application instance ChatApplication = new ChatAppiOS(ChatHistory, MessageBox); //Uncomment this line to enable logging //EnableLogging(); //Set the default serializer to Protobuf ChatApplication.Serializer = DPSManager.GetDataSerializer <NetworkCommsDotNet.DPSBase.ProtobufSerializer>(); //Get the initial size of the chat view ChatApplication.OriginalViewSize = ChatView.Frame; //Print out the application usage instructions ChatApplication.PrintUsageInstructions(); //Initialise comms to add the necessary packet handlers ChatApplication.RefreshNetworkCommsConfiguration(); }
/// <summary> /// Update the settings when the user goes back to the main interface /// </summary> /// <returns></returns> public override void ViewDidDisappear(bool animated) { //Get a reference to the chat application ChatAppiOS chatApplication = ChatWindow.ChatApplication; //Parse settings and store back in chat application chatApplication.ServerIPAddress = MasterIP.Text.Trim(); int port = 10000; int.TryParse(MasterPort.Text, out port); chatApplication.ServerPort = port; chatApplication.LocalName = LocalName.Text.Trim(); chatApplication.EncryptionEnabled = EncryptionEnabled.On; chatApplication.LocalServerEnabled = LocalServerEnabled.On; if (ConnectionMode.SelectedSegment == 0) { chatApplication.ConnectionType = ConnectionType.TCP; } else { chatApplication.ConnectionType = ConnectionType.UDP; } //Refresh the NetworkComms.Net configuration once any changes have been made chatApplication.RefreshNetworkCommsConfiguration(); base.ViewDidDisappear(animated); }
/// <summary> /// On load initialise the example /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); //Subscribe to the keyboard events NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidHideNotification, HandleKeyboardDidHide); NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, HandleKeyboardDidShow); //Remove the keyboard if the screen is tapped var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { this.View.EndEditing(true); }); this.View.AddGestureRecognizer(tap); //Create the chat application instance ChatApplication = new ChatAppiOS(ChatHistory, MessageBox); //Uncomment this line to enable logging //EnableLogging(); //Set the default serializer to Protobuf ChatApplication.Serializer = DPSManager.GetDataSerializer<NetworkCommsDotNet.DPSBase.ProtobufSerializer>(); //Get the initial size of the chat view ChatApplication.OriginalViewSize = ChatView.Frame; //Print out the application usage instructions ChatApplication.PrintUsageInstructions(); //Initialise comms to add the necessary packet handlers ChatApplication.RefreshNetworkCommsConfiguration(); }