diff --git a/TimeTable/Properties/Resources.Designer.cs b/TimeTable/Properties/Resources.Designer.cs new file mode 100644 index 0000000..820d0fb --- /dev/null +++ b/TimeTable/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace TimeTable.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TimeTable.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/TimeTable/Properties/Resources.resx b/TimeTable/Properties/Resources.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/TimeTable/Properties/Resources.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TimeTable/TimeTable.csproj b/TimeTable/TimeTable.csproj index c0a046f..2bf3cf7 100644 --- a/TimeTable/TimeTable.csproj +++ b/TimeTable/TimeTable.csproj @@ -14,5 +14,19 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + \ No newline at end of file diff --git a/TimeTable/controll/SqliteCommands.cs b/TimeTable/controll/SqliteCommands.cs index 8068cba..db6acff 100644 --- a/TimeTable/controll/SqliteCommands.cs +++ b/TimeTable/controll/SqliteCommands.cs @@ -156,5 +156,16 @@ namespace TimeTable.controll { sqliteCmd.ExecuteNonQuery(); con.Close(); } + + public static void DeleteTableRow(string uid, string sqlConnection) { + SqliteConnection con = new SqliteConnection(sqlConnection); + con.Open(); + SqliteCommand sqliteCmd = con.CreateCommand(); + sqliteCmd.CommandText = @"Delete FROM timetable WHERE uid='" + uid + "';"; + con.Open(); + sqliteCmd.ExecuteNonQuery(); + con.Close(); + + } } } diff --git a/TimeTable/view/Decide.Designer.cs b/TimeTable/view/Decide.Designer.cs new file mode 100644 index 0000000..a6eac03 --- /dev/null +++ b/TimeTable/view/Decide.Designer.cs @@ -0,0 +1,109 @@ +using System.Drawing; + +namespace TimeTable.view { + partial class decide { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(decide)); + stopBtn = new Button(); + resumeBtn = new Button(); + cancelBtn = new Button(); + pictureBox1 = new PictureBox(); + label1 = new Label(); + ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); + SuspendLayout(); + // + // stopBtn + // + stopBtn.Location = new Point(130, 81); + stopBtn.Name = "stopBtn"; + stopBtn.Size = new Size(94, 29); + stopBtn.TabIndex = 0; + stopBtn.Text = "Stop"; + stopBtn.UseVisualStyleBackColor = true; + // + // resumeBtn + // + resumeBtn.Location = new Point(230, 81); + resumeBtn.Name = "resumeBtn"; + resumeBtn.Size = new Size(94, 29); + resumeBtn.TabIndex = 1; + resumeBtn.Text = "Resume"; + resumeBtn.UseVisualStyleBackColor = true; + // + // cancelBtn + // + cancelBtn.Location = new Point(330, 81); + cancelBtn.Name = "cancelBtn"; + cancelBtn.Size = new Size(94, 29); + cancelBtn.TabIndex = 2; + cancelBtn.Text = "Cancel"; + cancelBtn.UseVisualStyleBackColor = true; + // + // pictureBox1 + // + pictureBox1.Image = (Image)resources.GetObject("pictureBox1.Image"); + pictureBox1.Location = new Point(19, 20); + pictureBox1.Margin = new Padding(10, 0, 0, 0); + pictureBox1.Name = "pictureBox1"; + pictureBox1.Size = new Size(61, 57); + pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; + pictureBox1.TabIndex = 3; + pictureBox1.TabStop = false; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(130, 38); + label1.Name = "label1"; + label1.Size = new Size(267, 20); + label1.TabIndex = 4; + label1.Text = "What should happen to the Time Item?"; + // + // decide + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(439, 122); + Controls.Add(label1); + Controls.Add(pictureBox1); + Controls.Add(cancelBtn); + Controls.Add(resumeBtn); + Controls.Add(stopBtn); + Name = "decide"; + Text = "What to do?"; + ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button stopBtn; + private Button resumeBtn; + private Button cancelBtn; + private PictureBox pictureBox1; + private Label label1; + } +} \ No newline at end of file diff --git a/TimeTable/view/Decide.cs b/TimeTable/view/Decide.cs new file mode 100644 index 0000000..fa51af0 --- /dev/null +++ b/TimeTable/view/Decide.cs @@ -0,0 +1,8 @@ +namespace TimeTable.view { + public partial class decide : Form { + public decide() { + InitializeComponent(); + } + + } +} diff --git a/TimeTable/view/Decide.resx b/TimeTable/view/Decide.resx new file mode 100644 index 0000000..3f58db7 --- /dev/null +++ b/TimeTable/view/Decide.resx @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAS + cwAAEnMBjCK5BwAAC61JREFUWEftmHlU1OUax9l3EVNSLFOQRdnUtGOuiQiGqVcxwOOSmiRWrmGYy+1e + j1YmpmJiKJusIjvMMAMzMAsMzLBvCkKiIg6boCIMLjDfc5/fDNbpHG91S/P+0XPO5/x+83u3L8/7Ps/7 + vmj8bX/b7zBHZyfDj/z8PLZt23Zw7dq1q6dOnTaaPmuqS1+yWVtbawQFBc1JTU2TZWfn9MXGxt1YudJz + IxWZqmu8ZHNychoXGXkhlcQN8vkFEAgEym+/Dayi725UrKeu9ZLM2NhY59y5c/7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/VGI8cbWUlhSE5NfxIQsJdPAido + hIScy6DD6JPcXB5YKReQFH4MyRGBSGGIOoHM6JNgxZ0GJ+EMsi/9gNyU8xCkhUPMikRBVhQk3FhI6c4h + y7mIEv5FFBPMuyw7HoVUVpBFEUp1hdSGnxKq6oOTcJb6/B6ZMaeQSmOkRBxHctgxpEafhoDPIy/mDO7f + f7CSBM7R8PT0/IJc2hgWFtkXFhHVHxEZoyIyKqY/Oia+Py7+kiLhUrIiOSVdkZbBVrDYXAWHy1fw+AJF + niBfIc6XKPIlUkWhVKaQyooJmeq9oFCqEIklqjo8noDa8BSZ1DYtnaVITE5TXExIVsTGJSiiouMVNF5f + eESUmvCIvqCg011Lly5lkUAX5l9orzo4OHzk4OD4DXGKOM3g6PgTQQxOTk6E8084OzNMCaIL+TNRlzuf + onY/4ejIoBqDcDj5FHt7+yGYd4eTtrZ2R01NTX1JoAOhuhcMI94gmK3G9jlh8xswY/03JhLjCEbX/7Np + aPwHx1g7vs5VsDQAAAAASUVORK5CYII= + + + \ No newline at end of file diff --git a/TimeTable/view/Main.Designer.cs b/TimeTable/view/Main.Designer.cs index 2cc9a65..6a1d349 100644 --- a/TimeTable/view/Main.Designer.cs +++ b/TimeTable/view/Main.Designer.cs @@ -36,6 +36,7 @@ namespace TimeTable { bindingSource = new BindingSource(components); con = new SQLiteConnection(); dataAdapter = new SQLiteDataAdapter(); + btnDelete = new Button(); btnPanel.SuspendLayout(); tableView.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)taskTimeGridView).BeginInit(); @@ -45,6 +46,7 @@ namespace TimeTable { // btnPanel // btnPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; + btnPanel.Controls.Add(btnDelete); btnPanel.Controls.Add(btnTaskStop); btnPanel.Controls.Add(btnTaskStart); btnPanel.Controls.Add(btnStopResume); @@ -102,7 +104,6 @@ namespace TimeTable { tableView.Name = "tableView"; tableView.Size = new Size(631, 378); tableView.TabIndex = 1; - // // taskTimeGridView // @@ -110,18 +111,17 @@ namespace TimeTable { taskTimeGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; taskTimeGridView.DataSource = bindingSource; taskTimeGridView.Dock = DockStyle.Fill; + taskTimeGridView.EditMode = DataGridViewEditMode.EditProgrammatically; taskTimeGridView.Location = new Point(0, 0); taskTimeGridView.Name = "taskTimeGridView"; taskTimeGridView.RowHeadersWidth = 51; taskTimeGridView.Size = new Size(631, 378); taskTimeGridView.TabIndex = 0; - taskTimeGridView.EditMode = DataGridViewEditMode.EditProgrammatically; - taskTimeGridView.CellContentDoubleClick += timetableEditDoubleClick; + taskTimeGridView.CellContentDoubleClick += TimetableEditDoubleClick; // // con // con.BusyTimeout = 0; - //con.ConnectionString = sqlConnectionString; con.ConnectionString = sqlConnectionString; con.DefaultDbType = null; con.DefaultMaximumSleepTime = 150; @@ -137,9 +137,18 @@ namespace TimeTable { con.TraceFlags = SQLiteTraceFlags.SQLITE_TRACE_NONE; con.VfsName = null; con.WaitTimeout = 30000; - // bindingSource.DataSource = createDataTable(); bindingSource.DataSource = createDataTable(); // + // btnDelete + // + btnDelete.Location = new Point(8, 78); + btnDelete.Name = "btnDelete"; + btnDelete.Size = new Size(94, 26); + btnDelete.TabIndex = 4; + btnDelete.Text = "Delete"; + btnDelete.UseVisualStyleBackColor = true; + btnDelete.Click += DeleteRow; + // // Main // AutoScaleDimensions = new SizeF(8F, 20F); @@ -165,7 +174,14 @@ namespace TimeTable { return table; } - private void timetableEditDoubleClick(object sender, DataGridViewCellEventArgs e) { + private void DeleteRow(object sender, EventArgs e) { + DataGridViewRow row = taskTimeGridView.Rows[0]; + string currentId = row.Cells[0].Value.ToString(); + SqliteCommands.DeleteTableRow(currentId, sqlConnectionString); + bindingSource.DataSource = createDataTable(); + } + + private void TimetableEditDoubleClick(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = taskTimeGridView.Rows[0]; string uid = row.Cells[0].Value.ToString(); string start = row.Cells[1].Value.ToString(); @@ -184,6 +200,7 @@ namespace TimeTable { con.Open(); sqliteCmd.ExecuteNonQuery(); con.Close(); + bindingSource.DataSource = createDataTable(); } @@ -224,5 +241,6 @@ namespace TimeTable { private SQLiteConnection con; private SQLiteDataAdapter dataAdapter; private System.ComponentModel.IContainer components; + private Button btnDelete; } }