public string CheckTextBox(object window, string checkStr, string showSTR) { string newSTR = ""; //Для Exhibit { if (window.GetType() == typeof(Exhibit)) { ExW = (Exhibit)window; ExW.Enabled = false; if (checkStr.Trim() == "") { ShowMessage(showSTR); } ExW.Enabled = true; return(checkStr); } } //Для ExhibitAdd { if (window.GetType() == typeof(ExhibitAdd)) { ExAddW = (ExhibitAdd)window; ExAddW.Enabled = false; if (checkStr.Trim() == "") { ShowMessage(showSTR); } ExAddW.Enabled = true; return(checkStr); } } //Для Museum { if (window.GetType() == typeof(Museum)) { MusW = (Museum)window; MusW.Enabled = false; if (checkStr.Trim() == "") { ShowMessage(showSTR); } MusW.Enabled = true; return(checkStr); } } //Для Maecenas { if (window.GetType() == typeof(Maecenas)) { MaecW = (Maecenas)window; MaecW.Enabled = false; if (checkStr.Trim() == "") { ShowMessage(showSTR); } MaecW.Enabled = true; return(checkStr); } } //Для Showroom { if (window.GetType() == typeof(Showroom)) { ShowW = (Showroom)window; ShowW.Enabled = false; if (checkStr.Trim() == "") { ShowMessage(showSTR); } ShowW.Enabled = true; return(checkStr); } } //Для Restorer { if (window.GetType() == typeof(Restorer)) { RestorerW = (Restorer)window; RestorerW.Enabled = false; if (checkStr.Trim() == "") { ShowMessage(showSTR); } RestorerW.Enabled = true; return(checkStr); } } return(newSTR); }