예제 #1
0
        /// <summary>
        /// Method handling the network communication between client and server.
        /// Receives a byte containing the location of a download to begin, then spawns an instance of the Download class to initiate the download process.
        /// </summary>
        private void Communicate()
        {
            byte[] receivedBytes = new byte[65536];

            NetworkStream ns = _Client.GetStream();
            int size = (int)_Client.ReceiveBufferSize;
            ns.Read(receivedBytes, 0, size);
            receivedData = System.Text.Encoding.ASCII.GetString(receivedBytes).Substring(0, 32);

            Download d = new Download(receivedData);
        }
예제 #2
0
 /// <summary>
 /// Called when the Start button is clicked.
 /// Instantiates a Download class to get the selected product in the list.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_Start_Click(object sender, EventArgs e)
 {
     if (purchasedItems.SelectedIndices.Count == 0)
     {
         string location = DbConnect.GetLocationFromProductId(lookup[purchasedItems.SelectedIndex]);
         if (!String.IsNullOrEmpty(location))
         {
             Download d = new Download(location);
         }
     }
 }