This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config_tool: make common config tool library (#24)
- Loading branch information
Showing
52 changed files
with
2,605 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.suo | ||
*.o | ||
*.obj | ||
*.pdb | ||
*.lib | ||
*.exp | ||
[Dd]ebug/ | ||
[Rr]elease/ | ||
[Oo]bj/ | ||
*.user | ||
*.ipch | ||
.vs/ | ||
*.vcxproj | ||
*.filters | ||
*.pubxml |
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,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.11.35219.272 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TRX_ConfigToolLib", "TRX_ConfigToolLib\TRX_ConfigToolLib.csproj", "{27F08E8C-2910-4682-B8BC-96ED4C1ECE54}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{27F08E8C-2910-4682-B8BC-96ED4C1ECE54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{27F08E8C-2910-4682-B8BC-96ED4C1ECE54}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{27F08E8C-2910-4682-B8BC-96ED4C1ECE54}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{27F08E8C-2910-4682-B8BC-96ED4C1ECE54}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {BA21B1D5-1CC7-4ED8-8C79-A1A5B0ACC840} | ||
EndGlobalSection | ||
EndGlobal |
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,69 @@ | ||
<Window | ||
x:Class="TRX_ConfigToolLib.Controls.AboutWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Title="{Binding ViewText[window_title_about]}" | ||
SizeToContent="WidthAndHeight" | ||
WindowStartupLocation="CenterOwner" | ||
ResizeMode="NoResize" | ||
ShowInTaskbar="False"> | ||
|
||
<Window.Resources> | ||
<ResourceDictionary Source="/TRX_ConfigToolLib;component/Resources/styles.xaml" /> | ||
</Window.Resources> | ||
|
||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="*"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
|
||
<Image | ||
VerticalAlignment="Top" | ||
Width="120" | ||
HorizontalAlignment="Left" | ||
Source="{Binding ImageSource}" | ||
Margin="10"/> | ||
|
||
<StackPanel | ||
Grid.Column="1" | ||
Margin="10"> | ||
<TextBlock | ||
FontSize="15" | ||
FontWeight="Bold" | ||
Margin="0,0,0,10" | ||
Text="{Binding ViewText[window_title_main]}"/> | ||
|
||
<TextBlock | ||
Margin="0,0,0,4" | ||
Text="{Binding ViewText[label_about_details]}"/> | ||
|
||
<TextBlock> | ||
<Hyperlink | ||
Click="GitHubHyperlink_Click"> | ||
<Run Text="{Binding ViewText[link_github]}" /> | ||
</Hyperlink> | ||
</TextBlock> | ||
</StackPanel> | ||
|
||
<StackPanel | ||
Grid.Row="1" | ||
Grid.ColumnSpan="2" | ||
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"> | ||
<Button | ||
Content="{Binding ViewText[command_close]}" | ||
Style="{StaticResource ButtonStyle}" | ||
Margin="10" | ||
HorizontalAlignment="Right" | ||
IsCancel="True"/> | ||
</StackPanel> | ||
</Grid> | ||
</Window> |
20 changes: 20 additions & 0 deletions
20
tools/config/TRX_ConfigToolLib/Controls/AboutWindow.xaml.cs
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,20 @@ | ||
using System.Windows; | ||
using TRX_ConfigToolLib.Models; | ||
using TRX_ConfigToolLib.Utils; | ||
|
||
namespace TRX_ConfigToolLib.Controls; | ||
|
||
public partial class AboutWindow : Window | ||
{ | ||
public AboutWindow() | ||
{ | ||
InitializeComponent(); | ||
DataContext = new AboutWindowViewModel(); | ||
Owner = Application.Current.MainWindow; | ||
} | ||
|
||
private void GitHubHyperlink_Click(object sender, RoutedEventArgs e) | ||
{ | ||
ProcessUtils.Start(TRXConstants.Instance.GitHubURL); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
tools/config/TRX_ConfigToolLib/Controls/CategoryControl.xaml
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 @@ | ||
<UserControl | ||
x:Class="TRX_ConfigToolLib.Controls.CategoryControl" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:controls="clr-namespace:TRX_ConfigToolLib.Controls" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" | ||
d:DesignWidth="800"> | ||
|
||
<UserControl.Resources> | ||
<ResourceDictionary Source="/TRX_ConfigToolLib;component/Resources/styles.xaml" /> | ||
</UserControl.Resources> | ||
|
||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="*"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Image | ||
Margin="7,7,5,7" | ||
Source="{Binding ImageSource}"/> | ||
|
||
<ScrollViewer | ||
Padding="7" | ||
Grid.Column="1" | ||
ScrollChanged="ScrollViewer_ScrollChanged" | ||
VerticalScrollBarVisibility="Auto" | ||
HorizontalScrollBarVisibility="Disabled"> | ||
<ItemsControl | ||
ItemsSource="{Binding ItemsSource}" | ||
AlternationCount="{Binding Items.Count, RelativeSource={RelativeSource Self}}"> | ||
<ItemsControl.ItemTemplate> | ||
<DataTemplate> | ||
<controls:PropertyControl | ||
Style="{StaticResource SeparatorBorderStyle}"/> | ||
</DataTemplate> | ||
</ItemsControl.ItemTemplate> | ||
</ItemsControl> | ||
</ScrollViewer> | ||
</Grid> | ||
</UserControl> |
17 changes: 17 additions & 0 deletions
17
tools/config/TRX_ConfigToolLib/Controls/CategoryControl.xaml.cs
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,17 @@ | ||
using System.Windows.Controls; | ||
using TRX_ConfigToolLib.Models; | ||
|
||
namespace TRX_ConfigToolLib.Controls; | ||
|
||
public partial class CategoryControl : UserControl | ||
{ | ||
public CategoryControl() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) | ||
{ | ||
(DataContext as CategoryViewModel).ViewPosition = e.VerticalOffset; | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
tools/config/TRX_ConfigToolLib/Controls/NumericUpDown.xaml
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,91 @@ | ||
<UserControl | ||
x:Class="TRX_ConfigToolLib.Controls.NumericUpDown" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:utils="clr-namespace:TRX_ConfigToolLib.Utils" | ||
mc:Ignorable="d" | ||
d:DesignHeight="25" | ||
d:DesignWidth="140"> | ||
|
||
<UserControl.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="/TRX_ConfigToolLib;component/Resources/styles.xaml" /> | ||
<ResourceDictionary> | ||
<utils:BindingProxy x:Key="controlProxy" Data="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"/> | ||
<utils:BindingProxy x:Key="windowProxy" Data="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/> | ||
</ResourceDictionary> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</UserControl.Resources> | ||
|
||
<Border | ||
BorderBrush="#666" | ||
BorderThickness="1" | ||
Margin="0"> | ||
<Grid | ||
Background="#FFF"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="15"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="1"/> | ||
<RowDefinition Height="*"/> | ||
</Grid.RowDefinitions> | ||
|
||
<TextBox | ||
x:Name="_textBox" | ||
PreviewKeyDown="TextBox_PreviewKeyDown" | ||
PreviewTextInput="TextBox_TextInput" | ||
TextChanged="TextBox_TextChanged" | ||
DataObject.Pasting="TextBox_Pasting" | ||
LostFocus="TextBox_LostFocus" | ||
Grid.RowSpan="3" | ||
Style="{StaticResource NumericTextBoxStyle}"> | ||
<TextBox.Resources> | ||
<utils:BindingProxy x:Key="proxy" Data="{Binding}"/> | ||
</TextBox.Resources> | ||
<TextBox.Text> | ||
<Binding Path="Text" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay"> | ||
<Binding.ValidationRules> | ||
<utils:NumericValidationRule> | ||
<utils:NumericValidationRule.ValidationRule> | ||
<utils:NumericValidation | ||
MinValue="{Binding Data.MinValue, Source={StaticResource proxy}}" | ||
MaxValue="{Binding Data.MaxValue, Source={StaticResource proxy}}" | ||
InvalidNumberMessage="{Binding Data.ViewText[spinner_msg_invalid_number], Source={StaticResource windowProxy}}" | ||
ComparisonFailedMessage="{Binding Data.ViewText[spinner_msg_comparison_failed], Source={StaticResource windowProxy}}"/> | ||
</utils:NumericValidationRule.ValidationRule> | ||
</utils:NumericValidationRule> | ||
</Binding.ValidationRules> | ||
</Binding> | ||
</TextBox.Text> | ||
</TextBox> | ||
|
||
<RepeatButton | ||
Command="{Binding Data.SpinUpCommand, Source={StaticResource controlProxy}}" | ||
Grid.Column="1" | ||
Content="..\Resources\arrow-up.png" | ||
ToolTip="{Binding Data.ViewText[spinner_increase], Source={StaticResource windowProxy}}" | ||
Style="{StaticResource FlatRepeatButtonStyle}"/> | ||
|
||
<Border | ||
Background="#666" | ||
Grid.Column="1" | ||
Grid.Row="1"/> | ||
|
||
<RepeatButton | ||
Command="{Binding Data.SpinDownCommand, Source={StaticResource controlProxy}}" | ||
Grid.Column="1" | ||
Grid.Row="2" | ||
Content="..\Resources\arrow-down.png" | ||
ToolTip="{Binding Data.ViewText[spinner_decrease], Source={StaticResource windowProxy}}" | ||
Style="{StaticResource FlatRepeatButtonStyle}"/> | ||
</Grid> | ||
</Border> | ||
</UserControl> |
Oops, something went wrong.