Exemplo n.º 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.MSG)
            {
                duration *= 5;
            }
            if (DisplayMessage != null)
            {
                DisplayMessage(this, new DisplayMessageEventArgs(String.Format("{0}/{1}", control, level), String.Format(format, ConfirmText[(int)control][0], Simulator.Catalog.GetString(GetStringAttribute.GetPrettyName(level)), message), duration));
            }
        }
Exemplo n.º 2
0
        private 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(CultureInfo.CurrentCulture, format, ConfirmText[(int)control][0], level.GetLocalizedDescription(), message), duration));
        }
Exemplo n.º 3
0
 public void Message(ConfirmLevel level, string message)
 {
     Message(CabControl.None, level, message);
 }