private void Btn_Click(object sender, RoutedEventArgs e) { if (CheckPin()) { if (IsModify) { SQliteDbContext.UpdatOnePin(pin); } else { SQliteDbContext.AddPin(pin); } string msg = IsModify ? "修改成功!" : "添加成功!"; MessageBox.Show(msg, "Info", MessageBoxButton.OK, MessageBoxImage.Information); Messenger.Default.Send <string>("update", "UpdateCanavs"); this.Close(); } }