Esempio n. 1
0
 internal StreamingTextWriter(WriteLineCallback writeCall, CultureInfo culture) : base(culture)
 {
     if (writeCall == null)
     {
         throw PSTraceSource.NewArgumentNullException("writeCall");
     }
     this.writeCall = writeCall;
 }
Esempio n. 2
0
 internal StreamingTextWriter(WriteLineCallback writeCall, CultureInfo culture) : base(culture)
 {
     if (writeCall == null)
     {
         throw PSTraceSource.NewArgumentNullException("writeCall");
     }
     this.writeCall = writeCall;
 }
Esempio n. 3
0
        /// <summary>
        /// Create an instance by passing a delegate.
        /// </summary>
        /// <param name="writeCall">Delegate to write to.</param>
        /// <param name="culture">Culture for this TextWriter.</param>
        internal StreamingTextWriter(WriteLineCallback writeCall, CultureInfo culture)
            : base(culture)
        {
            if (writeCall is null)
            {
                throw PSTraceSource.NewArgumentNullException(nameof(writeCall));
            }

            _writeCall = writeCall;
        }
Esempio n. 4
0
 private void WriteLine(string text)
 {
     if (textBox1.InvokeRequired)
     {
         WriteLineCallback d = new WriteLineCallback(WriteLine);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         textBox1.Text = String.Join("\r\n", text, textBox1.Text);
     }
 }
Esempio n. 5
0
 public void WriteLine(String line)
 {
     // InvokeRequired required compares the thread ID of the
       // calling thread to the thread ID of the creating thread.
       // If these threads are different, it returns true.
       if (Output.InvokeRequired)
       {
     WriteLineCallback d = new WriteLineCallback(WriteLine);
     this.Invoke(d, new object[] { line });
       }
       else
       {
     Output.AppendText(line + "\n");
       }
 }
Esempio n. 6
0
 public void WriteLine(String line)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (Output.InvokeRequired)
     {
         WriteLineCallback d = new WriteLineCallback(WriteLine);
         this.Invoke(d, new object[] { line });
     }
     else
     {
         Output.AppendText(line + "\n");
     }
 }
Esempio n. 7
0
        private void WriteLine(string line)
        {
            var sb = new StringBuilder();

            sb.Append("[");
            sb.Append(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
            sb.Append("] ");
            sb.AppendLine(line);

            if (eventLog.InvokeRequired)
            {
                var d = new WriteLineCallback(WriteLine);
                Invoke(d, new[] { line });
            }
            else
            {
                eventLog.Text          += sb.ToString();
                eventLog.SelectionStart = eventLog.Text.Length;
                eventLog.ScrollToCaret();
            }
        }
Esempio n. 8
0
 public StreamingManager(IObservable<StreamingMessage> _observable, MessageType _messageType, double _throttleTime, WriteLineCallback _writeLine)
 {
     observable = _observable;
     messageType = _messageType;
     throttleTime = _throttleTime;
     writeLine = _writeLine;
     timer.Elapsed += new System.Timers.ElapsedEventHandler(TimerElapsed);
 }
Esempio n. 9
0
 public void WriteLine(string text)
 {
     if (this.Output.InvokeRequired)
     {
         WriteLineCallback d = new WriteLineCallback(WriteOutput);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         WriteOutput(text + "\r\n");
     }
 }