openFileDialog

This commit is contained in:
HeshamTB 2018-08-31 20:17:26 +03:00
parent e5b0fcf173
commit e948a1964a
4 changed files with 26 additions and 1 deletions

View File

@ -46,6 +46,7 @@
this.srTextBox = new System.Windows.Forms.TextBox(); this.srTextBox = new System.Windows.Forms.TextBox();
this.srBut = new System.Windows.Forms.Button(); this.srBut = new System.Windows.Forms.Button();
this.srLabel = new System.Windows.Forms.Label(); this.srLabel = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
@ -215,6 +216,13 @@
this.srLabel.TabIndex = 13; this.srLabel.TabIndex = 13;
this.srLabel.Text = "0"; this.srLabel.Text = "0";
// //
// openFileDialog1
//
this.openFileDialog1.FileName = "Overwatch.exe";
this.openFileDialog1.InitialDirectory = "C:\\";
this.openFileDialog1.RestoreDirectory = true;
this.openFileDialog1.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialog1_FileOk);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -265,6 +273,7 @@
private System.Windows.Forms.TextBox srTextBox; private System.Windows.Forms.TextBox srTextBox;
private System.Windows.Forms.Button srBut; private System.Windows.Forms.Button srBut;
private System.Windows.Forms.Label srLabel; private System.Windows.Forms.Label srLabel;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
} }
} }

View File

@ -47,6 +47,12 @@ namespace OWTrack
{ {
tr.wins = savedTracker().wins; tr.wins = savedTracker().wins;
tr.losses = savedTracker().losses; tr.losses = savedTracker().losses;
tr.gamePath = savedTracker().gamePath;
if (tr.gamePath == "" || tr.gamePath == null)
{
openFileDialog1.Title = "Select Overwatch.exe";
openFileDialog1.ShowDialog();
}
update(); update();
} }
else MessageBox.Show("no save"); else MessageBox.Show("no save");
@ -156,5 +162,10 @@ namespace OWTrack
} }
update(); update();
} }
private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
{
MessageBox.Show("ok");
}
} }
} }

View File

@ -120,4 +120,7 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>104, 17</value>
</metadata>
</root> </root>

View File

@ -8,6 +8,7 @@ namespace OWTrack
class Tracker class Tracker
{ {
public int wins, losses, startSR, newSR = 0; public int wins, losses, startSR, newSR = 0;
public string gamePath;
public void Track() { } public void Track() { }
public void reset() { wins = 0; losses = 0; startSR = 0; newSR = 0; } public void reset() { wins = 0; losses = 0; startSR = 0; newSR = 0; }
@ -20,12 +21,13 @@ namespace OWTrack
public void setNewSR(int SR) { newSR = SR; } public void setNewSR(int SR) { newSR = SR; }
public int srDiff() { return newSR - startSR; } public int srDiff() { return newSR - startSR; }
public bool owRunning() public bool owRunning()
{ {
try try
{ {
bool isRunning = Process.GetProcessesByName("Overwatch") bool isRunning = Process.GetProcessesByName("Overwatch")
.FirstOrDefault(p => p.MainModule.FileName.StartsWith(@"D:\Hesham\installed Games\Overwatch")) != default(Process); .FirstOrDefault(p => p.MainModule.FileName.StartsWith(gamePath)) != default(Process);
return isRunning; return isRunning;
} }
catch (Exception e) catch (Exception e)