Example #1
0
        /// <summary>
        /// Display incoming console message
        /// </summary>
        /// <param name="notifyTime"></param>
        /// <param name="appDomainFriendlyName"></param>
        /// <param name="name"></param>
        /// <param name="message"></param>
        private string ShowConsoleMessage(string notifyTime, string consoleName, string machineName, string appDomainFriendlyName, string parentEntryID, string message, bool showTime, bool showMachine, bool showAppDomain)
        {
            if (ConsoleUI.InvokeRequired)
            {
                return(ConsoleUI.Invoke(new UpdateMonitorInvoker(ShowConsoleMessage), new object[] { notifyTime, consoleName, machineName, appDomainFriendlyName, parentEntryID, message, showTime, showMachine, showAppDomain }) as string);
            }

            lock (_lockUI)
            {
                TrayHandler.ShowUpdate();
                if (String.IsNullOrWhiteSpace(consoleName))
                {
                    string resultKey = ConsoleUI.AddNewMessage(notifyTime, consoleName, machineName, appDomainFriendlyName, parentEntryID, message, showTime, showMachine, showAppDomain);
                    if (TabControlMain.SelectedIndex != 0)
                    {
                        TabControlMain.TabPages[0].Text = "*Console";
                    }
                    return(resultKey);
                }
                else
                {
                    foreach (var item in CustomConsoleList)
                    {
                        if (item.ControlName.Trim().ToLower() == consoleName.Trim().ToLower())
                        {
                            string newEntryID = item.AddNewMessage(notifyTime, consoleName, machineName, appDomainFriendlyName, parentEntryID, message, showTime, showMachine, showAppDomain);

                            TabPage page = item.Parent as TabPage;
                            if (TabControlMain.SelectedTab != page)
                            {
                                page.Text = "*" + item.ControlName;
                            }

                            return(newEntryID);
                        }
                    }
                    return(AddNewConsoleAndShowMessage(notifyTime, consoleName, machineName, appDomainFriendlyName, parentEntryID, message, showTime, showMachine, showAppDomain));
                }
            }
        }