1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-28 09:29:37 +00:00

Fix Edit Label tweak

The change in 779566 missed a step, so the TextChanged method wasn't
getting called.  (When you bind TextBox Text to a string property, the
TextChanged events stop firing.  You need to react to the property
"set" call instead.)

Also, enable UseKeepAliveHack.  I have no reason to believe switching
to WPF will make remoting less flaky.
This commit is contained in:
Andy McFadden 2019-07-08 13:40:28 -07:00
parent 0c5ae78eaf
commit ed4fb0dd66
4 changed files with 6 additions and 3 deletions

View File

@ -174,6 +174,8 @@ namespace SourceGenWPF {
public MainController(MainWindow win) { public MainController(MainWindow win) {
mMainWin = win; mMainWin = win;
ScriptManager.UseKeepAliveHack = true;
} }
/// <summary> /// <summary>

View File

@ -39,7 +39,7 @@ limitations under the License.
<StackPanel Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"> <StackPanel Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2">
<TextBlock Text="Enter label:"/> <TextBlock Text="Enter label:"/>
<TextBox Name="labelTextBox" Margin="0,2,0,0" FontFamily="{StaticResource GeneralMonoFont}" <TextBox Name="labelTextBox" Margin="0,2,0,0" FontFamily="{StaticResource GeneralMonoFont}"
Text="{Binding LabelText}" TextChanged="LabelTextBox_TextChanged"/> Text="{Binding LabelText, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Name="maxLengthLabel" Text="• Must be 2-32 characters long (or blank to remove)" <TextBlock Name="maxLengthLabel" Text="• Must be 2-32 characters long (or blank to remove)"
Margin="0,7,0,0"/> Margin="0,7,0,0"/>
<TextBlock Name="firstLetterLabel" Text="• Must start with a letter or underscore"/> <TextBlock Name="firstLetterLabel" Text="• Must start with a letter or underscore"/>

View File

@ -63,6 +63,7 @@ namespace SourceGenWPF.WpfGui {
get { return mLabelText; } get { return mLabelText; }
set { set {
mLabelText = value; mLabelText = value;
LabelTextBox_TextChanged();
OnPropertyChanged(); OnPropertyChanged();
} }
} }
@ -116,7 +117,7 @@ namespace SourceGenWPF.WpfGui {
labelTextBox.Focus(); labelTextBox.Focus();
} }
private void LabelTextBox_TextChanged(object sender, RoutedEventArgs e) { private void LabelTextBox_TextChanged() {
string str = LabelText; string str = LabelText;
bool valid = true; bool valid = true;

View File

@ -1003,7 +1003,7 @@ namespace SourceGenWPF.WpfGui {
MenuItem recents = (MenuItem)sender; MenuItem recents = (MenuItem)sender;
recents.Items.Clear(); recents.Items.Clear();
Debug.WriteLine("COUNT is " + mMainCtrl.RecentProjectPaths.Count); //Debug.WriteLine("COUNT is " + mMainCtrl.RecentProjectPaths.Count);
if (mMainCtrl.RecentProjectPaths.Count == 0) { if (mMainCtrl.RecentProjectPaths.Count == 0) {
MenuItem mi = new MenuItem(); MenuItem mi = new MenuItem();
mi.Header = Res.Strings.PARENTHETICAL_NONE; mi.Header = Res.Strings.PARENTHETICAL_NONE;