Ejemplo n.º 1
0
Archivo: Form1.cs Proyecto: 3505VFD/VFD
 /// <summary>
 /// Input button for sending messages to the server from the network text box
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void InputEnterButton_Click(object sender, EventArgs e)
 {
     // Send the filename to the server that the user requests
     if (networkInputTextbox.Text.Length > 1)
     {
         networkInfoTextBox1.Text = networkInfoTextBox1.Text + "\n" + networkInputTextbox.Text;
         StaticNetworking.Send(spreadsheetState.Socket, networkInputTextbox.Text + "\n");
     }
 }
Ejemplo n.º 2
0
Archivo: Form1.cs Proyecto: 3505VFD/VFD
        /// <summary>
        /// Receive the updates to the state from the server and process updates.
        /// </summary>
        /// <param name="state"></param>
        public void ReceiveSpreadsheetUpdates(SocketState state)
        {
            state.callMe = ReceiveSpreadsheetUpdates;
            StaticNetworking.GetData(state);

            // Retrieve string message from state
            //string[] s = state.SB.ToString().Split('\n');
            //Byte[] b = state.MessageBuffer;

            // Lock the spreadsheet while data processes
            // Process data

            // Clear the stringbuilder for the next round of messages from the server
        }
Ejemplo n.º 3
0
Archivo: Form1.cs Proyecto: 3505VFD/VFD
        /// <summary>
        /// Receive the startup information from the server and process.
        /// </summary>
        /// <param name="state"></param>
        public void ReceiveStartup(SocketState state)
        {
            state.callMe = ReceiveInitialSpreadsheet;
            StaticNetworking.GetData(state);
            spreadsheetState = state;

            // Retrieve string message from state
            Byte[]   b = state.MessageBuffer;
            string[] s = state.SB.ToString().Split('\t');

            // Lock the spreadsheet while data processes
            lock (spreadsheetState)
            {
                // Process startup data for requesting file from server
                openOrCreateFile(b, s);
            }

            // Clear the stringbuilder for the next round of messages from the server
            state.SB.Clear();
        }
Ejemplo n.º 4
0
Archivo: Form1.cs Proyecto: 3505VFD/VFD
 private void DoWork(object sender, DoWorkEventArgs e)
 {
     //Connect to the server
     StaticNetworking.ConnectToServer(FirstContact, IPTextBox.Text);
 }
Ejemplo n.º 5
0
Archivo: Form1.cs Proyecto: 3505VFD/VFD
        // SERVER CONNECTION WORK BEGINS HERE

        /// <summary>
        /// Initial handshake with the server
        /// </summary>
        /// <param name="state"></param>
        public void FirstContact(SocketState state)
        {
            state.callMe = ReceiveStartup;
            StaticNetworking.Send(state.Socket, UsernameTextBox.Text + "\n");
        }