Skip to content

Commit 8f00f1f

Browse files
authored
启动图相关,UI相关
1 parent 616e22f commit 8f00f1f

38 files changed

+10275
-9715
lines changed

AdjustVideoWindow.xaml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
<Window x:Class="ShowWrite.AdjustVideoWindow"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Title="画面调节" Height="409" Width="364"
5-
WindowStartupLocation="CenterOwner">
6-
<StackPanel Margin="15,0,15,0" VerticalAlignment="Center" Height="332">
7-
<TextBlock Text="亮度" Foreground="Black" Margin="0,5"/>
8-
<Slider x:Name="BrightnessSlider" Minimum="-100" Maximum="100" TickFrequency="1" ValueChanged="BrightnessSlider_ValueChanged"/>
9-
10-
<TextBlock Text="对比度" Foreground="Black" Margin="0,10,0,5"/>
11-
<Slider x:Name="ContrastSlider" Minimum="0.1" Maximum="3" TickFrequency="0.1" ValueChanged="ContrastSlider_ValueChanged"/>
12-
<TextBlock Text="旋转方向:" FontWeight="Bold" Margin="0,0,0,10"/>
13-
<ComboBox x:Name="RotationBox" Width="150">
14-
<ComboBoxItem Content="" Tag="0"/>
15-
<ComboBoxItem Content="90°" Tag="90"/>
16-
<ComboBoxItem Content="180°" Tag="180"/>
17-
<ComboBoxItem Content="270°" Tag="270"/>
18-
</ComboBox>
19-
20-
<CheckBox x:Name="MirrorHCheck" Content="水平镜像" Margin="0,15,0,5"/>
21-
<CheckBox x:Name="MirrorVCheck" Content="垂直镜像" Margin="0,0,0,15"/>
22-
23-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Height="60">
24-
<Button Content="确定" Width="80" Margin="10" Click="Ok_Click"/>
25-
<Button Content="取消" Width="80" Margin="10" IsCancel="True"/>
26-
</StackPanel>
27-
</StackPanel>
28-
</Window>
1+
<Window x:Class="ShowWrite.AdjustVideoWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
Title="画面调节" Height="409" Width="364"
5+
WindowStartupLocation="CenterOwner">
6+
<StackPanel Margin="15,0,15,0" VerticalAlignment="Center" Height="332">
7+
<TextBlock Text="亮度" Foreground="Black" Margin="0,5"/>
8+
<Slider x:Name="BrightnessSlider" Minimum="-100" Maximum="100" TickFrequency="1" ValueChanged="BrightnessSlider_ValueChanged"/>
9+
10+
<TextBlock Text="对比度" Foreground="Black" Margin="0,10,0,5"/>
11+
<Slider x:Name="ContrastSlider" Minimum="0.1" Maximum="3" TickFrequency="0.1" ValueChanged="ContrastSlider_ValueChanged"/>
12+
<TextBlock Text="旋转方向:" FontWeight="Bold" Margin="0,0,0,10"/>
13+
<ComboBox x:Name="RotationBox" Width="150">
14+
<ComboBoxItem Content="" Tag="0"/>
15+
<ComboBoxItem Content="90°" Tag="90"/>
16+
<ComboBoxItem Content="180°" Tag="180"/>
17+
<ComboBoxItem Content="270°" Tag="270"/>
18+
</ComboBox>
19+
20+
<CheckBox x:Name="MirrorHCheck" Content="水平镜像" Margin="0,15,0,5"/>
21+
<CheckBox x:Name="MirrorVCheck" Content="垂直镜像" Margin="0,0,0,15"/>
22+
23+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Height="60">
24+
<Button Content="确定" Width="80" Margin="10" Click="Ok_Click"/>
25+
<Button Content="取消" Width="80" Margin="10" IsCancel="True"/>
26+
</StackPanel>
27+
</StackPanel>
28+
</Window>

