All NetworkComms.Net implementation can be found here and in ChatAppBase
Inheritance: ChatAppBase
Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// On load set the config as per the chat application
        /// </summary>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Remove the keyboard on a tap gesture
            var tap = new UITapGestureRecognizer();

            tap.AddTarget(() =>
            {
                this.View.EndEditing(true);
            });
            this.View.AddGestureRecognizer(tap);

            //Get a reference to the chat application
            ChatAppiOS chatApplication = ChatWindow.ChatApplication;

            //Update the settings based on previous values
            LocalServerEnabled.SetState(chatApplication.LocalServerEnabled, false);
            MasterIP.Text   = chatApplication.ServerIPAddress;
            MasterPort.Text = chatApplication.ServerPort.ToString();
            LocalName.Text  = chatApplication.LocalName;
            EncryptionEnabled.SetState(chatApplication.EncryptionEnabled, false);

            //Set the correct segment on the connection mode toggle
            ConnectionMode.SelectedSegment = (chatApplication.ConnectionType == ConnectionType.TCP ? 0 : 1);
        }
Ejemplo n.º 4
0
        /// <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();
        }