コード例 #1
0
        void Message(CabControl control, ConfirmLevel level, string message)
        {
            // User can suppress levels None and Information but not Warning, Error and MSGs.
            // Cab control confirmations have level None.
            if (level < ConfirmLevel.Information && Simulator.Settings.SuppressConfirmations)
            {
                return;
            }

            var format = "{2}";

            // Skip control name if not a control
            if (control != CabControl.None)
            {
                format = "{0}: " + format;
            }
            if (level >= ConfirmLevel.Information)
            {
                format = "{1} - " + format;
            }
            var duration = DefaultDurationS;

            if (level >= ConfirmLevel.Warning)
            {
                duration *= 2;
            }
            if (level >= ConfirmLevel.Message)
            {
                duration *= 5;
            }
            DisplayMessage?.Invoke(this, new DisplayMessageEventArgs($"{control}/{level}", string.Format(format, ConfirmText[(int)control][0], Simulator.Catalog.GetString(level.GetDescription()), message), duration));
        }