Exemplo n.º 1
0
        private void TransferButton_Click(object sender, EventArgs e)
        {
            var count = InputTextBox.Text.Count(Char.IsDigit);

            string[] TextToTransfer = new string[count];

            OutputTextBox.Clear();

            using (StringReader reader = new StringReader(InputTextBox.Text))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    // Do something with the line
                    line = _defaultPhrase + SpacesPhrase + line;

                    if (!string.IsNullOrWhiteSpace(OutputTextBox.Text))
                    {
                        OutputTextBox.AppendText("\r\n" + line);
                    }
                    else
                    {
                        OutputTextBox.AppendText(line);
                    }
                    OutputTextBox.ScrollToCaret();
                }
            }
        }
Exemplo n.º 2
0
 public void Task_OutputDataRecieved(object sender, DataReceivedEventArgs args)
 {
     if (!this.IsDisposed)
     {
         this.Invoke(new MethodInvoker(delegate {
             if (!String.IsNullOrEmpty(args.Data))
             {
                 OutputTextBox.AppendText(args.Data + Environment.NewLine);
                 OutputTextBox.ScrollToCaret();
             }
         }));
     }
 }
Exemplo n.º 3
0
 private void AppendText(string text)
 {
     if (OutputTextBox.InvokeRequired)
     {
         SetTextCallback d = new SetTextCallback(AppendText);
         OutputTextBox.BeginInvoke(d, new object[] { text });
     }
     else
     {
         OutputTextBox.AppendText(text);
         OutputTextBox.ScrollToCaret();
         //Application.DoEvents();
     }
 }
Exemplo n.º 4
0
        public TextOutputForm(StringCollection strings)
        {
            InitializeComponent();

            if (strings != null)
            {
                foreach (string str in strings)
                {
                    OutputTextBox.AppendText(str + Environment.NewLine);
                }

                OutputTextBox.ScrollToCaret();
            }
        }
Exemplo n.º 5
0
        public void GenerateFinished(string path)
        {
            if (InvokeRequired)
            {
                // We're not in the UI thread, so we need to call BeginInvoke
                BeginInvoke(new StringParameterDelegate(GenerateFinished), new object[] { path });
                return;
            }

            if (Directory.Exists(path))
            {
                this.AppendNormalMsg("Verify Finished");
                this.AppendNormalMsg("");


                string errLogPath = Path.Combine(path, this.LogFileName);

                if (!File.Exists(errLogPath))
                {
                    using (StreamWriter sw = File.CreateText(errLogPath)) { }
                }

                using (StreamWriter sw = File.AppendText(errLogPath))
                {
                    sw.WriteLine("================================================");
                    sw.WriteLine(DateTime.Now.ToUniversalTime().ToString("u"));

                    foreach (string each in this.ErrorLog)
                    {
                        sw.WriteLine(each);
                    }
                }

                foreach (string each in this.ErrorLog)
                {
                    this.AppendNormalMsg(each);
                }
            }

            // enable button
            this.GenerateButton.Enabled = true;

            this._counter = 200;
            this.AppendNormalMsg("");
            OutputTextBox.SelectionStart = OutputTextBox.Text.Length;
            OutputTextBox.ScrollToCaret();
            OutputTextBox.Refresh();
        }
Exemplo n.º 6
0
 public void ClearAll()
 {
     if (OutputTextBox.InvokeRequired)
     {
         ClearAllCallback d = new ClearAllCallback(ClearAll);
         OutputTextBox.BeginInvoke(d, new object[] { });
     }
     else
     {
         OutputTextBox.Clear();
         ErrorsAndWarningsDict.Clear();
         OutputTextBox.ScrollToCaret();
         LastHighlitedLine = -1;
         //Application.DoEvents();
     }
 }
 private void OutputTextBox_TextChanged(object sender, EventArgs e)
 {
     OutputTextBox.SelectionStart = OutputTextBox.Text.Length;
     OutputTextBox.ScrollToCaret();
 }