private void insert_Log(string Message, int Code)
        {
            string          date   = DateTime.Now.ToString("yyyy-MM-dd h:mm:ss tt");
            SolidColorBrush Color  = Brushes.Black;
            string          Status = "";

            if (Code == Error_Code) //Error Message
            {
                Status = "[Error]";
                Color  = Brushes.Red;
            }
            else if (Code == Success_Code) //Success Message
            {
                Status = "[Success]";
                Color  = Brushes.Green;
            }
            else if (Code == Warning_Code) //Warning Message
            {
                Status = "[Warning]";
                Color  = Brushes.Orange;
            }
            else if (Code == Message_Code)//Standard Message
            {
                Status = "";
                Color  = Brushes.Blue;
            }
            Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate
            {
                Output_Log.Inlines.Add(new Run("[" + date + "]" + " " + Status + " " + Message + "\n")
                {
                    Foreground = Color
                });
                Output_Log_Scroll.ScrollToBottom();
            }));
        }
Esempio n. 2
0
        public void insert_Log(string Message, string Colour)
        {
            string[]        Color_Parts = Colour.Split(',');
            SolidColorBrush Plot_Color  = new SolidColorBrush(Color.FromArgb(255, (byte)Convert.ToInt32(Color_Parts[0]), (byte)Convert.ToInt32(Color_Parts[1]), (byte)Convert.ToInt32(Color_Parts[2])));

            Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate
            {
                Output_Log.Inlines.Add(new Run(Message + "\n")
                {
                    Foreground = Plot_Color
                });
                Output_Log_Scroll.ScrollToBottom();
            }));
        }