private void toggle_Checked(object sender, RoutedEventArgs e) { if (!AdminFunc.IsAdministrator()) { ReqSU?.Invoke(this, e); OnStatusChanged(null, null); return; } /*if ((sender as ToggleSwitch).IsChecked == null) * (sender as ToggleSwitch).IsChecked = true;*/ bool state = (bool)(sender as ToggleSwitch).IsChecked; foreach (Tweak tweak in myGroup.Tweaks) { if (!tweak.IsAvailable()) { continue; } if (state && (tweak.Sellected == null ? !tweak.Optional : (bool)tweak.Sellected)) { tweak.Apply(); } else if (!state) { tweak.Undo(); } } }
private void toggle_Click(object sender, RoutedEventArgs e) { if (!myTweak.usrLevel && !AdminFunc.IsAdministrator()) { ReqSU?.Invoke(this, e); OnStatusChanged(null, null); return; } if ((bool)toggle.IsChecked) { myTweak.Apply((System.Windows.Forms.Control.ModifierKeys & System.Windows.Forms.Keys.Control) == 0); } else { myTweak.Undo((System.Windows.Forms.Control.ModifierKeys & System.Windows.Forms.Keys.Control) == 0); } }