private async void BtnAdd_Click(object sender, RoutedEventArgs e) { if (!CheckEmpty()) { return; } #region AddFileType try { var addViolation = new DFileType { DFileTypeName = TxtName.Text.Trim() == string.Empty ? null : TxtName.Text }; await Task.Run(() => addViolation.Add()); } catch (Exception exception) { Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در ثبت اطلاعات\n" + exception.Message); } Window_Loaded(null, null); Utility.Message("پیام", "اطلاعات با موفقیت ثبت گردید", "Correct.png"); #endregion }