public void Write(SmartLogger.MessageType_enum type, string msg)
        {
            var originalColor = Console.ForegroundColor;

            switch (type)
            {
                case SmartLogger.MessageType_enum.Debug:
                    Console.ForegroundColor = ConsoleColor.DarkGray;
                    Console.Out.Write(string.Format("{0,-8} - {1}", type, msg));
                    break;
                case SmartLogger.MessageType_enum.Error:
                case SmartLogger.MessageType_enum.Failed:
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Error.Write(string.Format("{0,-8} - {1}", type, msg));
                    Console.Error.Flush();
                    break;
                case SmartLogger.MessageType_enum.Info:
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.Out.Write(string.Format("{0,-8} - ", type));
                    Console.ForegroundColor = originalColor;
                    Console.Out.Write(msg);
                    break;
                case SmartLogger.MessageType_enum.Success:
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.Out.Write(string.Format("{0,-8} - ", type));
                    Console.ForegroundColor = originalColor;
                    Console.Out.Write(msg);
                    break;
                case SmartLogger.MessageType_enum.Warning:
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.Out.Write(string.Format("{0,-8} - {1}", type, msg));
                    break;
                default:
                    Console.ForegroundColor = ConsoleColor.DarkGray;
                    break;
            }

            Console.ForegroundColor = originalColor;
        }
 public void WriteLine(SmartLogger.MessageType_enum type, string msg)
 {
     this.Write(type, msg + Environment.NewLine);
 }
Exemple #3
0
        public PCCPropertyInputDistributionEditor(CyPhyGUIs.IInterpreterMainParameters mainParameters, CyPhyGUIs.SmartLogger logger)
        {
            this.Logger         = logger;
            this.MainParameters = mainParameters;
            InitializeComponent();
            this.cbDist.SelectedIndex = 0;
            this.DirtyProperties      = new List <PCC.PCCProperty>();
            this.PropertyData         = ((System.Windows.Forms.BindingSource)dataGridView1.DataSource).List;
            bool hadProperty = false;

            foreach (var property in this.GetPCCPropertiesFromComponent(true).OrderBy(p => p.Name))
            {
                this.PropertyData.Add(property);
                hadProperty = true;
            }

            if (hadProperty == false)
            {
                this.Logger.WriteWarning("No properties can be used as PCC Property Input distributions!");
                this.Logger.WriteWarning("A property can only be used if:");
                this.Logger.WriteWarning(" [1] It maps to a Modelica Parameter of a Modelica Model.");
                this.Logger.WriteWarning(" [2] It does NOT have any incoming value flows.");
                this.Logger.WriteWarning(" [3] It has a real value.");
                this.Close();
            }
        }