No funciona bien
This commit is contained in:
parent
ec2c0a9969
commit
ee293ba470
13
App.xaml
13
App.xaml
|
@ -1,7 +1,12 @@
|
|||
<Application x:Class="DirectoryCreator.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DirectoryCreator"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application x:Class="DirectoryCreator.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Themes/LightTheme.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -14,8 +14,9 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Resource Include="Assets\app.png" />
|
||||
<None Remove="Themes\**" />
|
||||
<Resource Include="Themes\**" />
|
||||
<Resource Include="Themes\*.xaml" />
|
||||
<None Remove="Themes\**" />
|
||||
<Resource Include="Themes\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodels="clr-namespace:DirectoryCreator.ViewModels" mc:Ignorable="d" Title="Crear Directorios Base"
|
||||
Height="550" Width="800" WindowStartupLocation="CenterScreen" MinWidth="600" MinHeight="400">
|
||||
Height="550" Width="800" WindowStartupLocation="CenterScreen" MinWidth="600" MinHeight="400"
|
||||
Background="{DynamicResource WindowBackground}" Foreground="{DynamicResource WindowForeground}">
|
||||
|
||||
<Window.Icon>
|
||||
<BitmapImage UriSource="/Assets/app.png" />
|
||||
</Window.Icon>
|
||||
|
||||
<Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Margin="0">
|
||||
<Grid Margin="25">
|
||||
<Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Margin="0" Background="{DynamicResource WindowBackground}">
|
||||
<Grid Margin="25" Background="{DynamicResource WindowBackground}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
|
@ -26,7 +27,7 @@
|
|||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Configuration Section -->
|
||||
<Border Grid.Row="0" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<Border Grid.Row="0" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource WindowBackground}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<DockPanel>
|
||||
<TextBlock Text="Configuración:" VerticalAlignment="Center" MinWidth="120" FontWeight="SemiBold" />
|
||||
<Button Content="Editar" Command="{Binding EditConfigurationsCommand}" DockPanel.Dock="Right"
|
||||
|
@ -38,7 +39,7 @@
|
|||
</Border>
|
||||
|
||||
<!-- Project Management Section -->
|
||||
<Border Grid.Row="2" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<Border Grid.Row="2" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource WindowBackground}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<DockPanel>
|
||||
<TextBlock Text="Proyecto Actual:" VerticalAlignment="Center" MinWidth="120" FontWeight="SemiBold" />
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Margin="15,0,0,0">
|
||||
|
@ -53,7 +54,7 @@
|
|||
</Border>
|
||||
|
||||
<!-- Project Info Section -->
|
||||
<Border Grid.Row="4" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<Border Grid.Row="4" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource WindowBackground}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<StackPanel>
|
||||
<DockPanel Margin="0,0,0,15">
|
||||
<TextBlock Text="Último Proyecto:" MinWidth="120" FontWeight="SemiBold" />
|
||||
|
@ -69,7 +70,7 @@
|
|||
</Border>
|
||||
|
||||
<!-- New Project Section -->
|
||||
<Border Grid.Row="6" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<Border Grid.Row="6" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource WindowBackground}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<DockPanel>
|
||||
<TextBlock Text="Nuevo Proyecto:" VerticalAlignment="Center" MinWidth="120" FontWeight="SemiBold" />
|
||||
<TextBox Text="{Binding NewProjectName, UpdateSourceTrigger=PropertyChanged}" Height="35"
|
||||
|
@ -78,7 +79,7 @@
|
|||
</Border>
|
||||
|
||||
<!-- Actions Section -->
|
||||
<Border Grid.Row="8" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<Border Grid.Row="8" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource WindowBackground}" BorderThickness="1" Padding="20" CornerRadius="4">
|
||||
<DockPanel>
|
||||
<CheckBox Content="Tema Oscuro" IsChecked="{Binding IsDarkTheme}" VerticalAlignment="Center" />
|
||||
<Button Content="Crear Directorios" Command="{Binding CreateDirectoriesCommand}"
|
||||
|
|
|
@ -4,33 +4,37 @@ namespace DirectoryCreator
|
|||
{
|
||||
public static class ThemeManager
|
||||
{
|
||||
private static readonly Uri DarkThemeUri = new Uri("/Themes/DarkTheme.xaml", UriKind.Relative);
|
||||
private static readonly Uri LightThemeUri = new Uri("/Themes/LightTheme.xaml", UriKind.Relative);
|
||||
|
||||
public static void SetTheme(bool isDarkTheme)
|
||||
{
|
||||
var app = Application.Current;
|
||||
if (app == null) return;
|
||||
|
||||
var mergedDicts = app.Resources.MergedDictionaries;
|
||||
|
||||
// Ruta al tema oscuro
|
||||
var darkThemeUri = new Uri("Themes/DarkTheme.xaml", UriKind.Relative);
|
||||
|
||||
// Primero, removemos el tema oscuro si existe
|
||||
for (int i = mergedDicts.Count - 1; i >= 0; i--)
|
||||
// Buscar y eliminar los temas existentes
|
||||
ResourceDictionary themeToRemove = null;
|
||||
foreach (ResourceDictionary dict in mergedDicts)
|
||||
{
|
||||
var currentDict = mergedDicts[i];
|
||||
if (currentDict.Source != null && currentDict.Source.Equals(darkThemeUri))
|
||||
if (dict.Source != null && (dict.Source.OriginalString.Contains("LightTheme") || dict.Source.OriginalString.Contains("DarkTheme")))
|
||||
{
|
||||
mergedDicts.RemoveAt(i);
|
||||
themeToRemove = dict;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Si se solicita el tema oscuro, lo agregamos
|
||||
if (isDarkTheme)
|
||||
if (themeToRemove != null)
|
||||
{
|
||||
var darkTheme = new ResourceDictionary
|
||||
{
|
||||
Source = darkThemeUri
|
||||
};
|
||||
mergedDicts.Add(darkTheme);
|
||||
mergedDicts.Remove(themeToRemove);
|
||||
}
|
||||
|
||||
// Agregar el nuevo tema
|
||||
mergedDicts.Add(new ResourceDictionary
|
||||
{
|
||||
Source = isDarkTheme ? DarkThemeUri : LightThemeUri
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -97,6 +97,13 @@
|
|||
<Setter Property="Background" Value="{StaticResource PrimaryBackground}" />
|
||||
<Setter Property="Foreground" Value="{StaticResource WindowForeground}" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
|
||||
<Style.Resources>
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="#2D2D2D"/>
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#404040"/>
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="White"/>
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="White"/>
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.WindowTextBrushKey}" Color="White"/>
|
||||
</Style.Resources>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
|
@ -147,7 +154,17 @@
|
|||
<Style TargetType="ComboBoxItem">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{StaticResource WindowForeground}" />
|
||||
<Setter Property="Padding" Value="5,2" />
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Padding" Value="8,4" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{StaticResource ButtonBackground}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="{StaticResource ButtonBackgroundHover}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBoxItem">
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Base Colors -->
|
||||
<SolidColorBrush x:Key="WindowBackground" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="WindowForeground" Color="#000000"/>
|
||||
<SolidColorBrush x:Key="PrimaryBackground" Color="#F5F5F5"/>
|
||||
<SolidColorBrush x:Key="SecondaryBackground" Color="#EEEEEE"/>
|
||||
<SolidColorBrush x:Key="BorderBrush" Color="#DDDDDD"/>
|
||||
<SolidColorBrush x:Key="ButtonBackground" Color="#E0E0E0"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundHover" Color="#D0D0D0"/>
|
||||
<SolidColorBrush x:Key="TextBoxBackground" Color="#FFFFFF"/>
|
||||
|
||||
<!-- ScrollBar Colors -->
|
||||
<SolidColorBrush x:Key="ScrollBarBackground" Color="#F5F5F5"/>
|
||||
<SolidColorBrush x:Key="ScrollBarBorder" Color="#E0E0E0"/>
|
||||
<SolidColorBrush x:Key="ScrollBarThumb" Color="#CCCCCC"/>
|
||||
<SolidColorBrush x:Key="ScrollBarThumbHover" Color="#BBBBBB"/>
|
||||
<SolidColorBrush x:Key="ScrollBarThumbPressed" Color="#AAAAAA"/>
|
||||
|
||||
<!-- Base Control Styles -->
|
||||
<Style TargetType="Window">
|
||||
<Setter Property="Background" Value="{StaticResource WindowBackground}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Grid">
|
||||
<Setter Property="Background" Value="{StaticResource WindowBackground}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Background" Value="{StaticResource WindowBackground}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="{StaticResource ButtonBackground}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="Background" Value="{StaticResource TextBoxBackground}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="ComboBox">
|
||||
<Setter Property="Background" Value="{StaticResource PrimaryBackground}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="ComboBoxItem">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="CheckBox">
|
||||
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
|
||||
<Setter Property="Background" Value="{StaticResource PrimaryBackground}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
Loading…
Reference in New Issue