-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
185 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<Window x:Class="zstio_tv.ConfigWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:zstio_tv" | ||
mc:Ignorable="d" | ||
Title="ConfigWindow" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" Background="#FF101010" Loaded="WindowLoaded"> | ||
<Window.Resources> | ||
<Style TargetType="Button"> | ||
<Setter Property="Background" Value="Transparent"/> | ||
<Setter Property="BorderBrush" Value="Transparent"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="Button"> | ||
<Border Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}"> | ||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</Border> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
|
||
<!-- Fuck focusing, its a bug - rvyk --> | ||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | ||
</Style> | ||
</Window.Resources> | ||
<Grid> | ||
<StackPanel Orientation="Vertical"> | ||
<StackPanel Orientation="Horizontal" Margin="15,15,0,0" Height="30" VerticalAlignment="Top"> | ||
<Label Foreground="White" FontFamily="/Font/InterBold/#Inter" FontSize="15" Content="Ostrzezenie: " Height="30"/> | ||
<TextBox x:Name="input_warning" Width="650" Height="20" Background="#FF1B1B1B" BorderBrush="{x:Null}" Foreground="White" SelectionBrush="#FFA94646" MaxLength="125"/> | ||
</StackPanel> | ||
|
||
<CheckBox x:Name="checkbox_short" Content="Skrocone lekcje" Foreground="White" FontFamily="/Font/InterBold/#Inter" Height="16" Margin="20,5,0,0"/> | ||
</StackPanel> | ||
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,10,10"> | ||
<Button Cursor="Hand" Height="30" Width="120" Content="Minimalizuj" FontFamily="/Font/InterBold/#Inter" Opacity="0.5" Foreground="White" Background="#FF151515" BorderBrush="#FF5A4343" Click="Button_Click_1" Margin="10,0,0,0"/> | ||
<Button Cursor="Hand" Height="30" Width="90" Content="Zastosuj" FontFamily="/Font/InterBold/#Inter" Foreground="White" Background="#FF151515" BorderBrush="#FFA94646" Click="Button_Click" Margin="10,0,0,0"/> | ||
</StackPanel> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System.Runtime.InteropServices; | ||
using System; | ||
using System.Windows; | ||
using System.Windows.Interop; | ||
|
||
namespace zstio_tv | ||
{ | ||
internal class Win32 | ||
{ | ||
public const int GWL_STYLE = -16; | ||
public const int WS_SYSMENU = 0x80000; | ||
[DllImport("user32.dll", SetLastError = true)] | ||
public static extern int GetWindowLong(IntPtr hWnd, int nIndex); | ||
[DllImport("user32.dll")] | ||
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); | ||
} | ||
|
||
public partial class ConfigWindow : Window | ||
{ | ||
public ConfigWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public static string[] TempLessonTimes = { }, TempBreakTimes = { }; | ||
private void Button_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (input_warning.Text != null || input_warning.Text != "") | ||
Check failure on line 28 in zstio-tv/ConfigWindow.xaml.cs GitHub Actions / build
|
||
{ | ||
Config.Warning = input_warning.Text; | ||
MainWindow._Instance.handler_content_description_warning_label.Text = Config.Warning; | ||
Check failure on line 31 in zstio-tv/ConfigWindow.xaml.cs GitHub Actions / build
|
||
} | ||
|
||
// Reload the break times if its set on short lesson times | ||
if (checkbox_short.IsChecked == true) | ||
{ | ||
Config.LessonTimes = Config.ShortLessonTimes; | ||
Config.BreakTimes = Config.ShortBreakTimes; | ||
} else | ||
{ | ||
Config.LessonTimes = TempLessonTimes; | ||
Config.BreakTimes = TempBreakTimes; | ||
} | ||
|
||
ReloadReplacements(); | ||
} | ||
|
||
public static void ReloadReplacements() | ||
{ | ||
MainWindow.ReplacementsGETAPI_Tick(null, null); | ||
MainWindow.ReplacementsCALC_Tick(null, null); | ||
} | ||
|
||
private void WindowLoaded(object sender, RoutedEventArgs e) | ||
{ | ||
TempLessonTimes = Config.LessonTimes; | ||
TempBreakTimes = Config.BreakTimes; | ||
|
||
var hwnd = new WindowInteropHelper(this).Handle; | ||
Win32.SetWindowLong(hwnd, Win32.GWL_STYLE, Win32.GetWindowLong(hwnd, Win32.GWL_STYLE) & ~Win32.WS_SYSMENU); | ||
} | ||
|
||
private void Button_Click_1(object sender, RoutedEventArgs e) | ||
{ | ||
this.WindowState = WindowState.Minimized; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters