Пример #1
0
        private void ApplySettings(SimpleTimerSettings settings)
        {
            this.Settings = settings;

            this.SetFonts();

            ////this.TimerFont = this.IsPreviewMode ? new Font(settings.VisualSettings.TimerFont.FontFamily.Name, SimpleTimerView.PreviewFontSize) : settings.VisualSettings.TimerFont;
            ////int labelSize = this.IsPreviewMode ? SimpleTimerView.PreviewLabelSize : (int)Math.Max(settings.VisualSettings.TimerFont.Size / 3, 10);
            ////this.lblTimerTitle.Font = new Font(settings.VisualSettings.TimerFont.FontFamily.Name, labelSize);

            ////// Keep the mini timer the same size as the title
            ////this.lblMiniTimer.Font = new Font(settings.VisualSettings.TimerFont.FontFamily.Name, labelSize);

            this.BackgroundColor = settings.VisualSettings.BackgroundColor;
            this.TimerColor      = settings.VisualSettings.RunningColor;

            this.Settings.VisualSettings.SecondWarningColor = this.Settings.VisualSettings.SecondWarningColor;

            if ((settings.BlinkOnExpired && this.Settings.TimerDuration.Duration >= 0) || (!settings.BlinkOnExpired && this.blinkManager.IsBlinking))
            {
                this.blinkManager.StopBlinking();
            }

            this.lblTimerTitle.Text = this.Settings.TimerDuration.Title;
            this.RefreshTimerDisplay();
        }
Пример #2
0
        private void OnSaveRequested(SimpleTimerSettings settings)
        {
            var handler = this.SaveRequested;

            if (handler != null)
            {
                handler.Invoke(this, new SettingIOEventArgs(settings));
            }
        }
Пример #3
0
        public SimpleTimerSettings Save(SimpleTimerSettings simpleTimer)
        {
            var parameters = new List <SQLiteParameter>
            {
                new SQLiteParameter()
                {
                    ParameterName = NameCol.ParameterName, Value = simpleTimer.Name
                },
                new SQLiteParameter()
                {
                    ParameterName = MessageCol.ParameterName, Value = simpleTimer.FinalMessage
                },
                new SQLiteParameter()
                {
                    ParameterName = BlinkCol.ParameterName, Value = simpleTimer.BlinkOnExpired
                },
            };

            if (simpleTimer.Id < 0)
            {
                var sql = "INSERT INTO [" + TableName + "](" +
                          "[" + NameCol.Name + "], " +
                          "[" + MessageCol.Name + "], " +
                          "[" + BlinkCol.Name + "]" +
                          ") VALUES (" +
                          "@" + NameCol.ParameterName + ", " +
                          "@" + MessageCol.ParameterName + ", " +
                          "@" + BlinkCol.ParameterName + ");";

                int newId = (int)this.Insert(sql, parameters.ToArray());
                return(new SimpleTimerSettings(newId, simpleTimer));
            }

            var update = "UPDATE [" + TableName + "] SET " +
                         "[" + NameCol.Name + "] = @" + NameCol.ParameterName + "," +
                         "[" + MessageCol.Name + "] = @" + MessageCol.ParameterName + "," +
                         "[" + BlinkCol.Name + "] = @" + BlinkCol.ParameterName + " " +
                         "WHERE [" + IdCol.Name + "] = @Id;";

            parameters.Add(new SQLiteParameter("Id", simpleTimer.Id));
            this.ExecuteNonQuery(update, parameters.ToArray());
            return(simpleTimer);
        }
Пример #4
0
 public void Save(SimpleTimerSettings timer)
 {
     throw new NotImplementedException();
 }