Commit bb83a482 authored by c0pperdragon's avatar c0pperdragon

EV3Explorer: Can filter files to see only basic programs in PC view

parent 3a658c84
...@@ -12,6 +12,7 @@ namespace EV3Explorer ...@@ -12,6 +12,7 @@ namespace EV3Explorer
public int windowHeight; public int windowHeight;
public int splitterPosition; public int splitterPosition;
public String localDirectory; public String localDirectory;
public Boolean onlyShowPrograms;
public ExplorerSettings() public ExplorerSettings()
{ {
...@@ -19,6 +20,7 @@ namespace EV3Explorer ...@@ -19,6 +20,7 @@ namespace EV3Explorer
windowHeight = 600; windowHeight = 600;
splitterPosition = 400; splitterPosition = 400;
localDirectory = ""; localDirectory = "";
onlyShowPrograms = false;
} }
public void Load() public void Load()
...@@ -49,6 +51,10 @@ namespace EV3Explorer ...@@ -49,6 +51,10 @@ namespace EV3Explorer
{ {
localDirectory = line.Substring(9).Trim(); localDirectory = line.Substring(9).Trim();
} }
if (line.StartsWith("ONLYSHOWPROGRAMS", StringComparison.InvariantCultureIgnoreCase))
{
onlyShowPrograms = true;
}
} }
catch (Exception) { } catch (Exception) { }
} }
...@@ -72,6 +78,10 @@ namespace EV3Explorer ...@@ -72,6 +78,10 @@ namespace EV3Explorer
file.WriteLine("HEIGHT=" + windowHeight); file.WriteLine("HEIGHT=" + windowHeight);
file.WriteLine("SPLITTER=" + splitterPosition); file.WriteLine("SPLITTER=" + splitterPosition);
file.WriteLine("LOCALDIR=" + localDirectory); file.WriteLine("LOCALDIR=" + localDirectory);
if (onlyShowPrograms)
{
file.WriteLine("ONLYSHOWPROGRAMS");
}
file.Close(); file.Close();
} }
catch (Exception) { } catch (Exception) { }
......
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
<Button x:Name="Download" Content="Download" Click="Download_clicked" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,10,10" Grid.Row="3" VerticalAlignment="Bottom" Width="75" Height="30"/> <Button x:Name="Download" Content="Download" Click="Download_clicked" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,10,10" Grid.Row="3" VerticalAlignment="Bottom" Width="75" Height="30"/>
<Button x:Name="CompileAndRun" Content="Compile and Run" Click="CompileAndRun_clicked" Grid.Column="1" Margin="0,0,170,10" Grid.Row="3" VerticalAlignment="Bottom" Width="101" Height="30" HorizontalAlignment="Right"/> <Button x:Name="CompileAndRun" Content="Compile and Run" Click="CompileAndRun_clicked" Grid.Column="1" Margin="0,0,170,10" Grid.Row="3" VerticalAlignment="Bottom" Width="101" Height="30" HorizontalAlignment="Right"/>
<Button x:Name="Compile" Content="Compile" Click="Compile_clicked" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,90,10" Grid.Row="3" VerticalAlignment="Bottom" Width="75" Height="30"/> <Button x:Name="Compile" Content="Compile" Click="Compile_clicked" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,90,10" Grid.Row="3" VerticalAlignment="Bottom" Width="75" Height="30"/>
<CheckBox x:Name="OnlyShowPrograms" Content="CheckBox" Click="OnlyShowPrograms_clicked" Grid.Column="1" HorizontalAlignment="Right" Height="15" Margin="0,10,10,0" VerticalAlignment="Top" Width="15"/>
<Label Content="Only show programs" Grid.Column="1" HorizontalAlignment="Right" Height="38" Margin="0,4,23,26" Width="137" RenderTransformOrigin="0.871,0.526" VerticalAlignment="Center" Grid.RowSpan="2"/>
</Grid> </Grid>
</Window> </Window>
...@@ -97,6 +97,7 @@ namespace EV3Explorer ...@@ -97,6 +97,7 @@ namespace EV3Explorer
this.Width = settings.windowWidth; this.Width = settings.windowWidth;
this.Height = settings.windowHeight; this.Height = settings.windowHeight;
this.leftColumn.Width = new GridLength((double)settings.splitterPosition, GridUnitType.Pixel); this.leftColumn.Width = new GridLength((double)settings.splitterPosition, GridUnitType.Pixel);
this.OnlyShowPrograms.IsChecked = settings.onlyShowPrograms;
// retrieve initial data from brick // retrieve initial data from brick
EV3Path.Text = ev3path; EV3Path.Text = ev3path;
...@@ -147,7 +148,8 @@ namespace EV3Explorer ...@@ -147,7 +148,8 @@ namespace EV3Explorer
settings.windowWidth = (int) Width; settings.windowWidth = (int) Width;
settings.windowHeight = (int) Height; settings.windowHeight = (int) Height;
settings.splitterPosition = Convert.ToInt32(leftColumn.Width.Value); settings.splitterPosition = Convert.ToInt32(leftColumn.Width.Value);
settings.localDirectory = pcdirectory == null ? "Computer" : pcdirectory.FullName; settings.localDirectory = pcdirectory == null ? "Computer" : pcdirectory.FullName;
settings.onlyShowPrograms = (bool) OnlyShowPrograms.IsChecked;
settings.Save(); settings.Save();
} }
...@@ -490,6 +492,10 @@ namespace EV3Explorer ...@@ -490,6 +492,10 @@ namespace EV3Explorer
CompileAndDownload(true); CompileAndDownload(true);
} }
private void OnlyShowPrograms_clicked(Object sneder, EventArgs e)
{
RefreshPCList(true);
}
private void CompileAndDownload(bool run) private void CompileAndDownload(bool run)
...@@ -624,7 +630,12 @@ namespace EV3Explorer ...@@ -624,7 +630,12 @@ namespace EV3Explorer
{ {
if (info is FileInfo) if (info is FileInfo)
{ {
PCDirectory.Items.Add(new PCFile((FileInfo)info)); PCFile pcf = new PCFile((FileInfo)info);
if (pcf.IsCompileable || !((bool)OnlyShowPrograms.IsChecked))
{
PCDirectory.Items.Add(pcf);
}
} }
else if (info is DirectoryInfo) else if (info is DirectoryInfo)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment