Skip to content

Commit

Permalink
Updated theme manager
Browse files Browse the repository at this point in the history
  • Loading branch information
dukus committed Sep 5, 2022
1 parent 47b6b88 commit 1d56d79
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
8 changes: 7 additions & 1 deletion CameraControl.Core/Classes/WindowsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ public void ApplyTheme()
var paletteHelper = new PaletteHelper();
ITheme theme = paletteHelper.GetTheme();
IBaseTheme baseTheme = ServiceProvider.Settings.CurrentThemeNameNew.StartsWith("Dark") ? new MaterialDesignDarkTheme() : (IBaseTheme)new MaterialDesignLightTheme();
theme.SetPrimaryColor((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(ServiceProvider.Settings.CurrentThemeNameNew.Split('\\')[1]));
theme.SetBaseTheme(baseTheme);
foreach (var item in new SwatchesProvider().Swatches)
{
if (item.Name == ServiceProvider.Settings.CurrentThemeNameNew.Split('\\')[1])
theme.SetPrimaryColor(item.PrimaryHues[item.PrimaryHues.Count / 2].Color);
}
// theme.SetPrimaryColor((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(ServiceProvider.Settings.CurrentThemeNameNew.Split('\\')[1]));


paletteHelper.SetTheme(theme);
}
Expand Down
6 changes: 3 additions & 3 deletions CameraControl/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Window x:Class="CameraControl.MainWindow"
<Controls:MetroWindow x:Class="CameraControl.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="digiCamControl" Height="799" Width="987" xmlns:my="clr-namespace:CameraControl"

ShowTitleBar="False"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
Expand Down Expand Up @@ -488,4 +488,4 @@
</materialDesign:Snackbar>

</Grid>
</Window >
</Controls:MetroWindow >
6 changes: 3 additions & 3 deletions CameraControl/windows/SettingsWnd.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="220*" />
<RowDefinition Height="41*" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="4">
<materialDesign:Card Margin="4" Background="{DynamicResource MaterialDesignBackground}">
<materialDesign:Card Margin="4" >
<StackPanel>
<Expander HorizontalAlignment="Stretch" IsExpanded="False" >
<Expander.Header>
Expand Down
1 change: 1 addition & 0 deletions CameraControl/windows/SettingsWnd.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private void button1_Click(object sender, RoutedEventArgs e)
{
ServiceProvider.Settings.EndEdit();
ServiceProvider.Settings.Save();
ServiceProvider.WindowsManager.ApplyTheme();
this.Close();
}

Expand Down
12 changes: 10 additions & 2 deletions CameraControl/windows/Welcome.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
Title="digiCamControl by Duka Istvan" Height="380" Width="460" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" Topmost="True" WindowStyle="SingleBorderWindow" ResizeMode="NoResize" >
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
Title="digiCamControl by Duka Istvan" Height="380" Width="460" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" Topmost="True" WindowStyle="SingleBorderWindow" ResizeMode="NoResize"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}"
>

<Grid>
<!--<StackPanel Orientation="Horizontal">
Expand Down
5 changes: 5 additions & 0 deletions Canon.Eos.Framework/Canon.Eos.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Threading\BackgroundWorker.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf">
<Version>1.1.39</Version>
</PackageReference>
</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

0 comments on commit 1d56d79

Please sign in to comment.