added OSX Style controls

This commit is contained in:
WeeXnes 2022-06-20 21:10:12 +02:00
parent bbbd1e005f
commit 7a9bc79b34
10 changed files with 94 additions and 7 deletions

View file

@ -21,7 +21,8 @@ namespace WeeXnes.Core
public static string apiUrl = "http://www.weexnes.com:5169/";
public static UpdateVar<bool> settings_alwaysOnTop = new UpdateVar<bool>();
public static UpdateVar<bool> settings_osxStyleControlls = new UpdateVar<bool>();
public static UpdateVar<bool> settings_copySelectedToClipboard = new UpdateVar<bool>();
public static string settings_KeyManagerItemsPath_Default = AppDataPath + "\\" + "Keys";
@ -74,7 +75,7 @@ namespace WeeXnes.Core
Globals.settings_KeyManagerItemsPath.Value = Globals.settings_KeyManagerItemsPath_Default;
}
Globals.settings_osxStyleControlls.Value = Convert.ToBoolean(SettingsFile.GetValue("general", "OSXStyle"));
Globals.settings_RpcShowElapsedTime.Value = Convert.ToBoolean(SettingsFile.GetValue("rpc", "RpcShowElapsedTime"));
Globals.settings_RpcItemsPath_Bool.Value = Convert.ToBoolean(SettingsFile.GetValue("rpc", "RpcItemsPath_Bool"));
@ -134,7 +135,10 @@ namespace WeeXnes.Core
SettingsFile.SetValue("KeyManager", "CensorKeys", "false");
}
};
Globals.settings_osxStyleControlls.ValueChanged += () =>
{
SettingsFile.SetValue("general", "OSXStyle", Globals.settings_osxStyleControlls.Value.ToString());
};
Globals.settings_RpcItemsPath_Bool.ValueChanged += () =>
{

BIN
WeeXnes/Images/green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
WeeXnes/Images/red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
WeeXnes/Images/yellow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

@ -43,6 +43,22 @@
VerticalAlignment="Center"
FontSize="15"
Foreground="White"/>
</CheckBox>
<CheckBox VerticalAlignment="Top"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Name="OSXSwitch"
Checked="OSXSwitch_OnChecked"
Unchecked="OSXSwitch_OnUnchecked"
Margin="10,10,0,0">
<TextBlock
Text="Enable OSX Style (Restart Required)"
VerticalAlignment="Center"
FontSize="15"
Foreground="White"/>
</CheckBox>

View file

@ -64,6 +64,10 @@ namespace WeeXnes.MVVM.View
{
AlwaysOnTopSwitch.IsChecked = true;
}
if (Globals.settings_osxStyleControlls.Value)
{
OSXSwitch.IsChecked = true;
}
if (Globals.settings_RpcAutoStart.Value)
{
@ -326,5 +330,15 @@ namespace WeeXnes.MVVM.View
{
Globals.settings_KeyManagerCensorKeys.Value = false;
}
private void OSXSwitch_OnChecked(object sender, RoutedEventArgs e)
{
Globals.settings_osxStyleControlls.Value = true;
}
private void OSXSwitch_OnUnchecked(object sender, RoutedEventArgs e)
{
Globals.settings_osxStyleControlls.Value = false;
}
}
}

View file

@ -18,7 +18,11 @@
Deactivated="Window_Deactivated"
StateChanged="Window_StateChanged"
Closing="Window_Closing">
<Window.Resources>
<Style TargetType="Image">
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality" />
</Style>
</Window.Resources>
<Window.DataContext>
<viewModel:MainViewModel/>
</Window.DataContext>
@ -122,7 +126,9 @@
VerticalAlignment="Top"
Margin="0,0,50,0"
Style="{StaticResource ModernMinimizeButton}"
Grid.Column="1"/>
Grid.Column="1"
IsEnabled="False"
Visibility="Hidden"/>
<Button Width="50"
Height="23"
Name="CloseBtn"
@ -132,7 +138,31 @@
HorizontalAlignment="Right"
VerticalAlignment="Top"
Style="{StaticResource ModernCloseButton}"
Grid.Column="1"/>
Grid.Column="1"
Visibility="Hidden"/>
<DockPanel Grid.Column="1" Margin="0,5,5,5"
Height="23"
VerticalAlignment="Top"
HorizontalAlignment="Right" Visibility="Hidden" Name="OSXControlls">
<Button Name="MinimizeButton" Width="20" BorderThickness="0" Background="Transparent"
Style="{StaticResource OSXButtonStyle}" Click="MinimizeBtn_Click">
<StackPanel>
<Image Source="Images\green.png" Margin="1"/>
</StackPanel>
</Button>
<Button Name="MaximizeButton" Width="20" BorderThickness="0" Background="Transparent"
Style="{StaticResource OSXButtonStyle}">
<StackPanel>
<Image Source="Images\yellow.png" Margin="1"/>
</StackPanel>
</Button>
<Button Name="CloseButton" Width="20" BorderThickness="0" Background="Transparent"
Style="{StaticResource OSXButtonStyle}" Click="CloseBtn_Click">
<StackPanel>
<Image Source="Images\red.png" Margin="1"/>
</StackPanel>
</Button>
</DockPanel>
<ContentControl Grid.Row="1"
Grid.Column="1"

View file

@ -101,7 +101,15 @@ namespace WeeXnes
{
//SettingView.CheckSetting();
SettingsManager.start();
if (Globals.settings_osxStyleControlls.Value)
{
OSXControlls.Visibility = Visibility.Visible;
}
else
{
MinimizeBtn.Visibility = Visibility.Visible;
CloseBtn.Visibility = Visibility.Visible;
}
}
private void Border_MouseDown(object sender, MouseButtonEventArgs e)

View file

@ -76,4 +76,16 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="OSXButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View file

@ -128,6 +128,9 @@
</ItemGroup>
<ItemGroup>
<Content Include="Fonts\Poppins-Regular.ttf" />
<Resource Include="Images\green.png" />
<Resource Include="Images\red.png" />
<Resource Include="Images\yellow.png" />
<Content Include="wicns.ico" />
<Resource Include="Images\wicon.png" />
</ItemGroup>