diff --git a/OWTrack.sln b/OWTrack.sln index fbd6586..6f79863 100644 --- a/OWTrack.sln +++ b/OWTrack.sln @@ -8,13 +8,19 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {299A3198-B25D-4E4F-901D-A2F8A02C6993}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {299A3198-B25D-4E4F-901D-A2F8A02C6993}.Debug|Any CPU.Build.0 = Debug|Any CPU + {299A3198-B25D-4E4F-901D-A2F8A02C6993}.Debug|x64.ActiveCfg = Debug|x64 + {299A3198-B25D-4E4F-901D-A2F8A02C6993}.Debug|x64.Build.0 = Debug|x64 {299A3198-B25D-4E4F-901D-A2F8A02C6993}.Release|Any CPU.ActiveCfg = Release|Any CPU {299A3198-B25D-4E4F-901D-A2F8A02C6993}.Release|Any CPU.Build.0 = Release|Any CPU + {299A3198-B25D-4E4F-901D-A2F8A02C6993}.Release|x64.ActiveCfg = Release|x64 + {299A3198-B25D-4E4F-901D-A2F8A02C6993}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/OWTrack/Form1.Designer.cs b/OWTrack/Form1.Designer.cs index e81503d..74bbf08 100644 --- a/OWTrack/Form1.Designer.cs +++ b/OWTrack/Form1.Designer.cs @@ -29,12 +29,68 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + this.label1 = new System.Windows.Forms.Label(); + this.status = new System.Windows.Forms.Label(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.Time = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 36); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(75, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Overwatch is: "; + // + // status + // + this.status.AutoSize = true; + this.status.ForeColor = System.Drawing.Color.Black; + this.status.Location = new System.Drawing.Point(93, 36); + this.status.Name = "status"; + this.status.Size = new System.Drawing.Size(35, 13); + this.status.TabIndex = 1; + this.status.Text = "label2"; + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Interval = 3000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // Time + // + this.Time.AutoSize = true; + this.Time.Location = new System.Drawing.Point(15, 13); + this.Time.Name = "Time"; + this.Time.Size = new System.Drawing.Size(35, 13); + this.Time.TabIndex = 2; + this.Time.Text = "label2"; + // + // Form1 + // + 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(406, 267); + this.Controls.Add(this.Time); + this.Controls.Add(this.status); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "Form1"; this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label status; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.Label Time; } } diff --git a/OWTrack/Form1.cs b/OWTrack/Form1.cs index 4c14df1..1d4dc01 100644 --- a/OWTrack/Form1.cs +++ b/OWTrack/Form1.cs @@ -7,14 +7,41 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.Drawing; namespace OWTrack { public partial class Form1 : Form { + Tracker tr = new Tracker(); + private const string IS_RUNNING = "Running"; + private const string NOT_RUNNING = " Not running"; + + public Form1() { InitializeComponent(); + checkStatus(); + } + + private void timer1_Tick(object sender, EventArgs e) + { + checkStatus(); + } + + private void checkStatus() + { + Time.Text = DateTime.Now.ToString("h:mm tt"); + if (tr.owRunning()) + { + status.Text = IS_RUNNING; + status.ForeColor = Color.FromArgb(128, 255, 128); + } + else + { + status.Text = NOT_RUNNING; + status.ForeColor = Color.Red; + } } } } diff --git a/OWTrack/Form1.resx b/OWTrack/Form1.resx new file mode 100644 index 0000000..1f666f2 --- /dev/null +++ b/OWTrack/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + \ No newline at end of file diff --git a/OWTrack/OWTrack.csproj b/OWTrack/OWTrack.csproj index 6aa6eda..a849ff4 100644 --- a/OWTrack/OWTrack.csproj +++ b/OWTrack/OWTrack.csproj @@ -31,6 +31,26 @@ prompt 4 + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + @@ -51,8 +71,12 @@ Form1.cs + + + Form1.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/OWTrack/Tracker.cs b/OWTrack/Tracker.cs new file mode 100644 index 0000000..39f50ac --- /dev/null +++ b/OWTrack/Tracker.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OWTrack +{ + class Tracker + { + + public void Track() + { + + } + + public bool owRunning() + { + bool isRunning = Process.GetProcessesByName("Overwatch") + .FirstOrDefault(p => p.MainModule.FileName.StartsWith(@"D:\Hesham\installed Games\Overwatch")) != default(Process); + return isRunning; + } + } +}