diff --git a/ClockApp.sln b/ClockApp.sln
index dec9082..9527625 100644
--- a/ClockApp.sln
+++ b/ClockApp.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30717.126
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33723.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClockApp", "ClockApp.csproj", "{3ECFD9F1-856C-4EF2-A0FD-3AF4E81CB076}"
EndProject
diff --git a/ClockTypes.cs b/ClockTypes.cs
index 312cbee..e2f55fa 100644
--- a/ClockTypes.cs
+++ b/ClockTypes.cs
@@ -3,6 +3,9 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Forms.VisualStyles;
+using System.Windows.Forms;
+using Microsoft.Win32;
namespace ClockApp
{
@@ -14,11 +17,37 @@ class WorldTime
class Alarm
{
+ public Label LabelTime;
+ public Label LabelMessage;
public TimeSpan TimeOfDay = new TimeSpan();
+ public TimeSpan RealTime = new TimeSpan();
public bool[] ActiveDays = { true, true, true, true, true, true, true };
- public bool IsActive = false;
+ public bool IsActive = true;
public bool IsRepeating = true;
public string Text;
+ public GroupBox AlarmGroupBox;
+
+ public void Tick()
+ {
+ if (IsActive)
+ {
+ DateTime time = DateTime.Now;
+ if ((time.DayOfWeek == DayOfWeek.Monday && ActiveDays[0]) ||
+ (time.DayOfWeek == DayOfWeek.Tuesday && ActiveDays[1]) ||
+ (time.DayOfWeek == DayOfWeek.Wednesday && ActiveDays[2]) ||
+ (time.DayOfWeek == DayOfWeek.Thursday && ActiveDays[3]) ||
+ (time.DayOfWeek == DayOfWeek.Friday && ActiveDays[4]) ||
+ (time.DayOfWeek == DayOfWeek.Saturday && ActiveDays[5]) ||
+ (time.DayOfWeek == DayOfWeek.Sunday && ActiveDays[6]) )
+ {
+ TimeSpan now = new TimeSpan(time.Hour, time.Minute, time.Second);
+ if (now == RealTime)
+ {
+ MessageBox.Show(Text);
+ }
+ }
+ }
+ }
}
class Timer
diff --git a/Form1.Designer.cs b/Form1.Designer.cs
index 9c28650..a6a1663 100644
--- a/Form1.Designer.cs
+++ b/Form1.Designer.cs
@@ -37,12 +37,37 @@ private void InitializeComponent()
this.buttonAddTimezone = new System.Windows.Forms.Button();
this.comboBoxAddTimezone = new System.Windows.Forms.ComboBox();
this.tabPageAlarms = new System.Windows.Forms.TabPage();
+ this.AlarmflowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.groupBoxMain = new System.Windows.Forms.GroupBox();
+ this.AlarmNumericUpDownMinute = new System.Windows.Forms.NumericUpDown();
+ this.AlarmNumericUpDownHour = new System.Windows.Forms.NumericUpDown();
+ this.checkBoxSnooze = new System.Windows.Forms.CheckBox();
+ this.comboBoxAlarmRepeat = new System.Windows.Forms.ComboBox();
+ this.checkBoxWeekSunday = new System.Windows.Forms.CheckBox();
+ this.checkBoxWeekSaturday = new System.Windows.Forms.CheckBox();
+ this.checkBoxWeekFriday = new System.Windows.Forms.CheckBox();
+ this.checkBoxWeekThursday = new System.Windows.Forms.CheckBox();
+ this.checkBoxWeekWednesday = new System.Windows.Forms.CheckBox();
+ this.checkBoxWeekTuesday = new System.Windows.Forms.CheckBox();
+ this.checkBoxWeekMonday = new System.Windows.Forms.CheckBox();
+ this.groupDevider = new System.Windows.Forms.Label();
+ this.groupMessageBox = new System.Windows.Forms.Label();
+ this.buttonGroupSetAlarm = new System.Windows.Forms.Button();
+ this.textBoxAlarm = new System.Windows.Forms.TextBox();
+ this.groupHour = new System.Windows.Forms.Label();
+ this.groupMinute = new System.Windows.Forms.Label();
this.tabPageCountdowns = new System.Windows.Forms.TabPage();
this.tabPageStopwatches = new System.Windows.Forms.TabPage();
this.timer1 = new System.Windows.Forms.Timer(this.components);
+ this.timer2 = new System.Windows.Forms.Timer(this.components);
+ this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.tabControl1.SuspendLayout();
this.tabPageClocks.SuspendLayout();
this.groupBoxAddTimezone.SuspendLayout();
+ this.tabPageAlarms.SuspendLayout();
+ this.groupBoxMain.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.AlarmNumericUpDownMinute)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.AlarmNumericUpDownHour)).BeginInit();
this.SuspendLayout();
//
// tabControl1
@@ -58,17 +83,18 @@ private void InitializeComponent()
this.tabControl1.Margin = new System.Windows.Forms.Padding(0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(802, 452);
+ this.tabControl1.Size = new System.Drawing.Size(1203, 695);
this.tabControl1.TabIndex = 0;
//
// tabPageClocks
//
this.tabPageClocks.Controls.Add(this.flowLayoutPanelTimezones);
this.tabPageClocks.Controls.Add(this.groupBoxAddTimezone);
- this.tabPageClocks.Location = new System.Drawing.Point(4, 22);
+ this.tabPageClocks.Location = new System.Drawing.Point(4, 29);
+ this.tabPageClocks.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.tabPageClocks.Name = "tabPageClocks";
- this.tabPageClocks.Padding = new System.Windows.Forms.Padding(3);
- this.tabPageClocks.Size = new System.Drawing.Size(794, 426);
+ this.tabPageClocks.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.tabPageClocks.Size = new System.Drawing.Size(1195, 662);
this.tabPageClocks.TabIndex = 0;
this.tabPageClocks.Text = "Мировое время";
this.tabPageClocks.UseVisualStyleBackColor = true;
@@ -78,9 +104,10 @@ private void InitializeComponent()
this.flowLayoutPanelTimezones.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.flowLayoutPanelTimezones.Location = new System.Drawing.Point(9, 56);
+ this.flowLayoutPanelTimezones.Location = new System.Drawing.Point(14, 86);
+ this.flowLayoutPanelTimezones.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.flowLayoutPanelTimezones.Name = "flowLayoutPanelTimezones";
- this.flowLayoutPanelTimezones.Size = new System.Drawing.Size(775, 360);
+ this.flowLayoutPanelTimezones.Size = new System.Drawing.Size(1162, 554);
this.flowLayoutPanelTimezones.TabIndex = 1;
//
// groupBoxAddTimezone
@@ -89,9 +116,11 @@ private void InitializeComponent()
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxAddTimezone.Controls.Add(this.buttonAddTimezone);
this.groupBoxAddTimezone.Controls.Add(this.comboBoxAddTimezone);
- this.groupBoxAddTimezone.Location = new System.Drawing.Point(3, 6);
+ this.groupBoxAddTimezone.Location = new System.Drawing.Point(4, 9);
+ this.groupBoxAddTimezone.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBoxAddTimezone.Name = "groupBoxAddTimezone";
- this.groupBoxAddTimezone.Size = new System.Drawing.Size(781, 44);
+ this.groupBoxAddTimezone.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.groupBoxAddTimezone.Size = new System.Drawing.Size(1172, 68);
this.groupBoxAddTimezone.TabIndex = 0;
this.groupBoxAddTimezone.TabStop = false;
this.groupBoxAddTimezone.Text = "Добавление новой временной зоны";
@@ -99,9 +128,10 @@ private void InitializeComponent()
// buttonAddTimezone
//
this.buttonAddTimezone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonAddTimezone.Location = new System.Drawing.Point(691, 16);
+ this.buttonAddTimezone.Location = new System.Drawing.Point(1036, 25);
+ this.buttonAddTimezone.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.buttonAddTimezone.Name = "buttonAddTimezone";
- this.buttonAddTimezone.Size = new System.Drawing.Size(75, 23);
+ this.buttonAddTimezone.Size = new System.Drawing.Size(112, 35);
this.buttonAddTimezone.TabIndex = 1;
this.buttonAddTimezone.Text = "Добавить";
this.buttonAddTimezone.UseVisualStyleBackColor = true;
@@ -113,35 +143,252 @@ private void InitializeComponent()
| System.Windows.Forms.AnchorStyles.Right)));
this.comboBoxAddTimezone.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxAddTimezone.FormattingEnabled = true;
- this.comboBoxAddTimezone.Location = new System.Drawing.Point(6, 17);
+ this.comboBoxAddTimezone.Location = new System.Drawing.Point(9, 26);
+ this.comboBoxAddTimezone.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.comboBoxAddTimezone.Name = "comboBoxAddTimezone";
- this.comboBoxAddTimezone.Size = new System.Drawing.Size(679, 21);
+ this.comboBoxAddTimezone.Size = new System.Drawing.Size(1016, 28);
this.comboBoxAddTimezone.TabIndex = 0;
//
// tabPageAlarms
//
- this.tabPageAlarms.Location = new System.Drawing.Point(4, 22);
+ this.tabPageAlarms.Controls.Add(this.AlarmflowLayoutPanel);
+ this.tabPageAlarms.Controls.Add(this.groupBoxMain);
+ this.tabPageAlarms.Location = new System.Drawing.Point(4, 29);
+ this.tabPageAlarms.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.tabPageAlarms.Name = "tabPageAlarms";
- this.tabPageAlarms.Padding = new System.Windows.Forms.Padding(3);
- this.tabPageAlarms.Size = new System.Drawing.Size(794, 426);
+ this.tabPageAlarms.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.tabPageAlarms.Size = new System.Drawing.Size(1195, 662);
this.tabPageAlarms.TabIndex = 1;
this.tabPageAlarms.Text = "Будильники";
this.tabPageAlarms.UseVisualStyleBackColor = true;
//
+ // AlarmflowLayoutPanel
+ //
+ this.AlarmflowLayoutPanel.Location = new System.Drawing.Point(7, 289);
+ this.AlarmflowLayoutPanel.Name = "AlarmflowLayoutPanel";
+ this.AlarmflowLayoutPanel.Size = new System.Drawing.Size(1177, 365);
+ this.AlarmflowLayoutPanel.TabIndex = 6;
+ //
+ // groupBoxMain
+ //
+ this.groupBoxMain.Controls.Add(this.AlarmNumericUpDownMinute);
+ this.groupBoxMain.Controls.Add(this.AlarmNumericUpDownHour);
+ this.groupBoxMain.Controls.Add(this.checkBoxSnooze);
+ this.groupBoxMain.Controls.Add(this.comboBoxAlarmRepeat);
+ this.groupBoxMain.Controls.Add(this.checkBoxWeekSunday);
+ this.groupBoxMain.Controls.Add(this.checkBoxWeekSaturday);
+ this.groupBoxMain.Controls.Add(this.checkBoxWeekFriday);
+ this.groupBoxMain.Controls.Add(this.checkBoxWeekThursday);
+ this.groupBoxMain.Controls.Add(this.checkBoxWeekWednesday);
+ this.groupBoxMain.Controls.Add(this.checkBoxWeekTuesday);
+ this.groupBoxMain.Controls.Add(this.checkBoxWeekMonday);
+ this.groupBoxMain.Controls.Add(this.groupDevider);
+ this.groupBoxMain.Controls.Add(this.groupMessageBox);
+ this.groupBoxMain.Controls.Add(this.buttonGroupSetAlarm);
+ this.groupBoxMain.Controls.Add(this.textBoxAlarm);
+ this.groupBoxMain.Controls.Add(this.groupHour);
+ this.groupBoxMain.Controls.Add(this.groupMinute);
+ this.groupBoxMain.Location = new System.Drawing.Point(8, 52);
+ this.groupBoxMain.Name = "groupBoxMain";
+ this.groupBoxMain.Size = new System.Drawing.Size(1176, 217);
+ this.groupBoxMain.TabIndex = 5;
+ this.groupBoxMain.TabStop = false;
+ this.groupBoxMain.Text = "Alarm";
+ //
+ // AlarmNumericUpDownMinute
+ //
+ this.AlarmNumericUpDownMinute.Location = new System.Drawing.Point(194, 60);
+ this.AlarmNumericUpDownMinute.Maximum = new decimal(new int[] {
+ 59,
+ 0,
+ 0,
+ 0});
+ this.AlarmNumericUpDownMinute.Name = "AlarmNumericUpDownMinute";
+ this.AlarmNumericUpDownMinute.Size = new System.Drawing.Size(120, 26);
+ this.AlarmNumericUpDownMinute.TabIndex = 21;
+ //
+ // AlarmNumericUpDownHour
+ //
+ this.AlarmNumericUpDownHour.Location = new System.Drawing.Point(39, 60);
+ this.AlarmNumericUpDownHour.Maximum = new decimal(new int[] {
+ 23,
+ 0,
+ 0,
+ 0});
+ this.AlarmNumericUpDownHour.Name = "AlarmNumericUpDownHour";
+ this.AlarmNumericUpDownHour.Size = new System.Drawing.Size(120, 26);
+ this.AlarmNumericUpDownHour.TabIndex = 20;
+ //
+ // checkBoxSnooze
+ //
+ this.checkBoxSnooze.AutoSize = true;
+ this.checkBoxSnooze.Location = new System.Drawing.Point(508, 96);
+ this.checkBoxSnooze.Name = "checkBoxSnooze";
+ this.checkBoxSnooze.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
+ this.checkBoxSnooze.Size = new System.Drawing.Size(92, 24);
+ this.checkBoxSnooze.TabIndex = 19;
+ this.checkBoxSnooze.Text = "Повтор";
+ this.checkBoxSnooze.UseVisualStyleBackColor = true;
+ //
+ // comboBoxAlarmRepeat
+ //
+ this.comboBoxAlarmRepeat.FormattingEnabled = true;
+ this.comboBoxAlarmRepeat.Location = new System.Drawing.Point(489, 126);
+ this.comboBoxAlarmRepeat.Name = "comboBoxAlarmRepeat";
+ this.comboBoxAlarmRepeat.Size = new System.Drawing.Size(121, 28);
+ this.comboBoxAlarmRepeat.TabIndex = 17;
+ //
+ // checkBoxWeekSunday
+ //
+ this.checkBoxWeekSunday.AutoSize = true;
+ this.checkBoxWeekSunday.Location = new System.Drawing.Point(848, 56);
+ this.checkBoxWeekSunday.Name = "checkBoxWeekSunday";
+ this.checkBoxWeekSunday.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
+ this.checkBoxWeekSunday.Size = new System.Drawing.Size(64, 24);
+ this.checkBoxWeekSunday.TabIndex = 14;
+ this.checkBoxWeekSunday.Text = "Sun";
+ this.checkBoxWeekSunday.UseMnemonic = false;
+ this.checkBoxWeekSunday.UseVisualStyleBackColor = true;
+ //
+ // checkBoxWeekSaturday
+ //
+ this.checkBoxWeekSaturday.AutoSize = true;
+ this.checkBoxWeekSaturday.Location = new System.Drawing.Point(764, 56);
+ this.checkBoxWeekSaturday.Name = "checkBoxWeekSaturday";
+ this.checkBoxWeekSaturday.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
+ this.checkBoxWeekSaturday.Size = new System.Drawing.Size(60, 24);
+ this.checkBoxWeekSaturday.TabIndex = 13;
+ this.checkBoxWeekSaturday.Text = "Sat";
+ this.checkBoxWeekSaturday.UseMnemonic = false;
+ this.checkBoxWeekSaturday.UseVisualStyleBackColor = true;
+ //
+ // checkBoxWeekFriday
+ //
+ this.checkBoxWeekFriday.AutoSize = true;
+ this.checkBoxWeekFriday.Location = new System.Drawing.Point(683, 56);
+ this.checkBoxWeekFriday.Name = "checkBoxWeekFriday";
+ this.checkBoxWeekFriday.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
+ this.checkBoxWeekFriday.Size = new System.Drawing.Size(53, 24);
+ this.checkBoxWeekFriday.TabIndex = 12;
+ this.checkBoxWeekFriday.Text = "Fri";
+ this.checkBoxWeekFriday.UseMnemonic = false;
+ this.checkBoxWeekFriday.UseVisualStyleBackColor = true;
+ //
+ // checkBoxWeekThursday
+ //
+ this.checkBoxWeekThursday.AutoSize = true;
+ this.checkBoxWeekThursday.Location = new System.Drawing.Point(598, 56);
+ this.checkBoxWeekThursday.Name = "checkBoxWeekThursday";
+ this.checkBoxWeekThursday.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
+ this.checkBoxWeekThursday.Size = new System.Drawing.Size(62, 24);
+ this.checkBoxWeekThursday.TabIndex = 11;
+ this.checkBoxWeekThursday.Text = "Thu";
+ this.checkBoxWeekThursday.UseMnemonic = false;
+ this.checkBoxWeekThursday.UseVisualStyleBackColor = true;
+ //
+ // checkBoxWeekWednesday
+ //
+ this.checkBoxWeekWednesday.AutoSize = true;
+ this.checkBoxWeekWednesday.Location = new System.Drawing.Point(508, 56);
+ this.checkBoxWeekWednesday.Name = "checkBoxWeekWednesday";
+ this.checkBoxWeekWednesday.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
+ this.checkBoxWeekWednesday.Size = new System.Drawing.Size(68, 24);
+ this.checkBoxWeekWednesday.TabIndex = 10;
+ this.checkBoxWeekWednesday.Text = "Wed";
+ this.checkBoxWeekWednesday.UseMnemonic = false;
+ this.checkBoxWeekWednesday.UseVisualStyleBackColor = true;
+ //
+ // checkBoxWeekTuesday
+ //
+ this.checkBoxWeekTuesday.AutoSize = true;
+ this.checkBoxWeekTuesday.Location = new System.Drawing.Point(428, 56);
+ this.checkBoxWeekTuesday.Name = "checkBoxWeekTuesday";
+ this.checkBoxWeekTuesday.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
+ this.checkBoxWeekTuesday.Size = new System.Drawing.Size(62, 24);
+ this.checkBoxWeekTuesday.TabIndex = 9;
+ this.checkBoxWeekTuesday.Text = "Tue";
+ this.checkBoxWeekTuesday.UseVisualStyleBackColor = true;
+ //
+ // checkBoxWeekMonday
+ //
+ this.checkBoxWeekMonday.AutoSize = true;
+ this.checkBoxWeekMonday.Location = new System.Drawing.Point(344, 56);
+ this.checkBoxWeekMonday.Name = "checkBoxWeekMonday";
+ this.checkBoxWeekMonday.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
+ this.checkBoxWeekMonday.Size = new System.Drawing.Size(66, 24);
+ this.checkBoxWeekMonday.TabIndex = 8;
+ this.checkBoxWeekMonday.Text = "Mon";
+ this.checkBoxWeekMonday.UseVisualStyleBackColor = true;
+ //
+ // groupDevider
+ //
+ this.groupDevider.AutoSize = true;
+ this.groupDevider.Location = new System.Drawing.Point(175, 60);
+ this.groupDevider.Name = "groupDevider";
+ this.groupDevider.Size = new System.Drawing.Size(13, 20);
+ this.groupDevider.TabIndex = 6;
+ this.groupDevider.Text = ":";
+ //
+ // groupMessageBox
+ //
+ this.groupMessageBox.AutoSize = true;
+ this.groupMessageBox.Location = new System.Drawing.Point(128, 160);
+ this.groupMessageBox.Name = "groupMessageBox";
+ this.groupMessageBox.Size = new System.Drawing.Size(96, 20);
+ this.groupMessageBox.TabIndex = 5;
+ this.groupMessageBox.Text = "Сообщение";
+ //
+ // buttonGroupSetAlarm
+ //
+ this.buttonGroupSetAlarm.Location = new System.Drawing.Point(1025, 90);
+ this.buttonGroupSetAlarm.Name = "buttonGroupSetAlarm";
+ this.buttonGroupSetAlarm.Size = new System.Drawing.Size(119, 39);
+ this.buttonGroupSetAlarm.TabIndex = 4;
+ this.buttonGroupSetAlarm.Text = "Add alarm";
+ this.buttonGroupSetAlarm.UseVisualStyleBackColor = true;
+ this.buttonGroupSetAlarm.Click += new System.EventHandler(this.buttonGroupSetAlarm_Click);
+ //
+ // textBoxAlarm
+ //
+ this.textBoxAlarm.Location = new System.Drawing.Point(26, 122);
+ this.textBoxAlarm.Name = "textBoxAlarm";
+ this.textBoxAlarm.Size = new System.Drawing.Size(312, 26);
+ this.textBoxAlarm.TabIndex = 4;
+ //
+ // groupHour
+ //
+ this.groupHour.AutoSize = true;
+ this.groupHour.Location = new System.Drawing.Point(67, 34);
+ this.groupHour.Name = "groupHour";
+ this.groupHour.Size = new System.Drawing.Size(38, 20);
+ this.groupHour.TabIndex = 0;
+ this.groupHour.Text = "Час";
+ //
+ // groupMinute
+ //
+ this.groupMinute.AutoSize = true;
+ this.groupMinute.Location = new System.Drawing.Point(249, 34);
+ this.groupMinute.Name = "groupMinute";
+ this.groupMinute.Size = new System.Drawing.Size(65, 20);
+ this.groupMinute.TabIndex = 1;
+ this.groupMinute.Text = "Минута";
+ //
// tabPageCountdowns
//
- this.tabPageCountdowns.Location = new System.Drawing.Point(4, 22);
+ this.tabPageCountdowns.Location = new System.Drawing.Point(4, 29);
+ this.tabPageCountdowns.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.tabPageCountdowns.Name = "tabPageCountdowns";
- this.tabPageCountdowns.Size = new System.Drawing.Size(794, 426);
+ this.tabPageCountdowns.Size = new System.Drawing.Size(1195, 662);
this.tabPageCountdowns.TabIndex = 2;
this.tabPageCountdowns.Text = "Таймеры";
this.tabPageCountdowns.UseVisualStyleBackColor = true;
//
// tabPageStopwatches
//
- this.tabPageStopwatches.Location = new System.Drawing.Point(4, 22);
+ this.tabPageStopwatches.Location = new System.Drawing.Point(4, 29);
+ this.tabPageStopwatches.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.tabPageStopwatches.Name = "tabPageStopwatches";
- this.tabPageStopwatches.Size = new System.Drawing.Size(794, 426);
+ this.tabPageStopwatches.Size = new System.Drawing.Size(1195, 662);
this.tabPageStopwatches.TabIndex = 3;
this.tabPageStopwatches.Text = "Секундомеры";
this.tabPageStopwatches.UseVisualStyleBackColor = true;
@@ -153,10 +400,11 @@ private void InitializeComponent()
//
// Form1
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
+ this.ClientSize = new System.Drawing.Size(1200, 692);
this.Controls.Add(this.tabControl1);
+ this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "Form1";
this.Text = "ClockApp";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
@@ -164,6 +412,11 @@ private void InitializeComponent()
this.tabControl1.ResumeLayout(false);
this.tabPageClocks.ResumeLayout(false);
this.groupBoxAddTimezone.ResumeLayout(false);
+ this.tabPageAlarms.ResumeLayout(false);
+ this.groupBoxMain.ResumeLayout(false);
+ this.groupBoxMain.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.AlarmNumericUpDownMinute)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.AlarmNumericUpDownHour)).EndInit();
this.ResumeLayout(false);
}
@@ -180,6 +433,27 @@ private void InitializeComponent()
private System.Windows.Forms.ComboBox comboBoxAddTimezone;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelTimezones;
private System.Windows.Forms.Timer timer1;
+ private System.Windows.Forms.Label groupHour;
+ private System.Windows.Forms.Button buttonGroupSetAlarm;
+ private System.Windows.Forms.Label groupMinute;
+ private System.Windows.Forms.Timer timer2;
+ private System.Windows.Forms.GroupBox groupBoxMain;
+ private System.ComponentModel.BackgroundWorker backgroundWorker1;
+ private System.Windows.Forms.Label groupDevider;
+ private System.Windows.Forms.Label groupMessageBox;
+ private System.Windows.Forms.TextBox textBoxAlarm;
+ private System.Windows.Forms.CheckBox checkBoxWeekFriday;
+ private System.Windows.Forms.CheckBox checkBoxWeekThursday;
+ private System.Windows.Forms.CheckBox checkBoxWeekWednesday;
+ private System.Windows.Forms.CheckBox checkBoxWeekTuesday;
+ private System.Windows.Forms.CheckBox checkBoxWeekMonday;
+ private System.Windows.Forms.CheckBox checkBoxWeekSunday;
+ private System.Windows.Forms.CheckBox checkBoxWeekSaturday;
+ private System.Windows.Forms.CheckBox checkBoxSnooze;
+ private System.Windows.Forms.ComboBox comboBoxAlarmRepeat;
+ private System.Windows.Forms.FlowLayoutPanel AlarmflowLayoutPanel;
+ private System.Windows.Forms.NumericUpDown AlarmNumericUpDownMinute;
+ private System.Windows.Forms.NumericUpDown AlarmNumericUpDownHour;
}
}
diff --git a/Form1.cs b/Form1.cs
index 2e5e5e0..a1efe89 100644
--- a/Form1.cs
+++ b/Form1.cs
@@ -109,6 +109,12 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e)
private void timer1_Tick(object sender, EventArgs e)
{
Program.TimeZones.ToList().ForEach(UpdateText);
+
+ foreach(var i in Program.Alarms)
+ {
+ i.Tick();
+ }
+
}
private void UpdateText(WorldTime item)
@@ -116,5 +122,236 @@ private void UpdateText(WorldTime item)
var tz = TimeZoneInfo.GetSystemTimeZones().FirstOrDefault(i => i.Id == item.Id);
item.Control.Text = (DateTime.UtcNow + tz.BaseUtcOffset).ToString();
}
+
+
+ //Будильник
+
+ private void buttonGroupSetAlarm_Click(object sender, EventArgs e)
+ {
+ bool[] checkBoxWeek = { checkBoxWeekMonday.Checked,
+ checkBoxWeekTuesday.Checked,
+ checkBoxWeekWednesday.Checked,
+ checkBoxWeekThursday.Checked,
+ checkBoxWeekFriday.Checked,
+ checkBoxWeekSaturday.Checked,
+ checkBoxWeekSunday.Checked};
+ AddAlarm((int)AlarmNumericUpDownHour.Value,
+ (int)AlarmNumericUpDownMinute.Value,
+ textBoxAlarm.Text,
+ checkBoxWeek
+ );
+ }
+ private void AddAlarm(int hour, int minute, string message, bool[]week)
+ {
+ TimeSpan AlarmTime = new TimeSpan(hour, minute, 0);
+ GroupBox gb = new GroupBox();
+ Label name = new Label();
+ Label time = new Label();
+
+ Alarm alarm = new Alarm()
+ {
+ AlarmGroupBox = gb,
+ TimeOfDay = AlarmTime,
+ ActiveDays = week,
+ Text = message,
+ LabelMessage = time,
+ LabelTime = name,
+ RealTime = AlarmTime
+ };
+
+ Program.Alarms.Add(alarm);
+
+ gb.Height = 50;
+ gb.Width = 770;
+ gb.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+
+ name.Text = AlarmTime.ToString();
+ name.Location = new Point(5, 10);
+ name.Width = 280;
+ name.Height = 20;
+ time.Text = message;
+ time.Location = new Point(5, 30);
+ time.Width = 280;
+ time.Height = 20;
+ time.Tag = gb;
+
+ Label monlabel = new Label();
+ monlabel.Text = "Mon";
+ monlabel.Location = new Point(300, 10);
+ monlabel.Width = 30;
+ monlabel.Height = 20;
+ CheckBox mcb = new CheckBox();
+ mcb.Location = new Point(300,30);
+ mcb.Width = 20;
+ mcb.Height = 20;
+ mcb.Checked = week[0];
+ mcb.Tag = alarm;
+ mcb.Click += MondayCheckBox_Click;
+
+ Label tuelabel = new Label();
+ tuelabel.Text = "Tue";
+ tuelabel.Location = new Point(330, 10);
+ tuelabel.Width = 30;
+ tuelabel.Height = 20;
+ CheckBox tcb = new CheckBox();
+ tcb.Location = new Point(330, 30);
+ tcb.Width = 20;
+ tcb.Height = 20;
+ tcb.Checked = week[1];
+ tcb.Tag = alarm;
+ tcb.Click += TuesdayCheckBox_Click;
+
+ Label wedlabel = new Label();
+ wedlabel.Text = "Wed";
+ wedlabel.Location = new Point(360, 10);
+ wedlabel.Width = 30;
+ wedlabel.Height = 20;
+ CheckBox wcb = new CheckBox();
+ wcb.Location = new Point(360, 30);
+ wcb.Width = 20;
+ wcb.Height = 20;
+ wcb.Checked = week[2];
+ wcb.Tag = alarm;
+ wcb.Click += WednesdayCheckBox_Click;
+
+ Label thulabel = new Label();
+ thulabel.Text = "Thu";
+ thulabel.Location = new Point(390, 10);
+ thulabel.Width = 30;
+ thulabel.Height = 20;
+ CheckBox thcb = new CheckBox();
+ thcb.Location = new Point(390, 30);
+ thcb.Width = 20;
+ thcb.Height = 20;
+ thcb.Checked = week[3];
+ thcb.Tag = alarm;
+ thcb.Click += ThursdayCheckBox_Click;
+
+ Label frilabel = new Label();
+ frilabel.Text = "Fri";
+ frilabel.Location = new Point(420, 10);
+ frilabel.Width = 30;
+ frilabel.Height = 20;
+ CheckBox fcb = new CheckBox();
+ fcb.Location = new Point(420, 30);
+ fcb.Width = 20;
+ fcb.Height = 20;
+ fcb.Checked = week[4];
+ fcb.Tag = alarm;
+ fcb.Click += FridayCheckBox_Click;
+
+ Label satlabel = new Label();
+ satlabel.Text = "Sat";
+ satlabel.Location = new Point(450, 10);
+ satlabel.Width = 30;
+ satlabel.Height = 20;
+ CheckBox scb = new CheckBox();
+ scb.Location = new Point(450, 30);
+ scb.Width = 20;
+ scb.Height = 20;
+ scb.Checked = week[5];
+ scb.Tag = alarm;
+ scb.Click += SaturdayCheckBox_Click;
+
+ Label sunlabel = new Label();
+ sunlabel.Text = "Sun";
+ sunlabel.Location = new Point(480, 10);
+ sunlabel.Width = 30;
+ sunlabel.Height = 20;
+ CheckBox sndcb = new CheckBox();
+ sndcb.Location = new Point(480, 30);
+ sndcb.Width = 20;
+ sndcb.Height = 20;
+ sndcb.Checked = week[6];
+ sndcb.Tag = alarm;
+ sndcb.Click += SundayCheckBox_Click;
+
+
+ Button btn = new Button();
+ btn.Text = "X";
+ btn.Location = new Point(740, 10);
+ btn.Width = 20;
+ btn.Height = 20;
+ btn.Tag = gb;
+ btn.Click += ButtonRemoveAlarm;
+
+
+ gb.Controls.Add(name);
+ gb.Controls.Add(time);
+ gb.Controls.Add(btn);
+ gb.Controls.Add(monlabel);
+ gb.Controls.Add(mcb);
+ gb.Controls.Add(tuelabel);
+ gb.Controls.Add(tcb);
+ gb.Controls.Add(wedlabel);
+ gb.Controls.Add(wcb);
+ gb.Controls.Add(thulabel);
+ gb.Controls.Add(thcb);
+ gb.Controls.Add(frilabel);
+ gb.Controls.Add(fcb);
+ gb.Controls.Add(satlabel);
+ gb.Controls.Add(scb);
+ gb.Controls.Add(sunlabel);
+ gb.Controls.Add(sndcb);
+ gb.Tag = (Alarm)alarm;
+
+ AlarmflowLayoutPanel.Controls.Add(gb);
+ }
+
+ private void MondayCheckBox_Click (object sender, EventArgs e)
+ {
+ CheckBox mcb = (CheckBox)sender;
+ Alarm alarm = (mcb).Tag as Alarm;
+ alarm.ActiveDays[0] = mcb.Checked;
+ }
+ private void TuesdayCheckBox_Click(object sender, EventArgs e)
+ {
+ CheckBox mcb = (CheckBox)sender;
+ Alarm alarm = (mcb).Tag as Alarm;
+ alarm.ActiveDays[1] = mcb.Checked;
+ }
+ private void WednesdayCheckBox_Click(object sender, EventArgs e)
+ {
+ CheckBox mcb = (CheckBox)sender;
+ Alarm alarm = (mcb).Tag as Alarm;
+ alarm.ActiveDays[2] = mcb.Checked;
+ }
+ private void ThursdayCheckBox_Click(object sender, EventArgs e)
+ {
+ CheckBox mcb = (CheckBox)sender;
+ Alarm alarm = (mcb).Tag as Alarm;
+ alarm.ActiveDays[3] = mcb.Checked;
+ }
+ private void FridayCheckBox_Click(object sender, EventArgs e)
+ {
+ CheckBox mcb = (CheckBox)sender;
+ Alarm alarm = (mcb).Tag as Alarm;
+ alarm.ActiveDays[4] = mcb.Checked;
+ }
+ private void SaturdayCheckBox_Click(object sender, EventArgs e)
+ {
+ CheckBox mcb = (CheckBox)sender;
+ Alarm alarm = (mcb).Tag as Alarm;
+ alarm.ActiveDays[5] = mcb.Checked;
+ }
+ private void SundayCheckBox_Click(object sender, EventArgs e)
+ {
+ CheckBox mcb = (CheckBox)sender;
+ Alarm alarm = (mcb).Tag as Alarm;
+ alarm.ActiveDays[6] = mcb.Checked;
+ }
+ private void ButtonRemoveAlarm(object sender, EventArgs e)
+ {
+ var gb = (GroupBox)((Button)sender).Tag;
+ foreach (var i in Program.Alarms)
+ {
+ if(i == (Alarm)gb.Tag)
+ {
+ Program.Alarms.Remove(i);
+ break;
+ }
+ }
+ AlarmflowLayoutPanel.Controls.Remove(gb);
+ }
}
}
diff --git a/Form1.resx b/Form1.resx
index 1f666f2..8246d66 100644
--- a/Form1.resx
+++ b/Form1.resx
@@ -120,4 +120,13 @@
17, 17
+
+ 131, 17
+
+
+ 245, 17
+
+
+ 25
+
\ No newline at end of file