Skip to content

Commit

Permalink
Added checkbox for usage of flat symbol list
Browse files Browse the repository at this point in the history
- fix #18
- fixed jetbrains annotations
  • Loading branch information
fbarresi committed Mar 20, 2021
1 parent 828d9dc commit 852eb34
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 5 deletions.
7 changes: 7 additions & 0 deletions TwinCatAdsTool.Gui/Properties/Resources.Designer.cs

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

3 changes: 3 additions & 0 deletions TwinCatAdsTool.Gui/Properties/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,7 @@
<data name="PoweredBy" xml:space="preserve">
<value>Eine Software von</value>
</data>
<data name="UseFlatSymbolList" xml:space="preserve">
<value>Symbolliste in flat Format nutzen</value>
</data>
</root>
3 changes: 3 additions & 0 deletions TwinCatAdsTool.Gui/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,7 @@
<data name="ConnectionCabViewModel_ConnectClient_Dll_for_TwinCAT_Ads_not_found__Have_you_installed_the_drivers_" xml:space="preserve">
<value>Dll for TwinCAT.Ads not found. Have you installed the drivers?</value>
</data>
<data name="UseFlatSymbolList" xml:space="preserve">
<value>Use flat symbol list</value>
</data>
</root>
1 change: 1 addition & 0 deletions TwinCatAdsTool.Gui/TwinCatAdsTool.Gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageReference Include="DiffPlex" Version="1.4.4" />
<PackageReference Include="Extended.Wpf.Toolkit" Version="3.6.0" />
<PackageReference Include="FontAwesome.WPF" Version="4.7.0.9" />
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="MahApps.Metro" Version="2.2.0" />
<PackageReference Include="MaterialDesignExtensions" Version="3.2.0" />
<PackageReference Include="MaterialDesignThemes.MahApps" Version="0.1.4" />
Expand Down
15 changes: 14 additions & 1 deletion TwinCatAdsTool.Gui/ViewModels/BackupViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class BackupViewModel : ViewModelBase
private readonly Subject<JObject> variableSubject = new Subject<JObject>();
private string backupText;
private ObservableAsPropertyHelper<string> currentTaskHelper;
private bool useFlatSymbolList;

public BackupViewModel(IClientService clientService, IPersistentVariableService persistentVariableService)
{
Expand All @@ -44,6 +45,17 @@ public string BackupText
public ReactiveCommand<Unit, Unit> Read { get; set; }
public ReactiveCommand<Unit, Unit> Save { get; set; }

public bool UseFlatSymbolList
{
get => useFlatSymbolList;
set
{
if (value == useFlatSymbolList) return;
useFlatSymbolList = value;
raisePropertyChanged();
}
}

public override void Init()
{
variableSubject
Expand All @@ -67,7 +79,8 @@ public override void Init()

private async Task<Unit> ReadVariables()
{
var persistentVariables = await persistentVariableService.ReadPersistentVariables(clientService.Client, clientService.TreeViewSymbols);
var persistentVariables = await persistentVariableService.ReadPersistentVariables(clientService.Client,
UseFlatSymbolList ? clientService.FlatViewSymbols : clientService.TreeViewSymbols);
variableSubject.OnNext(persistentVariables);
Logger.Debug(Resources.ReadPersistentVariables);

Expand Down
2 changes: 1 addition & 1 deletion TwinCatAdsTool.Gui/ViewModels/ViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Reactive.Disposables;
using System.Runtime.CompilerServices;
using DynamicData.Annotations;
using JetBrains.Annotations;
using log4net;
using ReactiveUI;
using TwinCatAdsTool.Interfaces.Commons;
Expand Down
2 changes: 2 additions & 0 deletions TwinCatAdsTool.Gui/Views/BackupView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
>
</Button>

<CheckBox IsChecked="{Binding UseFlatSymbolList, UpdateSourceTrigger=PropertyChanged}" Margin="16" Content="{x:Static properties:Resources.UseFlatSymbolList}"/>
<Label Margin="24,16,0,16" Content="{Binding CurrentTask}"/>


</StackPanel>

Expand Down
7 changes: 4 additions & 3 deletions TwinCatAdsTool.Gui/Views/ExploreView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,12 @@
<StackPanel Orientation="Horizontal">
<Button Command="{Binding Path=DataContext.CmdDelete, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}"
CommandParameter="{Binding}"
Style="{StaticResource MaterialDesignIconForegroundButton}"
>
Style="{StaticResource MaterialDesignIconForegroundButton}">
<materialDesign:PackIcon Kind="MinusCircleOutline" Foreground="Red"/>
</Button>
<Label Content="{Binding Name}" ToolTip="{Binding FullName}" VerticalContentAlignment="Center"/>
<Label Content="{Binding Name}"
ToolTip="{Binding FullName}"
VerticalContentAlignment="Center"/>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
Expand Down

0 comments on commit 852eb34

Please sign in to comment.