Skip to content

Commit

Permalink
Fixes #1, Added Icon, Auto-Reloading of files on change, Fixes displa…
Browse files Browse the repository at this point in the history
…y of reloaded files not updating
  • Loading branch information
founderio committed Jan 28, 2015
1 parent 3fc900f commit 0f79f66
Show file tree
Hide file tree
Showing 27 changed files with 422 additions and 110 deletions.
12 changes: 7 additions & 5 deletions EDRoutePlanner/CommoditySelection.Designer.cs

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

66 changes: 35 additions & 31 deletions EDRoutePlanner/CommoditySelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,9 @@ public CommoditySelection(MainScreen mainScreen)
{
this.mainScreen = mainScreen;
InitializeComponent();
updateDisplay();
}

private void btnUseSelected_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}

private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}

private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count == 0)
{
btnUseSelected.Enabled = false;
}
else
{
btnUseSelected.Enabled = true;
selectedCommodity = listView1.SelectedItems[0].Text;
}
}

private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
selectedAmount = (int)numericUpDown1.Value;
updateDisplay();
}

public void updateDisplay()
public void UpdateDisplay()
{
listView1.Items.Clear();
listView1.Groups.Clear();
Expand Down Expand Up @@ -132,6 +102,35 @@ public void updateDisplay()
}
}

private void btnUseSelected_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}

private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}

private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count == 0)
{
btnUseSelected.Enabled = false;
}
else
{
btnUseSelected.Enabled = true;
selectedCommodity = listView1.SelectedItems[0].Text;
}
}

private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
selectedAmount = (int)numericUpDown1.Value;
UpdateDisplay();
}

private void listView1_DoubleClick(object sender, EventArgs e)
{
submit();
Expand All @@ -153,5 +152,10 @@ private void listView1_KeyDown(object sender, KeyEventArgs e)
submit();
}
}

private void CommoditySelection_Load(object sender, EventArgs e)
{
this.Icon = Properties.Resources.Icon;
}
}
}
6 changes: 5 additions & 1 deletion EDRoutePlanner/CsvReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class CsvReader
private string path;

private TextReader reader;
private FileStream fs;

public CsvReader(string path)
{
Expand All @@ -36,7 +37,8 @@ public void Open()
{
if (path != null && File.Exists(path))
{
reader = new StreamReader(path);
fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
reader = new StreamReader(fs);
}
}

Expand All @@ -46,6 +48,8 @@ public void Close()
{
reader.Close();
reader = null;
fs.Close();
fs = null;
}
}

Expand Down
24 changes: 14 additions & 10 deletions EDRoutePlanner/DefaultsForm.Designer.cs

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

15 changes: 7 additions & 8 deletions EDRoutePlanner/DefaultsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,8 @@ private void btnCancel_Click(object sender, EventArgs e)
private string openFile(string previous)
{
OpenFileDialog ofd = new OpenFileDialog();
try
{
ofd.FileName = previous;
ofd.InitialDirectory = new FileInfo(previous).Directory.FullName;
}
catch (ArgumentException) { }
catch (PathTooLongException) { }
catch (NotSupportedException) { }
ofd.FileName = previous;
ofd.InitialDirectory = Util.GetFileDirectorySafe(previous);
if (ofd.ShowDialog(this) == DialogResult.OK)
{
return ofd.FileName;
Expand All @@ -101,5 +95,10 @@ private string openFile(string previous)
return previous;
}
}

private void DefaultsForm_Load(object sender, EventArgs e)
{
this.Icon = Properties.Resources.Icon;
}
}
}
50 changes: 50 additions & 0 deletions EDRoutePlanner/EDRoutePlanner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@
<AssemblyName>EDRoutePlanner</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ApplicationIcon>Resources\Icon.ico</ApplicationIcon>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -130,6 +146,7 @@
<DependentUpon>StationSelection.cs</DependentUpon>
</Compile>
<Compile Include="Transaction.cs" />
<Compile Include="Util.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\station.png" />
Expand All @@ -150,8 +167,41 @@
<None Include="Resources\flag.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Icon.svg" />
<None Include="Resources\pencil.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Icon.ico" />
<Content Include="Resources\IconsExport\Icon_128.png" />
<Content Include="Resources\IconsExport\Icon_16.png" />
<Content Include="Resources\IconsExport\Icon_24.png" />
<Content Include="Resources\IconsExport\Icon_256.png" />
<Content Include="Resources\IconsExport\Icon_32.png" />
<Content Include="Resources\IconsExport\Icon_512.png" />
<Content Include="Resources\IconsExport\Icon_64.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
11 changes: 11 additions & 0 deletions EDRoutePlanner/EDRoutePlanner.csproj.user
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory>
</InstallUrlHistory>
<SupportUrlHistory>
</SupportUrlHistory>
<UpdateUrlHistory>
</UpdateUrlHistory>
<BootstrapperUrlHistory>
</BootstrapperUrlHistory>
<FallbackCulture>de-DE</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
Loading

0 comments on commit 0f79f66

Please sign in to comment.