AdjustVideoWindow.xaml.cs

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
using System.Windows;
2-
using System.Windows.Controls;
3-
4-
namespace ShowWrite
5-
{
6-
public partial class AdjustVideoWindow : Window
7-
{
8-
public double Brightness { get; private set; }
9-
public double Contrast { get; private set; }
10-
public int Rotation { get; private set; }
11-
public bool MirrorH { get; private set; }
12-
public bool MirrorV { get; private set; }
13-
14-
public AdjustVideoWindow(double brightness, double contrast, int rotation, bool mirrorH, bool mirrorV)
15-
{
16-
InitializeComponent();
17-
18-
// 初始化滑块值
19-
BrightnessSlider.Value = brightness;
20-
ContrastSlider.Value = contrast;
21-
Brightness = brightness;
22-
Contrast = contrast;
23-
24-
RotationBox.SelectedIndex = rotation / 90;
25-
MirrorHCheck.IsChecked = mirrorH;
26-
MirrorVCheck.IsChecked = mirrorV;
27-
}
28-
29-
// 添加缺失的事件处理方法 - 这是关键修复
30-
private void BrightnessSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
31-
{
32-
Brightness = e.NewValue;
33-
}
34-
35-
private void ContrastSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
36-
{
37-
Contrast = e.NewValue;
38-
}
39-
40-
private void Ok_Click(object sender, RoutedEventArgs e)
41-
{
42-
if (RotationBox.SelectedItem is ComboBoxItem item && item.Tag != null)
43-
{
44-
#pragma warning disable CS8604 // 引用类型参数可能为 null。
45-
Rotation = int.Parse(item.Tag.ToString());
46-
#pragma warning restore CS8604 // 引用类型参数可能为 null。
47-
}
48-
MirrorH = MirrorHCheck.IsChecked == true;
49-
MirrorV = MirrorVCheck.IsChecked == true;
50-
51-
DialogResult = true;
52-
Close();
53-
}
54-
}
1+
using System.Windows;
2+
using System.Windows.Controls;
3+
4+
namespace ShowWrite
5+
{
6+
public partial class AdjustVideoWindow : Window
7+
{
8+
public double Brightness { get; private set; }
9+
public double Contrast { get; private set; }
10+
public int Rotation { get; private set; }
11+
public bool MirrorH { get; private set; }
12+
public bool MirrorV { get; private set; }
13+
14+
public AdjustVideoWindow(double brightness, double contrast, int rotation, bool mirrorH, bool mirrorV)
15+
{
16+
InitializeComponent();
17+
18+
// 初始化滑块值
19+
BrightnessSlider.Value = brightness;
20+
ContrastSlider.Value = contrast;
21+
Brightness = brightness;
22+
Contrast = contrast;
23+
24+
RotationBox.SelectedIndex = rotation / 90;
25+
MirrorHCheck.IsChecked = mirrorH;
26+
MirrorVCheck.IsChecked = mirrorV;
27+
}
28+
29+
// 添加缺失的事件处理方法 - 这是关键修复
30+
private void BrightnessSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
31+
{
32+
Brightness = e.NewValue;
33+
}
34+
35+
private void ContrastSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
36+
{
37+
Contrast = e.NewValue;
38+
}
39+
40+
private void Ok_Click(object sender, RoutedEventArgs e)
41+
{
42+
if (RotationBox.SelectedItem is ComboBoxItem item && item.Tag != null)
43+
{
44+
#pragma warning disable CS8604 // 引用类型参数可能为 null。
45+
Rotation = int.Parse(item.Tag.ToString());
46+
#pragma warning restore CS8604 // 引用类型参数可能为 null。
47+
}
48+
MirrorH = MirrorHCheck.IsChecked == true;
49+
MirrorV = MirrorVCheck.IsChecked == true;
50+
51+
DialogResult = true;
52+
Close();
53+
}
54+
}
5555
}

App.xaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<Application x:Class="ShowWrite.App"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
4-
StartupUri="MainWindow.xaml">
5-
<Application.Resources>
6-
<ResourceDictionary>
7-
<ResourceDictionary.MergedDictionaries>
8-
<ui:ThemesDictionary Theme="light" />
9-
<ui:ControlsDictionary />
10-
</ResourceDictionary.MergedDictionaries>
11-
</ResourceDictionary>
12-
</Application.Resources>
13-
</Application>
1+
<Application x:Class="ShowWrite.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
4+
StartupUri="MainWindow.xaml">
5+
<Application.Resources>
6+
<ResourceDictionary>
7+
<ResourceDictionary.MergedDictionaries>
8+
<ui:ThemesDictionary Theme="light" />
9+
<ui:ControlsDictionary />
10+
</ResourceDictionary.MergedDictionaries>
11+
</ResourceDictionary>
12+
</Application.Resources>
13+
</Application>

App.xaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using System.Windows;
2-
3-
namespace ShowWrite
4-
{
5-
public partial class App : System.Windows.Application { }
6-
}
1+
using System.Windows;
2+
3+
namespace ShowWrite
4+
{
5+
public partial class App : System.Windows.Application { }
6+
}

AssemblyInfo.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using System.Windows;
2-
3-
[assembly: ThemeInfo(
4-
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5-
//(used if a resource is not found in the page,
6-
// or application resource dictionaries)
7-
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8-
//(used if a resource is not found in the page,
9-
// app, or any theme specific resource dictionaries)
10-
)]
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]

0 commit comments

Comments
 (0)