Beispiel #1
0
 private void writeDetailsOnConsole(string description, int nFiles, int nDir)
 {
     TxtConsole.AppendText(description + PathFrom + Environment.NewLine +
                           nFiles + " Files" + Environment.NewLine +
                           nDir + " Directories" + Environment.NewLine
                           );
 }
Beispiel #2
0
        /// <summary>
        /// 將消息添加到消息列表中
        /// </summary>
        /// <param name="message"></param>
        public void WriteToConsole(string message)
        {
            if (TxtConsole.InvokeRequired)
            {
                TxtConsole.Invoke(new Action <string>((string msg) => TxtConsole.AppendText(message + Environment.NewLine)), message);
                return;
            }

            TxtConsole.AppendText(message + Environment.NewLine);
        }
Beispiel #3
0
 private void BtnRun_Click(object sender, EventArgs e)
 {
     if (PathFrom != null && PathTo != null)
     {
         setEnableOnOff(false);//disable groupbox,btn and txt
         backgroundWorker1.RunWorkerAsync();
     }
     else
     {
         TxtConsole.AppendText("You need to choose the folders" + Environment.NewLine);
     }
 }
Beispiel #4
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (socketServer.isRunning)
     {
         socketServer.isRunning = false;
         btnStart.Content       = "Başlat";
         logger.Info("Sunucu durduruldu.");
         TxtConsole.AppendText(string.Format("Sunucu Durduruldu. {0}", Environment.NewLine));
     }
     else
     {
         socketServer.Start();
         btnStart.Content = "Durdur";
         logger.Info("Sunucu başlatıldı.");
         TxtConsole.AppendText(string.Format("Sunucu Başlatıldı.{0}", Environment.NewLine));
     }
 }
 public void AddLine(string line, Color color)
 {
     try
     {
         TxtConsole.BeginInvoke(
             new Action(() =>
         {
             TxtConsole.SelectionColor = color;
             TxtConsole.AppendText(line + "\n");
             TxtConsole.ScrollToCaret();
         }
                        ));
     }
     catch (Exception)
     {
     }
 }
Beispiel #6
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                TxtConsole.AppendText("Process was cancelled" + Environment.NewLine);
            }
            else if (e.Error != null)
            {
                TxtConsole.AppendText("There was an error running the process. The thread aborted" + Environment.NewLine);
            }
            else
            {
                TxtConsole.AppendText("Process was completed" + Environment.NewLine);
            }
            setEnableOnOff(true);

            TxtConsole.SelectionStart = TxtConsole.Text.Length;
            TxtConsole.ScrollToCaret();
        }
Beispiel #7
0
 void HandleClientConnected(object sender, ClientConnectedEventArgs ccea)
 {
     TxtConsole.AppendText(string.Format("{0} - New client connected: {1}{2}", DateTime.Now, ccea.NewClient, Environment.NewLine));
 }