Пример #1
0
 private static void Append(this ConsoleControl.ConsoleControl cons,
                            string text, Color color)
 {
     cons.ScrollToEnd();
     cons.WriteOutput(text, color);
     cons.ScrollToEnd();
 }
Пример #2
0
        /// <summary>
        /// Print line to the main channel, (optional) and their own channel.
        /// </summary>
        /// <param name="line">Chat.log line.</param>
        /// <param name="chatColor">Line foreground <see cref="Color"/>.</param>
        /// <param name="chat">Print to this channel aswell.</param>
        public void Print(string line, Color chatColor, ConsoleControl.ConsoleControl chat = null)
        {
            // Write to the main channel
            if (Chats["All"].IsHandleCreated)
            {
                Chats["All"].Invoke((Action)(() => Chats["All"].WriteOutput(line, chatColor)));
            }

            // Write to the right channel
            if (chat != null && chat.IsHandleCreated)
            {
                chat.Invoke((Action)(() => chat.WriteOutput(line, chatColor)));
            }
        }
Пример #3
0
        private static void WriteToDB()
        {
            while (true)
            {
                try
                {
                    if (DataReceivedEventArgs_Kiwi.Instance.Count > 0)
                    {
                        isWriteTaskOver = false;
                        DataReceivedEventArgs dataReceived = DataReceivedEventArgs_Kiwi.Instance.DeQueue();
                        if (!String.IsNullOrEmpty(dataReceived.Html) && dataReceived.Html.Trim() != "")
                        {
                            #region 辛苦了

                            /*
                             * string a = "";
                             * int sum = 0;
                             * //1214
                             *
                             * if (dataReceived != null && !string.IsNullOrEmpty(dataReceived.Html))
                             * {
                             *  MatchCollection mat_k = Regex.Matches(dataReceived.Html, "\"pic_completed\":(\\d+)", RegexOptions.IgnoreCase);
                             *  foreach (Match item in mat_k)
                             *  {
                             *      if (item.Success)
                             *      {
                             *          a = item.Groups[1].Value.ToString();
                             *          sum += Convert.ToInt32(a);
                             *
                             *      }
                             *  }
                             *  MessageBox.Show(sum.ToString());
                             * }
                             */
                            #endregion
                            //1214
                            WriteToFiles(dataReceived);
                        }
                    }
                    else
                    {
                        isWriteTaskOver = true;
                        if (IsTaskOver())
                        {
                            kiwiConsole.WriteOutput(DateTime.Now.ToString() + "-【" + Thread.CurrentThread.ManagedThreadId + "】-" + " 任务结束\r\n", Color.OrangeRed);
                            try
                            {
                                writeThread.Abort();
                                writeThread.DisableComObjectEagerCleanup();
                            }
                            catch (Exception)
                            {
                                throw;
                            }
                        }
                        else
                        {
                            Thread.Sleep(2000);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
Пример #4
0
 public void Progress(string key, int percent, string message)
 {
     _ctrl.WriteOutput(".", DefaultForeColor);
 }
Пример #5
0
 private void ConsoleWrite(string data)
 {
     console.WriteOutput(data, console.InternalRichTextBox.ForeColor);
 }