Календарь версия 0.1

This commit is contained in:
2022-09-06 22:18:53 +03:00
parent 0fac5ede3a
commit cd98a04d26
43 changed files with 2147 additions and 3 deletions

View File

BIN
.vs/Calendar/v17/.suo Normal file

Binary file not shown.

3
.vs/ProjectSettings.json Normal file
View File

@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}

View File

@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\Сalendar.sln",
"PreviewInSolutionExplorer": false
}

BIN
.vs/slnx.sqlite Normal file

Binary file not shown.

View File

BIN
.vs/Сalendar/v17/.suo Normal file

Binary file not shown.

View File

@@ -1,3 +0,0 @@
# Calendar
Календарь

25
Сalendar.sln Normal file
View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30717.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Сalendar", "Сalendar\Сalendar.csproj", "{093CF92D-B515-4C14-91A0-94DB41719CD5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{093CF92D-B515-4C14-91A0-94DB41719CD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{093CF92D-B515-4C14-91A0-94DB41719CD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{093CF92D-B515-4C14-91A0-94DB41719CD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{093CF92D-B515-4C14-91A0-94DB41719CD5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7E2B0942-9F0D-4711-AD56-377DDE2B29BE}
EndGlobalSection
EndGlobal

6
Сalendar/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

50
Сalendar/Events.cs Normal file
View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Сalendar
{
class Events
{
private string event_name; //Переменная для хранения события
private string start_date; //Переменная для хранения даты начала события
private string end_date; //Переменная для хранения даты окончания события
private string time_start; //Переменная для хранения времени начала события
private string time_end; //Переменная для хранения времени окончания события
public Events(string _event_name, string _start_date, string _end_date, string _time_start, string _time_end) //Метод для записи полученных значений в переменные
{
this.event_name = _event_name; //запись полученного имени события
this.start_date = _start_date; //запись полученной даты начала события
this.end_date = _end_date; //запись полученной даты окончания события
this.time_start = _time_start; //запись времени начала события
this.time_end = _time_end; //запись времени окончания события
}
public string getEventName() //Метод для передачи значения переменной event_name
{
return this.event_name;
}
public string getStart_Date() //Метод для передачи значения переменной start_date
{
return this.start_date;
}
public string getEnd_Date() //Метод для передачи значения переменной end_date
{
return this.end_date;
}
public string getTime_Start() //Метод для передачи значения переменной time_start
{
return this.time_start;
}
public string getTime_End() //Метод для передачи значения переменной time_end
{
return this.time_end;
}
}
}

313
Сalendar/Form1.Designer.cs generated Normal file
View File

@@ -0,0 +1,313 @@

using System.Windows.Forms;
namespace Сalendar
{
partial class Form1
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором форм Windows
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.listBox1 = new System.Windows.Forms.ListBox();
this.monthCalendar1 = new System.Windows.Forms.MonthCalendar();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.textBox1 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.label8 = new System.Windows.Forms.Label();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.label9 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 16;
this.listBox1.Location = new System.Drawing.Point(585, 15);
this.listBox1.Margin = new System.Windows.Forms.Padding(4);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(464, 244);
this.listBox1.TabIndex = 0;
//
// monthCalendar1
//
this.monthCalendar1.Location = new System.Drawing.Point(351, 15);
this.monthCalendar1.Margin = new System.Windows.Forms.Padding(12, 11, 12, 11);
this.monthCalendar1.Name = "monthCalendar1";
this.monthCalendar1.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(16, 33);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(42, 16);
this.label1.TabIndex = 2;
this.label1.Text = "Дата:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(16, 83);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(51, 16);
this.label2.TabIndex = 3;
this.label2.Text = "Время:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(72, 33);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 16);
this.label3.TabIndex = 4;
this.label3.Text = "label3";
//
// button1
//
this.button1.Location = new System.Drawing.Point(455, 443);
this.button1.Margin = new System.Windows.Forms.Padding(4);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 28);
this.button1.TabIndex = 5;
this.button1.Text = "Добавить";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(72, 83);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 16);
this.label4.TabIndex = 6;
this.label4.Text = "label4";
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(284, 399);
this.textBox1.Margin = new System.Windows.Forms.Padding(4);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(481, 22);
this.textBox1.TabIndex = 7;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(139, 402);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(130, 16);
this.label5.TabIndex = 8;
this.label5.Text = "Название события";
//
// button2
//
this.button2.Location = new System.Drawing.Point(764, 293);
this.button2.Margin = new System.Windows.Forms.Padding(4);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 28);
this.button2.TabIndex = 9;
this.button2.Text = "Удалить";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(16, 59);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(93, 16);
this.label6.TabIndex = 10;
this.label6.Text = "День недели:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(116, 59);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(44, 16);
this.label7.TabIndex = 11;
this.label7.Text = "label7";
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(585, 267);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(130, 20);
this.checkBox1.TabIndex = 12;
this.checkBox1.Text = "Редактировать";
this.checkBox1.UseVisualStyleBackColor = true;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(382, 235);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(93, 20);
this.radioButton1.TabIndex = 13;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Праздник";
this.radioButton1.UseVisualStyleBackColor = true;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(382, 262);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(119, 20);
this.radioButton2.TabIndex = 14;
this.radioButton2.Text = "Напоминание";
this.radioButton2.UseVisualStyleBackColor = true;
//
// dateTimePicker1
//
this.dateTimePicker1.CustomFormat = "HH:mm";
this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker1.Location = new System.Drawing.Point(372, 336);
this.dateTimePicker1.MaxDate = new System.DateTime(2022, 1, 2, 0, 0, 0, 0);
this.dateTimePicker1.MinDate = new System.DateTime(2022, 1, 1, 0, 0, 0, 0);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.ShowUpDown = true;
this.dateTimePicker1.Size = new System.Drawing.Size(65, 22);
this.dateTimePicker1.TabIndex = 15;
this.dateTimePicker1.Value = new System.DateTime(2022, 1, 1, 0, 0, 0, 0);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(452, 341);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(23, 16);
this.label8.TabIndex = 16;
this.label8.Text = "по";
//
// dateTimePicker2
//
this.dateTimePicker2.CustomFormat = "HH:mm";
this.dateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker2.Location = new System.Drawing.Point(501, 336);
this.dateTimePicker2.MaxDate = new System.DateTime(2022, 1, 2, 0, 0, 0, 0);
this.dateTimePicker2.MinDate = new System.DateTime(2022, 1, 1, 0, 0, 0, 0);
this.dateTimePicker2.Name = "dateTimePicker2";
this.dateTimePicker2.ShowUpDown = true;
this.dateTimePicker2.Size = new System.Drawing.Size(65, 22);
this.dateTimePicker2.TabIndex = 17;
this.dateTimePicker2.Value = new System.DateTime(2022, 1, 1, 0, 0, 0, 0);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(382, 376);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(0, 16);
this.label9.TabIndex = 18;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.ClientSize = new System.Drawing.Size(1067, 554);
this.Controls.Add(this.label9);
this.Controls.Add(this.dateTimePicker2);
this.Controls.Add(this.label8);
this.Controls.Add(this.dateTimePicker1);
this.Controls.Add(this.radioButton2);
this.Controls.Add(this.radioButton1);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.button2);
this.Controls.Add(this.label5);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label4);
this.Controls.Add(this.button1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.monthCalendar1);
this.Controls.Add(this.listBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "Form1";
this.Text = "Календарь";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.MonthCalendar monthCalendar1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private Label label8;
private DateTimePicker dateTimePicker2;
private Label label9;
}
}

