Skip to content

Commit

Permalink
implement jump to file
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotwoods committed Feb 3, 2012
1 parent df2dbe1 commit bb3e45d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions StartupControl/StartupControl/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 27 additions & 3 deletions StartupControl/StartupControl/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public partial class Form1 : Form
Timer timer = new Timer();

const float FInterval = 0.05f;
const string FFilename = "StartupControl.save";
const string FSettingsFilename = "StartupControl.save";
float FTotalTime = 10.0f;
float FProgress = 0;

Expand All @@ -40,6 +40,14 @@ private void cancel_Click(object sender, EventArgs e)
Close();
}

string Path
{
get
{
return loadPath.Text;
}
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Escape)
Expand All @@ -50,6 +58,11 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
private void Start()
{
timer.Stop();
if (loadPath.Text != "")
{
Process.Start(loadPath.Text);
Close();
}
MessageBox.Show("Starting application");
}

Expand Down Expand Up @@ -110,7 +123,7 @@ void SaveSettings()
{
try
{
StreamWriter OutFile = new StreamWriter(FFilename);
StreamWriter OutFile = new StreamWriter(FSettingsFilename);
OutFile.WriteLine(loadPath.Text);
OutFile.WriteLine(target.Value);
OutFile.Close();
Expand All @@ -125,7 +138,7 @@ void LoadSettings()
{
try
{
StreamReader InFile = new StreamReader(FFilename);
StreamReader InFile = new StreamReader(FSettingsFilename);
loadPath.Text = InFile.ReadLine();
target.Value = System.Convert.ToInt32(InFile.ReadLine());
InFile.Close();
Expand All @@ -141,5 +154,16 @@ void LoadSettings()
else if (target.Value > 100)
target.Value = 100;
}

private void target_Scroll(object sender, EventArgs e)
{
SaveSettings();
}

private void loadPath_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (Path != "")
Process.Start("explorer.exe", "/select," + loadPath.Text);
}
}
}

0 comments on commit bb3e45d

Please sign in to comment.