Пример #1
0
        private void OutputToTextBox(string log)
        {
            //if (TBLog.GetLineFromCharIndex(TBLog.Text.Length) > 100)
            //    TBLog.Text = "";

            TBLog.AppendText(DateTime.Now.ToString("HH:mm:ss  ") + log + "\r\n");
        }
Пример #2
0
        void AtualizaJanela(object sender, EventArgs e)
        {
            if (ServidorON == true)
            {
                BTConectaAoServidor.IsEnabled    = false;
                BTDesconectaDoServidor.IsEnabled = true;
                TBEnvia.IsEnabled = true;
                BTEnvia.IsEnabled = true;
            }
            else
            {
                BTConectaAoServidor.IsEnabled    = true;
                BTDesconectaDoServidor.IsEnabled = false;
                TBEnvia.IsEnabled = false;
                BTEnvia.IsEnabled = false;

                if (tx != null && receptor != null)
                {
                    tx.Close();
                    receptor.Interrupt();
                }
            }

            if (linhaAtual < linhas.Count())
            {
                for (int i = linhaAtual; i < linhas.Count(); i++)
                {
                    TBLog.AppendText(linhas[i] + '\n');
                    linhaAtual++;
                }
                TBLog.ScrollToEnd();
            }
        }
Пример #3
0
 public void AppendLog(string text)
 {
     Dispatcher.Invoke(() =>
     {
         TBLog.AppendText(text + Environment.NewLine);
         TBLog.ScrollToEnd();
     });
 }
Пример #4
0
 void AtualizaJanela(object sender, EventArgs e)
 {
     if (linhaAtual < linhas.Count())
     {
         for (int i = linhaAtual; i < linhas.Count(); i++)
         {
             TBLog.AppendText(linhas[i] + '\n');
             linhaAtual++;
         }
         TBLog.ScrollToEnd();
     }
 }
Пример #5
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            excelApp         = new Microsoft.Office.Interop.Excel.Application();
            excelApp.Visible = true;
            workbook1        = excelApp.Workbooks.Open(filepath.Text);
            worksheet1       = workbook1.ActiveSheet;
            while (!Equals(((Range)worksheet1.Cells[n, 1]).Text, ""))
            {
                string a = ((Range)worksheet1.Cells[n, 1]).Text;
                names.Add(a);
                n++;
            }
            TBLog.Clear();
            foreach (var name in names)
            {
                var temp = false;

                foreach (var file in AllFileNames)
                {
                    if (file.Contains(name))
                    {
                        //FileInfo fi1 = new FileInfo(file);
                        // fi1.CopyTo(TBTargetFolderPath+@"\" + System.IO.Path.GetFileName(file));
                        var a = System.IO.Path.GetFileName(file);
                        var b = TBTargetFolderPath.Text + @"\" + a;
                        System.IO.File.Copy(file, b, true);
                        temp = true;
                    }
                }
                if (!temp)
                {
                    i++;
                    TBLog.AppendText(i + ":" + name + "未找到\n");
                    //System.Windows.MessageBox.Show(i + ":" + name + "未找到\n");
                }
            }
        }