Skip to content

Commit

Permalink
fix: fix ValueChanged and ResourceChanged listen
Browse files Browse the repository at this point in the history
  • Loading branch information
czastack committed Apr 12, 2024
1 parent 0f11cb7 commit e2cee26
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
7 changes: 3 additions & 4 deletions RszTool.App/Views/RszPfbFileView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
</ResourceDictionary>
</UserControl.Resources>

<Grid>
<Grid local:FieldValueInput.ValueChanged="OnValueChanged"
local:FieldValueInput.ResourceChanged="OnResourceChanged">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
Expand All @@ -61,9 +62,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MaxHeight="{Binding ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentPresenter}}" />
</Grid.RowDefinitions>
<local:RszFileView Grid.Row="0"
local:FieldValueInput.ValueChanged="OnValueChanged"
local:FieldValueInput.ResourceChanged="OnResourceChanged" />
<local:RszFileView Grid.Row="0" />
<GridSplitter Grid.Row="1" Height="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0,5,0,0" />
<TabControl Grid.Row="2">
<TabItem Header="{res:Text FindInstances}">
Expand Down
7 changes: 3 additions & 4 deletions RszTool.App/Views/RszScnFileView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
</ResourceDictionary>
</UserControl.Resources>

<Grid>
<Grid local:FieldValueInput.ValueChanged="OnValueChanged"
local:FieldValueInput.ResourceChanged="OnResourceChanged">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
Expand All @@ -90,9 +91,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MaxHeight="{Binding ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentPresenter}}" />
</Grid.RowDefinitions>
<local:RszFileView Grid.Row="0"
local:FieldValueInput.ValueChanged="OnValueChanged"
local:FieldValueInput.ResourceChanged="OnResourceChanged" />
<local:RszFileView Grid.Row="0" />
<GridSplitter Grid.Row="1" Height="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0,5,0,0" />
<TabControl Grid.Row="2">
<TabItem Header="{res:Text FindInstances}">
Expand Down
1 change: 1 addition & 0 deletions RszTool.App/Views/RszScnFileView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private void OnResourceChanged(object sender, RoutedEventArgs e)
if (DataContext is ScnFileViewModel viewModel)
{
viewModel.ResourceChanged = true;
Console.WriteLine("OnResourceChanged");
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions RszTool.App/Views/RszUserFileView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<ResourceDictionary Source="TreeViewTemplate.xaml" />
</UserControl.Resources>

<Grid>
<Grid local:FieldValueInput.ValueChanged="OnValueChanged"
local:FieldValueInput.ResourceChanged="OnResourceChanged">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
Expand All @@ -23,9 +24,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MaxHeight="{Binding ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentPresenter}}" />
</Grid.RowDefinitions>
<local:RszFileView Grid.Row="0"
local:FieldValueInput.ValueChanged="OnValueChanged"
local:FieldValueInput.ResourceChanged="OnResourceChanged" />
<local:RszFileView Grid.Row="0" />
<GridSplitter Grid.Row="1" Height="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0,5,0,0" />
<local:SearchInstanceView Grid.Row="2" Margin="5" />
</Grid>
Expand Down
3 changes: 2 additions & 1 deletion RszTool/RszFile/PfbFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ protected override bool DoWrite()
{
RebuildInfoTable();
}
if (ResourceChanged)
else if (ResourceChanged)
{
RszUtils.SyncResourceFromRsz(ResourceInfoList, RSZ!);
ResourceChanged = false;
}
FileHandler handler = FileHandler;
handler.Clear();
Expand Down
3 changes: 2 additions & 1 deletion RszTool/RszFile/ScnFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,10 @@ protected override bool DoWrite()
{
RebuildInfoTable();
}
if (ResourceChanged)
else if (ResourceChanged)
{
RszUtils.SyncResourceFromRsz(ResourceInfoList, RSZ!);
ResourceChanged = false;
}

FileHandler handler = FileHandler;
Expand Down
3 changes: 2 additions & 1 deletion RszTool/RszFile/UserFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ protected override bool DoWrite()
{
RebuildInfoTable();
}
if (ResourceChanged)
else if (ResourceChanged)
{
RszUtils.SyncResourceFromRsz(ResourceInfoList, RSZ!);
ResourceChanged = false;
}
FileHandler handler = FileHandler;
handler.Clear();
Expand Down

0 comments on commit e2cee26

Please sign in to comment.