210
Сalendar/Form1.cs Normal file
View File

@@ -0,0 +1,210 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography.X509Certificates;
namespace Сalendar
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
if (File.Exists("date.dat")) //Заполнение событий из файла (Если существует)
{
listBox1.Items.Clear(); // очистка списка перед заполнением.
using (System.IO.StreamReader sr = new System.IO.StreamReader("date.dat")) // Чтение событий из файла и добавление их в список.
{
while (!sr.EndOfStream)
{
listBox1.Items.Add(sr.ReadLine());
}
}
}
}
List<Events> ev = new List<Events>(); //Создание списка класса Events
private void timer1_Tick(object sender, EventArgs e) //Timer для ввывода текущей даты и времени.
{
label3.Text = DateTime.Now.ToString("dd.MM.yyyy"); //Вывод текущей полной даты
label4.Text = DateTime.Now.ToString("HH:mm:ss"); //Вывод времени
if (DateTime.Now.DayOfWeek.ToString() == "Monday") //Условия для переводы текущего дня недели
{
label7.Text = "Понедельник";
}
else if (DateTime.Now.DayOfWeek.ToString() == "Tuesday")
{
label7.Text = "Вторник";
}
else if (DateTime.Now.DayOfWeek.ToString() == "Wednesday")
{
label7.Text = "Среда";
}
else if (DateTime.Now.DayOfWeek.ToString() == "Thursday")
{
label7.Text = "Четверг";
}
else if (DateTime.Now.DayOfWeek.ToString() == "Friday")
{
label7.Text = "Пятница";
}
else if (DateTime.Now.DayOfWeek.ToString() == "Saturday")
{
label7.Text = "Суббота";
}
else
{
label7.Text = "Воскресенье";
}
if (radioButton1.Checked) //Проверка выбора праздника и отключение не нужных элементов интерфейса
{
label8.Visible = false;
dateTimePicker1.Visible = false;
dateTimePicker2.Visible = false;
}
else //Включение интерфейса
{
label8.Visible = true;
dateTimePicker1.Visible = true;
dateTimePicker2.Visible = true;
}
if (checkBox1.Checked) //Смена имение кнопки взавизимости от отметки на редактирование события
{
button1.Text = "Изменить";
}
else
{
button1.Text = "Добавить";
}
}
private void button1_Click(object sender, EventArgs e) //Метод для записи события
{
if (checkBox1.Checked == false) // Условия для проверки отметки редактирования
{
label9.Text = ""; //очистка окна ошибки
if (radioButton1.Checked) //Условие для добавления праздников
{
ev.Add(new Events(textBox1.Text, monthCalendar1.SelectionStart.ToString("dd.MM.yyyy"), monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy"), "", "")); //Запись в список класса Events названия события и диапазона даты события
textBox1.Text = ""; //Очистка текстового поля
if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") == monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy")) // Условия для проверки указан был диапазон или единственная дата, для вывода в окно списка.
{
listBox1.Items.Add($"Праздник: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()}, на весь день");
}
else
{
listBox1.Items.Add($"Праздник: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()} по {ev.Last().getEnd_Date()}, на весь день");
}
}
if (radioButton2.Checked) //Условие для добавление напоминания
{
ev.Add(new Events(textBox1.Text, monthCalendar1.SelectionStart.ToString("dd.MM.yyyy"), monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy"), dateTimePicker1.Value.ToString("HH:mm"), dateTimePicker2.Value.ToString("HH:mm"))); //Запись в список класса Events названия события и диапазона даты события
textBox1.Text = ""; //Очистка текстового поля
if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") == monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy") && dateTimePicker1.Value.ToString() == dateTimePicker2.Value.ToString()) // Условия для проверки указан был диапазон или единственная дата, а также проверка указания времени для вывода в окно списка.
{
listBox1.Items.Add($"Напоминание: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()}, c {ev.Last().getTime_Start()} и на весь день");
}
else if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") != monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy") && dateTimePicker1.Value.ToString() == dateTimePicker2.Value.ToString())
{
listBox1.Items.Add($"Напоминание: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()} по {ev.Last().getEnd_Date()}, c {{ev.Last().getTime_Start()}} и на весь день");
}
else if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") == monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy") && dateTimePicker1.Value.ToString() != dateTimePicker2.Value.ToString())
{
listBox1.Items.Add($"Напоминание: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()}, c {ev.Last().getTime_Start()} по {ev.Last().getTime_End()}");
}
else if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") != monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy") && dateTimePicker1.Value.ToString() != dateTimePicker2.Value.ToString())
{
listBox1.Items.Add($"Напоминание: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()} по {ev.Last().getEnd_Date()}, c {ev.Last().getTime_Start()} по {ev.Last().getTime_End()}");
}
}
using (System.IO.StreamWriter sw = new System.IO.StreamWriter("date.dat")) //Создание файла и записи в него сохранненых событий
{
for (int l = 0; l < listBox1.Items.Count; l++)//цикл для прохождения по списку и записи списка в файл.
sw.WriteLine(listBox1.Items[l].ToString());
}
}
else
{
int i = listBox1.SelectedIndex; //запись индекса элемента списка который будет отредактирован
label9.Text = ""; //очистка ошибочного окна
if (i < 0) //проверка на наличие выделенного элемента
{
label9.Text = "Выберите соботие из списка!"; //ввыод ошибки пользователю
label9.ForeColor = System.Drawing.Color.Red; // Выделение красным цветом сообщения об ошибке
}
else
{
listBox1.Items.RemoveAt(i); //удаление из списка события для дальнейшей его перезаписи.
if (radioButton1.Checked) //проверка выбора праздника
{
ev.Add(new Events(textBox1.Text, monthCalendar1.SelectionStart.ToString("dd.MM.yyyy"), monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy"), "", "")); //Запись в список класса Events названия события и диапазона даты события
textBox1.Text = ""; //Очистка текстового поля
if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") == monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy")) // Условия для проверки указан был диапазон или единственная дата, для вывода в окно списка.
{
listBox1.Items.Insert(i, $"Праздник: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()}, на весь день");
}
else
{
listBox1.Items.Insert(i, $"Праздник: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()} по {ev.Last().getEnd_Date()}, на весь день");
}
}
if (radioButton2.Checked) //Условие для добавления праздников
{
ev.Add(new Events(textBox1.Text, monthCalendar1.SelectionStart.ToString("dd.MM.yyyy"), monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy"), dateTimePicker1.Value.ToString("HH:mm"), dateTimePicker2.Value.ToString("HH:mm"))); //Запись в список класса Events названия события и диапазона даты события
textBox1.Text = ""; //Очистка текстового поля
if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") == monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy") && dateTimePicker1.Value.ToString() == dateTimePicker2.Value.ToString()) //Условия для проверки указан был диапазон или единственная дата, а также проверка указания времени для вывода в окно списка.
{
listBox1.Items.Insert(i, $"Напоминание: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()}, c {ev.Last().getTime_Start()} и на весь день");
}
else if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") != monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy") && dateTimePicker1.Value.ToString() == dateTimePicker2.Value.ToString())
{
listBox1.Items.Insert(i, $"Напоминание: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()} по {ev.Last().getEnd_Date()}, c {{ev.Last().getTime_Start()}} и на весь день");
}
else if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") == monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy") && dateTimePicker1.Value.ToString() != dateTimePicker2.Value.ToString())
{
listBox1.Items.Insert(i, $"Напоминание: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()}, c {ev.Last().getTime_Start()} по {ev.Last().getTime_End()}");
}
else if (monthCalendar1.SelectionStart.ToString("dd.MM.yyyy") != monthCalendar1.SelectionEnd.ToString("dd.MM.yyyy") && dateTimePicker1.Value.ToString() != dateTimePicker2.Value.ToString())
{
listBox1.Items.Insert(i, $"Напоминание: {ev.Last().getEventName()}, начало: {ev.Last().getStart_Date()} по {ev.Last().getEnd_Date()}, c {ev.Last().getTime_Start()} по {ev.Last().getTime_End()}");
}
}
}
using (System.IO.StreamWriter sw = new System.IO.StreamWriter("date.dat")) // перезапись файла с сохраненными событиями
{
for (int l = 0; l < listBox1.Items.Count; l++)//цикл для прохождения по списку и записи списка в файл.
sw.WriteLine(listBox1.Items[l].ToString());
}
}
}
private void button2_Click(object sender, EventArgs e) //Кнопка для очистки списка заданий
{
listBox1.Items.Remove(listBox1.SelectedItem);//удаляет выбранное событие из списка
using (System.IO.StreamWriter sw = new System.IO.StreamWriter("date.dat")) // Перезапись файла с удаленным событием.
{
for (int l = 0; l < listBox1.Items.Count; l++)
sw.WriteLine(listBox1.Items[l].ToString());
}
if (listBox1.Items.Count == 0) //Если все события были удаленны, то удаляется файл.
{
System.IO.File.Delete("date.dat");
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}

1125
Сalendar/Form1.resx Normal file

File diff suppressed because it is too large Load Diff

22
Сalendar/Program.cs Normal file
View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Сalendar
{
static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанных со сборкой.
[assembly: AssemblyTitle("Сalendar")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Сalendar")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// COM, следует установить атрибут ComVisible в TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("093cf92d-b515-4c14-91a0-94db41719cd5")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Редакция
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программным средством.
// Версия среды выполнения: 4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
// код создан повторно.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Сalendar.Properties
{
/// <summary>
/// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
/// </summary>
// Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
// класс с помощью таких средств, как ResGen или Visual Studio.
// Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
// с параметром /str или заново постройте свой VS-проект.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Сalendar.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Переопределяет свойство CurrentUICulture текущего потока для всех
/// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Сalendar.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

Binary file not shown.

BIN
Сalendar/calanderalt.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

Binary file not shown.

View File

@@ -0,0 +1 @@
2cfc6071cbac3a770f779a6f260d197dbcb457db

View File

@@ -0,0 +1,22 @@
C:\Users\Антон\source\repos\Сalendar\Сalendar\bin\Debug\Сalendar.exe.config
C:\Users\Антон\source\repos\Сalendar\Сalendar\bin\Debug\Сalendar.exe
C:\Users\Антон\source\repos\Сalendar\Сalendar\bin\Debug\Сalendar.pdb
C:\Users\Антон\source\repos\Сalendar\Сalendar\obj\Debug\Сalendar.Form1.resources
C:\Users\Антон\source\repos\Сalendar\Сalendar\obj\Debug\Сalendar.Properties.Resources.resources
C:\Users\Антон\source\repos\Сalendar\Сalendar\obj\Debug\Сalendar.csproj.GenerateResource.cache
C:\Users\Антон\source\repos\Сalendar\Сalendar\obj\Debug\Сalendar.csproj.CoreCompileInputs.cache
C:\Users\Антон\source\repos\Сalendar\Сalendar\obj\Debug\Сalendar.exe
C:\Users\Антон\source\repos\Сalendar\Сalendar\obj\Debug\Сalendar.pdb
C:\Users\Антон\source\repos\Сalendar\Сalendar\obj\Debug\Сalendar.csproj.AssemblyReference.cache
C:\Users\Антон\source\repos\Сalendar\Сalendar\obj\Debug\Сalendar.csproj.SuggestedBindingRedirects.cache
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\bin\Debug\Сalendar.exe.config
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\bin\Debug\Сalendar.exe
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\bin\Debug\Сalendar.pdb
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\obj\Debug\Сalendar.csproj.AssemblyReference.cache
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\obj\Debug\Сalendar.csproj.SuggestedBindingRedirects.cache
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\obj\Debug\Сalendar.Form1.resources
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\obj\Debug\Сalendar.Properties.Resources.resources
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\obj\Debug\Сalendar.csproj.GenerateResource.cache
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\obj\Debug\Сalendar.csproj.CoreCompileInputs.cache
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\obj\Debug\Сalendar.exe
C:\Users\Anton\SynologyDrive\SynologyDrive\2021 долги\Сalendar\Сalendar\obj\Debug\Сalendar.pdb

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{093CF92D-B515-4C14-91A0-94DB41719CD5}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Сalendar</RootNamespace>
<AssemblyName>Сalendar</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>calanderalt.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Events.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="calanderalt.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>