Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting IsEnabled on a ribbon textbox to true doing nothing
    primarykey
    data
    text
    <p>I am working on a program to manage a minecraft server with a local UI as well as a remote interface. I have a button on a ribbon bar that will enable or disable the remote interface and a textbox for inputting the port. Currently, I disable the textbox when the networking is enabled, but, disabling does not re-enable the textbox after I set it to true again (and setting a breakpoint reveals it to still be false).</p> <pre><code> private void NetToggleChecked(object sender, RoutedEventArgs e) { portTextBox.IsEnabled = false; if (ButtonPressedByUser) { var result = MessageBox.Show("Are you sure you want to enable networking with the current settings?" + " If not properly configured, it may be possible for an attacker to enter your server.", "Simple Bukkit Wrapper", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No); if (result == MessageBoxResult.No) { ButtonPressedByUser = false; NetworkToggle.IsChecked = false; ButtonPressedByUser = true; return; } } Config.NetConf["enabled"] = "true"; int port; if (!int.TryParse(Config.NetConf["port"], out port)) { MessageBox.Show("Port could not be parsed (is it a number?)"); ButtonPressedByUser = false; NetworkToggle.IsChecked = false; ButtonPressedByUser = true; return; } Net.Listener.StartListening(port); } private void NetworkToggleUnchecked(object sender, RoutedEventArgs e) { portTextBox.IsEnabled = true; if (ButtonPressedByUser) { var result = MessageBox.Show("Are you sure you wish to disable all networking to your server? It will " + "be impossible to connect to it remotely and any existing connections will be closed.", "", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No); if (result == MessageBoxResult.No) { ButtonPressedByUser = false; NetworkToggle.IsChecked = true; ButtonPressedByUser = true; return; } } Config.NetConf["enabled"] = "false"; Net.Listener.StopListening(); } </code></pre> <p>Thank you for any help resolving why the textbox will not enable again.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload