Skip to content

Commit

Permalink
Merge pull request #103 from FrozenAssassine/fixfor#101
Browse files Browse the repository at this point in the history
Fix: colors in quick access are now matching the dialog color
  • Loading branch information
FrozenAssassine authored May 10, 2023
2 parents d6d5488 + 80876f1 commit f7c516f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Fastedit/Controls/RunCommandWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl
<UserControl
x:Class="Fastedit.Controls.RunCommandWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand All @@ -25,16 +25,16 @@
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>

<TextBlock VerticalAlignment="Bottom" Grid.Column="0" Text="{x:Bind Command}" x:Phase="1"/>
<Grid Visibility="{Binding Path=Shortcut, Mode=OneWay, Converter={StaticResource StringToVisibilityConverter}}" VerticalAlignment="Bottom" Grid.Column="1" BorderBrush="#555555" BorderThickness="1" CornerRadius="4">
<TextBlock Padding="2" Text="{x:Bind Shortcut}" x:Phase="1" />
<TextBlock Foreground="{x:Bind TextColor}" VerticalAlignment="Bottom" Grid.Column="0" Text="{x:Bind Command}" x:Phase="1"/>
<Grid VerticalAlignment="Bottom" Grid.Column="1" BorderBrush="#555555" BorderThickness="1" CornerRadius="4">
<TextBlock Foreground="{x:Bind TextColor}" Padding="2" Text="{x:Bind Shortcut}" x:Phase="1" />
</Grid>
</Grid>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>

<Grid Background="#ef222222"
<Grid
BorderThickness="2" HorizontalAlignment="Stretch"
CornerRadius="10"
x:Name="grid"
Expand Down
21 changes: 19 additions & 2 deletions Fastedit/Controls/RunCommandWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Fastedit.Tab;
using Fastedit.Dialogs;
using Fastedit.Tab;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Collections.Generic;
Expand All @@ -8,6 +9,7 @@
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;

namespace Fastedit.Controls
{
Expand All @@ -20,12 +22,22 @@ public sealed partial class RunCommandWindow : UserControl
{
List<RunCommandWindowCustomItem> CurrentTabPages = new List<RunCommandWindowCustomItem>();
RunCommandWindowSubItem currentPage = null;

public RunCommandWindow()
{
this.InitializeComponent();
}

public void UpdateColors()
{
grid.Background = DialogHelper.ContentDialogBackground();
var textcolor = DialogHelper.ContentDialogForeground();
foreach (var item in Items)
{
item.TextColor = textcolor;
}
grid.RequestedTheme = DialogHelper.DialogDesign;
}

public void Toggle(TabView tabView)
{
if (this.Visibility == Visibility.Visible)
Expand All @@ -43,6 +55,7 @@ public void Show(TabView tabView)
{
itemHostListView = FindName("itemHostListView") as ListView;
}
UpdateColors();

searchbox.Text = "";
this.Visibility = Visibility.Visible;
Expand Down Expand Up @@ -189,6 +202,7 @@ public void InvokeEvent()
public object Tag { get; set; }
public string Command { get; set; }
public string Shortcut { get; set; }
public Brush TextColor { get; set; }
}

public class RunCommandWindowSubItem : IRunCommandWindowItem
Expand All @@ -197,19 +211,22 @@ public class RunCommandWindowSubItem : IRunCommandWindowItem
public string Command { get; set; }
public string Shortcut { get; set; }
public object Tag { get; set; }
public Brush TextColor { get; set; }
}

public class RunCommandWindowCustomItem : IRunCommandWindowItem
{
public string Command { get; set; }
public string Shortcut { get; set; }
public object Tag { get; set; }
public Brush TextColor { get; set; }
}

public interface IRunCommandWindowItem
{
string Command { get; set; }
string Shortcut { get; set; }
object Tag { get; set; }
Brush TextColor { get; set; }
}
}
3 changes: 2 additions & 1 deletion Fastedit/Settings/SettingsUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ private static void SetSettingsToStatusbar(Grid statusbar, FasteditDesign design
item.Foreground = foreground;
}
}

}
private static void SetMenubarAlignment(Microsoft.UI.Xaml.Controls.MenuBar menubar)
{
Expand Down Expand Up @@ -164,6 +163,8 @@ public static async void UpdateSettings(MainPage mainPage, TabView tabView, Micr
//Statusbar
SetSettingsToStatusbar(statusbar, currentDesign);

mainPage.RunCommandWindow.UpdateColors();

//TabWindows (tabs as own windows):
TabWindowHelper.UpdateSettings();
}
Expand Down
1 change: 1 addition & 0 deletions Fastedit/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public sealed partial class MainPage : Page
ProgressWindowItem progressWindow;
public VerticalTabsFlyoutControl verticalTabsFlyout = null;
public TabView tabView => tabControl;
public RunCommandWindow RunCommandWindow => runCommandWindow;

public MainPage()
{
Expand Down

0 comments on commit f7c516f

Please sign in to comment.