public void CryptoSupportStopServices(ModelDataFile information_about_file, string SHA, bool flag_crypto) { if (flag_crypto) { db.DeleteItem <ModelDataFile>(information_about_file.id); File.Delete(information_about_file.FilePath + ".aes"); Toast.MakeText(context, "Файл розшифрован", ToastLength.Long).Show(); SetCountFiles(information_about_file.id_users, true); Show_Dialog_SHA(information_about_file.FileSHA, SHA); } else { information_about_file.FileSHA = SHA; db.SaveItem(information_about_file, false); File.Delete(information_about_file.FilePath); Toast.MakeText(context, "Файл зашифрован", ToastLength.Long).Show(); SetCountFiles(information_about_file.id_users, false); } context.StopService(intent); }
private void Button_Click(object sender, EventArgs e) { var conn = new DataBase().SQLiteConnection(); var db = new DataBaseHelp(conn); var toast_mess = string.Empty; if (validate()) { var category = category_text.Text; var password = password_text.Text; if (information_category == null) { var list = db.GetItems <ModelCategory>(); for (int i = 0; i < list.Count; i++) { if (list[i].Category == category) { Toast.MakeText(this, "Категория с таким именем уже зарегистрирована", ToastLength.Short).Show(); return; } } information_category = new ModelCategory(); information_category.Category = category; information_category.Password = EncryptionDecryptionService.GetSHA(password, false); information_category.Count = 0; toast_mess = "Категория успешно создана"; db.SaveItem(information_category, false); } else { information_category.Category = category; information_category.Password = EncryptionDecryptionService.GetSHA(password, false); information_category.Count = information_category.Count; toast_mess = "Категория обновлена"; db.SaveItem(information_category, true); } Toast.MakeText(this, toast_mess, ToastLength.Short).Show(); StartActivity(typeof(CategoryActivity)); } else { Toast.MakeText(this, "Поля ввода не пройшли валидацию", ToastLength.Short).Show(); } }