コード例 #1
0
 private void backgroundWorker1_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
 {
     progressBar1.Value += 1;
     TxtConsole.AppendText(e.UserState as string + Environment.NewLine);
     TxtConsole.SelectionStart = TxtConsole.Text.Length;
     TxtConsole.ScrollToCaret();
 }
コード例 #2
0
 private void writeDetailsOnConsole(string description, int nFiles, int nDir)
 {
     TxtConsole.AppendText(description + PathFrom + Environment.NewLine +
                           nFiles + " Files" + Environment.NewLine +
                           nDir + " Directories" + Environment.NewLine
                           );
 }
コード例 #3
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);
        }
コード例 #4
0
ファイル: Console.cs プロジェクト: Wo1fTech/Wo1f_Framework
 void CS_ConsoleLog(string Text)
 {
     if (TxtConsole.InvokeRequired)
     {
         TxtConsole.Invoke(new LogD(CS_ConsoleLog), Text);
     }
     else
     {
         TxtConsole.Text = Text + "\r\n" + TxtConsole.Text;
     }
 }
コード例 #5
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);
     }
 }
コード例 #6
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));
     }
 }
コード例 #7
0
 public void AddLine(string line, Color color)
 {
     try
     {
         TxtConsole.BeginInvoke(
             new Action(() =>
         {
             TxtConsole.SelectionColor = color;
             TxtConsole.AppendText(line + "\n");
             TxtConsole.ScrollToCaret();
         }
                        ));
     }
     catch (Exception)
     {
     }
 }
コード例 #8
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();
        }
コード例 #9
0
 void HandleClientConnected(object sender, ClientConnectedEventArgs ccea)
 {
     TxtConsole.AppendText(string.Format("{0} - New client connected: {1}{2}", DateTime.Now, ccea.NewClient, Environment.NewLine));
 }
コード例 #10
0
 public void Clear()
 {
     TxtConsole.Clear();
 }