コード例 #1
0
        internal static CommandOutletContent GetInfo(IWorker worker)
        {
            //构建状态内容部分
            var content = CommandOutletContent.Create(WorkerCommandBase.GetStateColor(worker.State), $"[{worker.State}]");

            //构建可用内容部分
            if (!worker.Enabled)
            {
                content.Append(CommandOutletColor.Gray, "(");
                content.Append(CommandOutletColor.Red, Properties.Resources.Disabled);
                content.Append(CommandOutletColor.Gray, ")");
            }

            //构建名称内容部分
            return(content.Append(" " + worker.Name));
        }
コード例 #2
0
        public static CommandOutletContent GetWorkerActionContent(IWorker worker, string message, CommandOutletColor?color = null)
        {
            var content = CommandOutletContent.Create(CommandOutletColor.DarkCyan, worker.Name)
                          .Append(CommandOutletColor.DarkGray, "(")
                          .Append(WorkerCommandBase.GetStateColor(worker.State), worker.State.ToString())
                          .Append(CommandOutletColor.DarkGray, ") ");

            if (color == null)
            {
                return(content.Append(message));
            }
            else
            {
                return(content.Append(color.Value, message));
            }
        }