// Set the visibility of the expander icon private void ExpanderVisibility(bool state) { RenameTxt.ShowExpander(state); ReplaceTxt.ShowExpander(state); WithTxt.ShowExpander(state); PrefixTxt.ShowExpander(state); SuffixTxt.ShowExpander(state); }
// Set the rename buttons enabled state private void RenameBtnsEnabled() { if (RenameBtn.IsChecked == true) { if (!RenameTxt.IsEmpty() && RenameTxt.EditMode) { RenameSelBtn.IsEnabled = RenameAllBtn.IsEnabled = true; } else { RenameSelBtn.IsEnabled = RenameAllBtn.IsEnabled = false; } } else { if (!ReplaceTxt.IsEmpty() && ReplaceTxt.EditMode) { RenameSelBtn.IsEnabled = RenameAllBtn.IsEnabled = true; } else if (!ReplaceTxt.IsEmpty() && ReplaceTxt.EditMode && !WithTxt.IsEmpty() && WithTxt.EditMode) { RenameSelBtn.IsEnabled = RenameAllBtn.IsEnabled = true; } else if (!PrefixTxt.IsEmpty() && PrefixTxt.EditMode) { RenameSelBtn.IsEnabled = RenameAllBtn.IsEnabled = true; } else if (!SuffixTxt.IsEmpty() && SuffixTxt.EditMode) { RenameSelBtn.IsEnabled = RenameAllBtn.IsEnabled = true; } else if (TrimStartSpn.NumValue > 0 || TrimEndSpn.NumValue > 0) { RenameSelBtn.IsEnabled = RenameAllBtn.IsEnabled = true; } else { RenameSelBtn.IsEnabled = RenameAllBtn.IsEnabled = false; } } }
// Set the textbox historic to individual or common private void TextBoxHistoric_Click(object sender, RoutedEventArgs e) { // get the clicked submenu and show the expander when needed if ((e.OriginalSource as MenuItem) == CommonHistoric) { SetCommonHistoricMode(true); RenameTxt.ActiveHistory = ReplaceTxt.ActiveHistory = WithTxt.ActiveHistory = PrefixTxt.ActiveHistory = SuffixTxt.ActiveHistory = false; if (historicCommon.Count > 0) { ExpanderVisibility(true); } else { ExpanderVisibility(false); } } else { SetCommonHistoricMode(false); RenameTxt.ActiveHistory = ReplaceTxt.ActiveHistory = WithTxt.ActiveHistory = PrefixTxt.ActiveHistory = SuffixTxt.ActiveHistory = true; if (RenameTxt.History.Count > 0) { RenameTxt.ShowExpander(true); } else { RenameTxt.ShowExpander(false); } if (ReplaceTxt.History.Count > 0) { ReplaceTxt.ShowExpander(true); } else { ReplaceTxt.ShowExpander(false); } if (WithTxt.History.Count > 0) { WithTxt.ShowExpander(true); } else { WithTxt.ShowExpander(false); } if (PrefixTxt.History.Count > 0) { PrefixTxt.ShowExpander(true); } else { PrefixTxt.ShowExpander(false); } if (SuffixTxt.History.Count > 0) { SuffixTxt.ShowExpander(true); } else { SuffixTxt.ShowExpander(false); } } }