Beispiel #1
0
        void engine_ScriptMessageSent(object sender, RoomieThreadEventArgs eventArgs)
        {
            var builder = new StringBuilder();

            lock (this)
            {
                var now = DateTime.Now;
                var timeSinceLastTimestamp = now.Subtract(_lastTimestamp);
                if (timeSinceLastTimestamp >= timeStampInterval)
                {
                    builder.AppendLine();
                    builder.AppendLine(now + ":");
                    _lastTimestamp = now;
                }

                if (_lastThread == null || _lastThread != eventArgs.Thread)
                {
                    builder.AppendLine();//extra line break

                    builder.Append(eventArgs.Thread.Name);
                    builder.Append(":");
                    builder.Append(Environment.NewLine);

                    builder.Append("--------------------");
                    builder.AppendLine();
                }
                builder.Append(eventArgs.Message);
                builder.AppendLine();

                _lastThread = eventArgs.Thread;
            }

            output.Write(builder.ToString());
            output.Flush();
        }
Beispiel #2
0
        void engine_ScriptMessageSent(object sender, RoomieThreadEventArgs eventArgs)
        {
            var builder = new StringBuilder();
            lock (this)
            {
                var now = DateTime.Now;
                var timeSinceLastTimestamp = now.Subtract(_lastTimestamp);
                if (timeSinceLastTimestamp >= timeStampInterval)
                {
                    builder.AppendLine();
                    builder.AppendLine(now + ":");
                    _lastTimestamp = now;
                }

                if (_lastThread == null || _lastThread != eventArgs.Thread)
                {
                    builder.AppendLine();//extra line break

                    builder.Append(eventArgs.Thread.Name);
                    builder.Append(":");
                    builder.Append(Environment.NewLine);

                    builder.Append("--------------------");
                    builder.AppendLine();

                }
                builder.Append(eventArgs.Message);
                builder.AppendLine();

                _lastThread = eventArgs.Thread;
            }

            output.Write(builder.ToString());
            output.Flush();
        }
Beispiel #3
0
        void engine_ScriptMessageSent(object sender, RoomieThreadEventArgs e)
        {
            var lines = Regex.Split(e.Message, "\r\n|\r|\n");

            var roomieEvents = lines.Select(x =>
                new RoomieEvent
                {
                    TimeStamp = DateTime.Now,
                    Thread = e.Thread.Name,
                    Message = x
                }
            );

            Action call = () =>
            {
                var nothingSelected = EventListing.SelectedIndex == -1;
                var lastItemSelected = EventListing.SelectedIndex == EventListing.Items.Count - 1;

                foreach(var roomieEvent in roomieEvents)
                {
                    Events.Add(roomieEvent);
                }

                if (nothingSelected || lastItemSelected)
                {
                    ScrollToEnd();
                }
            };

            Dispatcher.BeginInvoke(call);
        }