aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-27 16:49:42 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-27 16:49:42 +0200
commit2ab54573d10ca59351100ab8416178be2223fc91 (patch)
tree9a5077998e301c1e86cf00b07ea98eca501fc4a8 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
parent88a73106e8113a4a6ce224f9205e11219939798e (diff)
downloadTango-2ab54573d10ca59351100ab8416178be2223fc91.tar.gz
Tango-2ab54573d10ca59351100ab8416178be2223fc91.zip
Added support for caching on machine studio.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs20
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml7
2 files changed, 27 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
index d4598867c..2e2b1a014 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
@@ -84,6 +84,26 @@ namespace Tango.MachineStudio.UI
exceptionTrapper = new WpfGlobalExceptionTrapper();
exceptionTrapper.Initialize(this);
exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed;
+
+ //Apply Caching
+ if (settings.CachingMode != ObservablesContextInMemoryCachingMode.None)
+ {
+ LogManager.Log("EF Caching is enabled.");
+ LogManager.Log($"EF Caching mode is: {settings.CachingMode}.");
+ LogManager.Log($"EF Caching timeout: {settings.MaximumCacheTime.ToString()}");
+ try
+ {
+ ObservablesContext.EnableInMemoryCache(settings.MaximumCacheTime, settings.CachingMode);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error while trying to activate EF caching.");
+ }
+ }
+ else
+ {
+ LogManager.Log("EF Caching is disabled");
+ }
}
#region Global Exception Trapping
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
index 640c3c1df..54a8349e6 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
@@ -6,6 +6,7 @@
xmlns:vm="clr-namespace:Tango.MachineStudio.UI.ViewModels"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:bl="clr-namespace:Tango.BL;assembly=Tango.BL"
xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="700" Background="White" d:DataContext="{d:DesignInstance Type=vm:AboutViewVM, IsDesignTimeCreatable=False}" DataContext="{Binding AboutViewVM, Source={StaticResource Locator}}">
@@ -13,6 +14,7 @@
<UserControl.Resources>
<converters:VersionToShortVersionConverter x:Key="VersionToShortVersionConverter" />
<converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
+ <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
</UserControl.Resources>
<Grid>
@@ -60,6 +62,11 @@
<TextBlock><Run Text="{Binding DataSource.Address,Mode=OneWay}"></Run>
<Run>(</Run><Run Foreground="Gray" Text="{Binding DataSource.Catalog,Mode=OneWay}"></Run><Run>)</Run>
</TextBlock>
+ <TextBlock FontWeight="SemiBold">Caching Mode:</TextBlock>
+ <DockPanel>
+ <ComboBox Width="150" DockPanel.Dock="Left" ItemsSource="{Binding Source={x:Type bl:ObservablesContextInMemoryCachingMode},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.CachingMode}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+ <TextBlock Margin="20 0 0 0" Foreground="Gray" VerticalAlignment="Center">(Requires restart)</TextBlock>
+ </DockPanel>
</controls:TableGrid>
<DockPanel Margin="0 0 0 0">