Skip to content

Commit

Permalink
Update AcItemEditor > Weight to use SheetValueEditor
Browse files Browse the repository at this point in the history
The more places I can use this, the better!
  • Loading branch information
JaykeBird committed Sep 22, 2023
1 parent 84952f0 commit a2f7e1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion PathfinderJson/AcItemEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<TextBlock Text="Type" Margin="5,2,5,0" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="2" />
<TextBox x:Name="txtType" MinHeight="23" Margin="0,0,0,5" VerticalAlignment="Top" TextChanged="textbox_TextChanged" Grid.Column="3"/>
<TextBlock Text="Weight" Margin="5,2,5,0" VerticalAlignment="Top" Grid.Column="4" HorizontalAlignment="Left" />
<TextBox x:Name="txtWeight" MinHeight="23" Margin="0,0,0,5" VerticalAlignment="Top" TextChanged="textbox_TextChanged" Grid.Column="5"/>
<local:SheetValueEditor x:Name="txtWeight" MinHeight="23" Margin="0,0,0,5" VerticalAlignment="Top" ValueChanged="txtWeight_ValueChanged" Grid.Column="5"/>
<TextBlock Text="Check Penalty" Margin="0,2,5,0" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1" />
<TextBox x:Name="txtPenalty" MinHeight="23" Margin="0,0,0,5" VerticalAlignment="Top" TextChanged="textbox_TextChanged" Grid.Column="1" Grid.Row="1"/>
<TextBlock Text="Spell Failure" Margin="5,2,5,0" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="2" Grid.Row="1" />
Expand Down
9 changes: 7 additions & 2 deletions PathfinderJson/AcItemEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void LoadAcItem(AcItem a)
txtBonus.Text = a.Bonus;
txtPenalty.Text = a.ArmorCheckPenalty;
txtSpellFailure.Text = a.SpellFailure;
txtWeight.Text = a.Weight;
txtWeight.ValueString = a.Weight ?? "";
txtName.Text = a.Name;
txtNotes.Text = a.Properties;
txtType.Text = a.Type;
Expand All @@ -38,7 +38,7 @@ public AcItem GetAcItem()
SpellFailure = GetStringOrNull(txtSpellFailure.Text),
Name = GetStringOrNull(txtName.Text),
Properties = GetStringOrNull(txtNotes.Text),
Weight = GetStringOrNull(txtWeight.Text),
Weight = GetStringOrNull(txtWeight.ValueString),
Type = GetStringOrNull(txtType.Text)
};

Expand Down Expand Up @@ -74,5 +74,10 @@ private void textbox_TextChanged(object sender, TextChangedEventArgs e)
{
ContentChanged?.Invoke(this, e);
}

private void txtWeight_ValueChanged(object sender, DependencyPropertyChangedEventArgs e)
{
ContentChanged?.Invoke(this, e);

Check failure on line 80 in PathfinderJson/AcItemEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'System.Windows.DependencyPropertyChangedEventArgs' to 'System.EventArgs'

Check failure on line 80 in PathfinderJson/AcItemEditor.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Argument 2: cannot convert from 'System.Windows.DependencyPropertyChangedEventArgs' to 'System.EventArgs'
}
}
}

0 comments on commit a2f7e1c

Please sign in to comment.