diff --git a/AboutControl.Designer.cs b/AboutControl.Designer.cs index d461b46..de8e452 100644 --- a/AboutControl.Designer.cs +++ b/AboutControl.Designer.cs @@ -47,10 +47,10 @@ private void InitializeComponent() // aboutLbl // this.aboutLbl.AutoSize = true; - this.aboutLbl.Font = new System.Drawing.Font("Roboto", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.aboutLbl.Location = new System.Drawing.Point(360, 14); + this.aboutLbl.Font = new System.Drawing.Font("Roboto", 15.75F); + this.aboutLbl.Location = new System.Drawing.Point(350, 0); this.aboutLbl.Name = "aboutLbl"; - this.aboutLbl.Size = new System.Drawing.Size(60, 23); + this.aboutLbl.Size = new System.Drawing.Size(69, 25); this.aboutLbl.TabIndex = 3; this.aboutLbl.Text = "About"; // @@ -205,7 +205,7 @@ private void InitializeComponent() this.Controls.Add(this.lblInfo); this.Controls.Add(this.aboutLbl); this.Name = "AboutControl"; - this.Size = new System.Drawing.Size(802, 467); + this.Size = new System.Drawing.Size(800, 460); this.ResumeLayout(false); this.PerformLayout(); diff --git a/HomeControl.Designer.cs b/HomeControl.Designer.cs index f1d4c2b..fb55569 100644 --- a/HomeControl.Designer.cs +++ b/HomeControl.Designer.cs @@ -32,13 +32,14 @@ private void InitializeComponent() this.todayUsageLbl = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.statusLbl = new System.Windows.Forms.Label(); + this.defaultLbl = new System.Windows.Forms.Label(); this.SuspendLayout(); // // appString // this.appString.AutoSize = true; this.appString.Font = new System.Drawing.Font("Sans Serif Collection", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.appString.Location = new System.Drawing.Point(285, 0); + this.appString.Location = new System.Drawing.Point(309, 31); this.appString.Name = "appString"; this.appString.Size = new System.Drawing.Size(155, 32); this.appString.TabIndex = 1; @@ -48,20 +49,20 @@ private void InitializeComponent() // todayUsageLbl // this.todayUsageLbl.AutoSize = true; - this.todayUsageLbl.Location = new System.Drawing.Point(3, 31); + this.todayUsageLbl.Location = new System.Drawing.Point(3, 50); this.todayUsageLbl.Name = "todayUsageLbl"; - this.todayUsageLbl.Size = new System.Drawing.Size(35, 13); + this.todayUsageLbl.Size = new System.Drawing.Size(227, 13); this.todayUsageLbl.TabIndex = 3; - this.todayUsageLbl.Text = "label1"; + this.todayUsageLbl.Text = "Press the \"Reload\" button to get todays usage"; this.todayUsageLbl.Click += new System.EventHandler(this.todayUsageLbl_Click); // // button1 // - this.button1.Location = new System.Drawing.Point(6, 5); + this.button1.Location = new System.Drawing.Point(0, 24); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 16; - this.button1.Text = "reload"; + this.button1.Text = "Reload"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // @@ -75,17 +76,28 @@ private void InitializeComponent() this.statusLbl.Text = "Offline"; this.statusLbl.Click += new System.EventHandler(this.statusLbl_Click); // + // defaultLbl + // + this.defaultLbl.AutoSize = true; + this.defaultLbl.Font = new System.Drawing.Font("Roboto", 15.75F); + this.defaultLbl.Location = new System.Drawing.Point(350, 0); + this.defaultLbl.Name = "defaultLbl"; + this.defaultLbl.Size = new System.Drawing.Size(68, 25); + this.defaultLbl.TabIndex = 18; + this.defaultLbl.Text = "Home"; + // // HomeControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.defaultLbl); this.Controls.Add(this.statusLbl); this.Controls.Add(this.button1); this.Controls.Add(this.todayUsageLbl); this.Controls.Add(this.appString); this.ForeColor = System.Drawing.SystemColors.ControlText; this.Name = "HomeControl"; - this.Size = new System.Drawing.Size(802, 467); + this.Size = new System.Drawing.Size(800, 460); this.ResumeLayout(false); this.PerformLayout(); @@ -96,5 +108,6 @@ private void InitializeComponent() private System.Windows.Forms.Label todayUsageLbl; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label statusLbl; + private System.Windows.Forms.Label defaultLbl; } } diff --git a/HomeControl.cs b/HomeControl.cs index 15e2993..e52d99f 100644 --- a/HomeControl.cs +++ b/HomeControl.cs @@ -49,7 +49,10 @@ private void InitializeTimer() { System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); timer.Interval = 1000; // 1 second - timer.Tick += Timer_Tick; + if (!DesignMode) + { + timer.Tick += Timer_Tick; + } timer.Start(); } @@ -177,6 +180,24 @@ private async void Timer_Tick(object sender, EventArgs e) appString.Text = $"{finString}"; } + else + { + //TODO: rn doesnt stop the db recoprding process + // If the current app is being tracked, stop tracking it + if (currentApp != null) + { + end = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + Debug.WriteLine($"{currentApp}, Start-{start}, End-{end}"); + if (!DesignMode) + { + await Task.Run(() => DatabaseHelper.InsertDataAsync(currentApp, start, end)); + } + + + currentApp = null; // Reset currentApp + } + appString.Text = $"No active app"; + } } finally { diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 54dc2fc..0e9be59 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -31,12 +31,12 @@ private void InitializeComponent() this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.homeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutControl1 = new ScreenTime.AboutControl(); this.settingsControl1 = new ScreenTime.SettingsControl(); this.homeControl1 = new ScreenTime.HomeControl(); this.reportsControl1 = new ScreenTime.ReportsControl(); - this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -44,12 +44,12 @@ private void InitializeComponent() // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.homeToolStripMenuItem, - this.reportsToolStripMenuItem, this.settingsToolStripMenuItem, + this.reportsToolStripMenuItem, this.aboutToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(800, 24); + this.menuStrip1.Size = new System.Drawing.Size(804, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -63,10 +63,17 @@ private void InitializeComponent() // settingsToolStripMenuItem // this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; - this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); - this.settingsToolStripMenuItem.Text = "Settings"; + this.settingsToolStripMenuItem.Size = new System.Drawing.Size(59, 20); + this.settingsToolStripMenuItem.Text = "Reports"; this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click); // + // reportsToolStripMenuItem + // + this.reportsToolStripMenuItem.Name = "reportsToolStripMenuItem"; + this.reportsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); + this.reportsToolStripMenuItem.Text = "Settings"; + this.reportsToolStripMenuItem.Click += new System.EventHandler(this.reportsToolStripMenuItem_Click); + // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; @@ -99,23 +106,18 @@ private void InitializeComponent() // // reportsControl1 // + this.reportsControl1.Font = new System.Drawing.Font("Roboto", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.reportsControl1.Location = new System.Drawing.Point(0, 27); + this.reportsControl1.Margin = new System.Windows.Forms.Padding(6); this.reportsControl1.Name = "reportsControl1"; this.reportsControl1.Size = new System.Drawing.Size(800, 421); this.reportsControl1.TabIndex = 4; // - // reportsToolStripMenuItem - // - this.reportsToolStripMenuItem.Name = "reportsToolStripMenuItem"; - this.reportsToolStripMenuItem.Size = new System.Drawing.Size(59, 20); - this.reportsToolStripMenuItem.Text = "Reports"; - this.reportsToolStripMenuItem.Click += new System.EventHandler(this.reportsToolStripMenuItem_Click); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(804, 451); this.Controls.Add(this.reportsControl1); this.Controls.Add(this.aboutControl1); this.Controls.Add(this.settingsControl1); diff --git a/README.md b/README.md index 1684705..6f849a0 100644 --- a/README.md +++ b/README.md @@ -1 +1,22 @@ -# ScreenTime \ No newline at end of file +# ScreenTime + +ScreenTime is an app to track how much time you have spend across various applications on Windows. + +The app is stil in development, so any feedback and suggestions are appreciated! + + +## Features + +- Currently focused app tracking every second. +- App usage history, by calendar day. +- Fully local databse, no imternet connection or account creation required. +- App usage history, by hour. (W.I.P) +- User-set status according to the currently focused app. (W.I.P) + +## How to use + +I welcome contributions to my projects. No specific rules, do whatever you want. + +## Contact + +You can reach me at maxazarskov@gmail.com or connect with me on [LinkedIn](https://www.linkedin.com/in/maksim-azarskov-59a6b6215/). diff --git a/ReportsControl.Designer.cs b/ReportsControl.Designer.cs index ae57f77..cf60b68 100644 --- a/ReportsControl.Designer.cs +++ b/ReportsControl.Designer.cs @@ -34,18 +34,21 @@ private void InitializeComponent() // reportsLbl // this.reportsLbl.AutoSize = true; - this.reportsLbl.Font = new System.Drawing.Font("Roboto", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.reportsLbl.Location = new System.Drawing.Point(346, 18); + this.reportsLbl.Font = new System.Drawing.Font("Roboto", 15.75F); + this.reportsLbl.Location = new System.Drawing.Point(350, 0); + this.reportsLbl.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.reportsLbl.Name = "reportsLbl"; - this.reportsLbl.Size = new System.Drawing.Size(76, 23); + this.reportsLbl.Size = new System.Drawing.Size(89, 25); this.reportsLbl.TabIndex = 4; - this.reportsLbl.Text = "Reports"; + this.reportsLbl.Text = "Settings"; // // ReportsControl // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.reportsLbl); + this.Font = new System.Drawing.Font("Roboto", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6); this.Name = "ReportsControl"; this.Size = new System.Drawing.Size(800, 460); this.ResumeLayout(false); diff --git a/ScreenTime.csproj b/ScreenTime.csproj index 210e720..dfe7d6f 100644 --- a/ScreenTime.csproj +++ b/ScreenTime.csproj @@ -17,7 +17,7 @@ false - E:\coding\Projects\ + E:\coding\Projects\Screen\bin\ true Disk false @@ -28,8 +28,7 @@ false true publish.htm - true - 4 + 5 0.1.0.%2a false true diff --git a/SettingsControl.Designer.cs b/SettingsControl.Designer.cs index 8d908be..8e8b032 100644 --- a/SettingsControl.Designer.cs +++ b/SettingsControl.Designer.cs @@ -41,11 +41,11 @@ private void InitializeComponent() // this.settingsLbl.AutoSize = true; this.settingsLbl.Font = new System.Drawing.Font("Roboto", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.settingsLbl.Location = new System.Drawing.Point(353, 21); + this.settingsLbl.Location = new System.Drawing.Point(350, 0); this.settingsLbl.Name = "settingsLbl"; - this.settingsLbl.Size = new System.Drawing.Size(89, 25); + this.settingsLbl.Size = new System.Drawing.Size(86, 25); this.settingsLbl.TabIndex = 0; - this.settingsLbl.Text = "Settings"; + this.settingsLbl.Text = "Reports"; this.settingsLbl.Click += new System.EventHandler(this.settingsLbl_Click); // // dbButton @@ -89,9 +89,9 @@ private void InitializeComponent() this.dayUsageLbl.AutoSize = true; this.dayUsageLbl.Location = new System.Drawing.Point(4, 47); this.dayUsageLbl.Name = "dayUsageLbl"; - this.dayUsageLbl.Size = new System.Drawing.Size(35, 13); + this.dayUsageLbl.Size = new System.Drawing.Size(276, 13); this.dayUsageLbl.TabIndex = 6; - this.dayUsageLbl.Text = "label1"; + this.dayUsageLbl.Text = "Select a date from the calender to see stats from that day"; this.dayUsageLbl.Click += new System.EventHandler(this.dayUsageLbl_Click); // // SettingsControl