コード例 #1
0
        public static TimerVisualSettings ParseCsv(string csv, int start = 0)
        {
            TimerVisualSettings settings = TimerVisualSettings.Default;

            try
            {
                var values = csv.Split(new char[] { ',' });

                var fontFamily = values[start + 0];
                var fontSize   = float.Parse(values[start + 1]);
                settings.SetFont(fontFamily, fontSize);

                settings.CounterMode        = Util.ToEnum <TimerCounterMode>(values[start + 2]);
                settings.DisplayMode        = Util.ToEnum <TimerDisplayMode>(values[start + 3]);
                settings.TimerColor         = Util.FromARGBString(Color.FromName(values[start + 4]));
                settings.RunningColor       = Util.FromARGBString(Color.FromName(values[start + 5]));
                settings.PausedColor        = Util.FromARGBString(Color.FromName(values[start + 6]));
                settings.WarningColor       = Util.FromARGBString(Color.FromName(values[start + 7]));
                settings.StoppedColor       = Util.FromARGBString(Color.FromName(values[start + 8]));
                settings.ExpiredColor       = Util.FromARGBString(Color.FromName(values[start + 9]));
                settings.BackgroundColor    = Util.FromARGBString(Color.FromName(values[start + 10]));
                settings.MessageColor       = Util.FromARGBString(Color.FromName(values[start + 11]));
                settings.SecondWarningColor = Util.FromARGBString(Color.FromName(values[start + 12]));

                return(settings);
            }
            catch
            {
                return(settings);
            }
        }
コード例 #2
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            if (ReferenceEquals(this, obj))
            {
                return(true);
            }

            TimerVisualSettings that = obj as TimerVisualSettings;

            if (that == null)
            {
                return(false);
            }

            return(this.id.Equals(that.id) &&
                   this.TimerFont.FontFamily.Name.Equals(that.TimerFont.FontFamily.Name) &&
                   this.TimerFont.Size.Equals(that.TimerFont.Size) &&
                   this.CounterMode.Equals(that.CounterMode) &&
                   this.DisplayMode.Equals(that.DisplayMode) &&
                   this.TimerColor.Equals(that.TimerColor) &&
                   this.RunningColor.Equals(that.RunningColor) &&
                   this.PausedColor.Equals(that.PausedColor) &&
                   this.WarningColor.Equals(that.WarningColor) &&
                   this.StoppedColor.Equals(that.StoppedColor) &&
                   this.ExpiredColor.Equals(that.ExpiredColor) &&
                   this.BackgroundColor.Equals(that.BackgroundColor) &&
                   this.MessageColor.Equals(that.MessageColor) &&
                   this.SecondWarningColor.Equals(that.SecondWarningColor));
        }
コード例 #3
0
 public TimerVisualSettings(int visualId, TimerVisualSettings copy) :
     this(
         visualId,
         copy.CounterMode,
         copy.DisplayMode,
         copy.TimerFont.FontFamily.Name,
         copy.TimerFont.Size,
         copy.TimerColor,
         copy.RunningColor,
         copy.PausedColor,
         copy.WarningColor,
         copy.SecondWarningColor,
         copy.ExpiredColor,
         copy.StoppedColor,
         copy.BackgroundColor,
         copy.MessageColor
         )
 {
 }
コード例 #4
0
        public static SimpleTimerSettings ParseCsv(string csv)
        {
            try
            {
                var values = csv.Split(new char[] { ',' });
                int id     = -1;
                int.TryParse(values[0], out id);

                var settings = new SimpleTimerSettings(id)
                {
                    Name           = values[1],
                    TimerDuration  = TimerDurationSettings.ParseCsv(csv, 2),
                    BlinkOnExpired = bool.Parse(values[6]),
                    FinalMessage   = values[7],
                    VisualSettings = TimerVisualSettings.ParseCsv(csv, 8),
                };

                return(settings);
            }
            catch
            {
                return(SimpleTimerSettings.Default);
            }
        }
コード例 #5
0
 public SettingsChangedEventArgs(TimerVisualSettings settings)
 {
     this.VisualSettings = settings;
 }
コード例 #6
0
 public SimpleTimerSettings(int id, string name, string finalmessage, bool blinkOnExpired, TimerDurationSettings durationSettings, TimerVisualSettings visualSettings, TimerMessageSettings messageSettings)
     : base(id)
 {
     this.name            = name ?? TimerSettings.DefaultName;
     this.FinalMessage    = finalmessage ?? string.Empty;
     this.BlinkOnExpired  = blinkOnExpired;
     this.TimerDuration   = new TimerDurationSettings(durationSettings.DurationId, durationSettings);
     this.VisualSettings  = new TimerVisualSettings(visualSettings.VisualId, visualSettings);
     this.MessageSettings = messageSettings ?? TimerMessageSettings.Default;
 }