private void LoadDeletedReminders() { BLIO.Log("Recover deleted button pressed. Loading reminders into listview"); lvReminders.Items.Clear(); transferType = ReminderTransferType.RECOVER; BLFormLogic.AddRemindersToListview(lvReminders, BLReminder.GetDeletedReminders().OrderBy(rem => rem.Name).ToList(), true); BLIO.Log("Added deleted reminders to listview."); }
private void btnRecoverOld_Click(object sender, EventArgs e) { BLIO.Log("Recover old button pressed. Loading reminders into listview"); lvReminders.Items.Clear(); ToggleButton(sender); transferType = ReminderTransferType.RECOVER; BLFormLogic.AddRemindersToListview(lvReminders, BLReminder.GetArchivedReminders().OrderBy(rem => rem.Name).ToList()); BLIO.Log("Added old reminders to listview."); }
private void btnExport_Click(object sender, EventArgs e) { ToggleButton(sender); lvReminders.Items.Clear(); BLIO.Log("Export button pressed. Loading reminders into listview"); if (BLReminder.GetReminders().Count > 0) { transferType = ReminderTransferType.EXPORT; BLFormLogic.AddRemindersToListview(lvReminders, BLReminder.GetReminders()); } BLIO.Log("Added exportable reminders to listview."); }
private void LoadExportReminders() { BLIO.Log("(MUCImportExport)btnExport_Click"); lvReminders.Items.Clear(); BLIO.Log("Export button pressed. Loading reminders into listview"); if (BLReminder.GetReminders().Count > 0) { transferType = ReminderTransferType.EXPORT; BLFormLogic.AddRemindersToListview(lvReminders, BLReminder.GetReminders(), true); } BLIO.Log("Added exportable reminders to listview."); }
private void RemindMeImporter_Load(object sender, EventArgs e) { BLIO.Log("RemindmeImporter_load"); this.MaximumSize = this.Size; if (!HasFileAccess(this.remindmeFile)) //Do not attempt to launch the importer form if we can't open the file { BLIO.Log("Error opening .remindme file, no rights"); RemindMeBox.Show("Can not open this .remindme file from " + Path.GetDirectoryName(this.remindmeFile) + ". Insufficient rights.", RemindMeBoxReason.OK); this.Close(); } else { try { BLIO.Log("Deserializing reminders....."); List <object> deSerializedReminders = BLReminder.DeserializeRemindersFromFile(remindmeFile); BLIO.Log(deSerializedReminders.Count - 1 + " reminders deserialized!"); lblAmountOfReminders.Text = deSerializedReminders.Count - 1 + " Reminders"; //-1 because of country code foreach (object rem in deSerializedReminders) { if (rem.GetType() == typeof(Reminder)) { Reminder reminder = (Reminder)rem; BLIO.Log(reminder.Name + " Loaded into RemindMeImporter from the .remindme file."); remindersFromRemindMeFile.Add((Reminder)rem); } else { BLIO.Log("Language code" + languageCode + " read from the .remindme file!"); languageCode = rem.ToString(); //The language code stored in the .remindme file, "en-Us" for example } } if (languageCode != "") //Don't need to do this when exporting. { BLIO.Log("Going through the reminder list once more...."); foreach (object rem in remindersFromRemindMeFile) { if (rem.GetType() == typeof(Reminder)) { Reminder remm = (Reminder)rem; //Fix the date if the .remindme file has a different time format than the current system BLIO.Log("(" + remm.Name + ") Fixing the date to match the language code " + languageCode); remm.Date = BLDateTime.ConvertDateTimeStringToCurrentCulture(remm.Date, languageCode); } } } if (remindersFromRemindMeFile != null) { BLIO.Log("Adding the reminders from the .remindme file to the listview...."); BLFormLogic.AddRemindersToListview(lvReminders, remindersFromRemindMeFile); BLIO.Log("Done!"); } else { BLIO.Log("Failed to load reminders."); lblTitle.Text = "Failed to load reminders."; } } catch (Exception ex) { RemindMeBox.Show("Something has gone wrong loading reminders from this .remindme file.\r\nThe file might be corrupt", RemindMeBoxReason.OK); BLIO.Log("Error loading reminders from .remindme file written to error log"); BLIO.WriteError(ex, "Error loading reminders from .remindme file"); Application.Exit(); } } BLIO.Log("RemindmeImporter loaded !"); }