private void MUCReminders_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); BLIO.Log(files.Length + " File(s) dropped into RemindMe!"); BLIO.Log(".remindme files: " + files.Where(file => Path.GetExtension(file) == ".remindme").ToList().Count); //Loop through each file that is dragged into RemindMe foreach (string file in files.Where(file => Path.GetExtension(file) == ".remindme").ToList()) { List <object> remindersFromFile = BLReminder.DeserializeRemindersFromFile(file); //Objects from the .remindme file foreach (object rem in remindersFromFile.Where(rem => rem.GetType() == typeof(Reminder)).ToList()) { BLReminder.PushReminderToDatabase((Reminder)rem); BLIO.Log("Deserialized reminder and inserted it into RemindMe"); } } new Thread(() => { //Log an entry to the database, for data! try { BLOnlineDatabase.ImportCount++; } catch (ArgumentException ex) { BLIO.Log("Exception at BLOnlineDatabase.ImportCount++ MUCReminders.cs . -> " + ex.Message); BLIO.WriteError(ex, ex.Message, true); } }).Start(); //finally, refresh the listview UpdateCurrentPage(); }
private void UCReminders_DragDrop(object sender, DragEventArgs e) { object source = e.Data.GetData("DragSource"); if (source != null && source.ToString() == "lvReminders") { if (RemindMeBox.Show("Do you want to copy the selected reminders?\n\nYou just dragged reminders and dropped them in RemindMe again.", RemindMeBoxReason.YesNo) == DialogResult.No) { return; } //If the user said no, return; else just continue } string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); BLIO.Log("File(s) dropped into RemindMe! ( " + files.Length + " file(s) )"); BLIO.Log(".remindme files: " + files.Where(file => Path.GetExtension(file) == ".remindme").ToList().Count); //Loop through each file that is dragged into RemindMe foreach (string file in files.Where(file => Path.GetExtension(file) == ".remindme").ToList()) { List <object> remindersFromFile = BLReminder.DeserializeRemindersFromFile(file); //Objects from the .remindme file foreach (object rem in remindersFromFile.Where(rem => rem.GetType() == typeof(Reminder)).ToList()) { BLReminder.PushReminderToDatabase((Reminder)rem); BLIO.Log("Deserialized reminder and inserted it into RemindMe"); } } //finally, refresh the listview UpdateCurrentPage(); }
private void btnImport_Click(object sender, EventArgs e) { try { if (lvReminders.CheckedItems.Count > 0) { foreach (Reminder rem in GetSelectedRemindersFromListview()) { if (!File.Exists(rem.SoundFilePath)) //when you import reminders on another device, the path to the file might not exist. remove it. { rem.SoundFilePath = ""; } BLIO.Log("Pushing reminder with id " + rem.Id + " To the database"); BLReminder.PushReminderToDatabase(rem); } //Let remindme know that the listview should be refreshed BLIO.Log("Sending message WM_RELOAD_REMINDERS ...."); PostMessage((IntPtr)HWND_BROADCAST, WM_RELOAD_REMINDERS, new IntPtr(0xCDCD), new IntPtr(0xEFEF)); this.Close(); } else { RemindMeMessageFormManager.MakeMessagePopup("Please select at least one reminder.", 3); } } catch (Exception ex) { ErrorPopup pop = new ErrorPopup("Error inserting reminders", ex); pop.Show(); BLIO.WriteError(ex, "Error inserting reminders"); } }
private bool ImportReminders() { int remindersInserted = 0; List <Reminder> selectedReminders = GetSelectedRemindersFromListview(); if (selectedReminders.Count == 0) { return(false); } if (remindersFromRemindMeFile != null) { BLIO.Log("Attempting to import " + selectedReminders.Count + " reminders ..."); foreach (Reminder rem in selectedReminders) { if (!File.Exists(rem.SoundFilePath)) //when you import reminders on another device, the path to the file might not exist. remove it. { rem.SoundFilePath = ""; } BLReminder.PushReminderToDatabase(rem); BLIO.Log("Pushed reminder with id " + rem.Id + " to the database"); remindersInserted++; } BLIO.Log(remindersInserted + " Reminders inserted"); } SetStatusTexts(remindersInserted, selectedReminders.Count); return(true); }
private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) { BLIO.Log("Setting up the duplicating process..."); BLIO.Log("duplicating reminder with id " + rem.Id); BLReminder.PushReminderToDatabase(rem); BLIO.Log("reminder duplicated."); UCReminders.GetInstance().UpdateCurrentPage(); }
private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) { BLIO.Log("Toolstrip option clicked: Duplicate (" + rem.Id + ")"); BLIO.Log("Setting up the duplicating process..."); BLIO.Log("duplicating reminder with id " + rem.Id); long oldRemId = rem.Id; long newRemId = BLReminder.PushReminderToDatabase(rem); AdvancedReminderProperties props = BLLocalDatabase.AVRProperty.GetAVRProperties(rem.Id); if (props != null) { props.Remid = newRemId; BLLocalDatabase.AVRProperty.InsertAVRProperties(props); } HttpRequests req = BLLocalDatabase.HttpRequest.GetHttpRequestById(oldRemId); if (req != null) { long oldHttpId = req.Id; req.reminderId = newRemId; long newHttpId = BLLocalDatabase.HttpRequest.InsertHttpRequest(req); List <HttpRequestCondition> conditions = BLLocalDatabase.HttpRequestConditions.GetConditions(oldHttpId); foreach (HttpRequestCondition cond in conditions) { cond.RequestId = newHttpId; BLLocalDatabase.HttpRequestConditions.InsertCondition(cond); } //Now update the duplicated reminder with the httprequest Reminder dup = BLReminder.GetReminderById(newRemId); dup.HttpId = req.Id; BLReminder.EditReminder(dup); } BLIO.Log("reminder duplicated."); MUCReminders.Instance.UpdateCurrentPage(); new Thread(() => { //Log an entry to the database, for data! try { BLOnlineDatabase.DuplicateCount++; } catch (ArgumentException ex) { BLIO.Log("Exception at BLOnlineDatabase.DuplicateCount++. -> " + ex.Message); BLIO.WriteError(ex, ex.Message, true); } finally { GC.Collect(); } }).Start(); }
private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) { BLIO.Log("Toolstrip option clicked: Duplicate (" + rem.Id + ")"); BLIO.Log("Setting up the duplicating process..."); BLIO.Log("duplicating reminder with id " + rem.Id); BLReminder.PushReminderToDatabase(rem); BLIO.Log("reminder duplicated."); UCReminders.Instance.UpdateCurrentPage(); new Thread(() => { //Log an entry to the database, for data! BLOnlineDatabase.DuplicateCount++; }).Start(); }
private bool ImportReminders() { int remindersInserted = 0; List <Reminder> selectedReminders = GetSelectedRemindersFromListview(); if (selectedReminders.Count == 0) { return(false); } if (remindersFromRemindMeFile != null) { BLIO.Log("Attempting to import " + selectedReminders.Count + " reminders ..."); foreach (Reminder rem in selectedReminders) { if (!File.Exists(rem.SoundFilePath)) //when you import reminders on another device, the path to the file might not exist. remove it. { rem.SoundFilePath = ""; } BLReminder.PushReminderToDatabase(rem); BLIO.Log("Pushed reminder with id " + rem.Id + " to the database"); remindersInserted++; } new Thread(() => { //Log an entry to the database, for data! try { BLOnlineDatabase.ImportCount++; } catch (ArgumentException ex) { BLIO.Log("Exception at BLOnlineDatabase.ImportCount++ UCImportexport.cs . -> " + ex.Message); BLIO.WriteError(ex, ex.Message, true); } }).Start(); BLIO.Log(remindersInserted + " Reminders inserted"); } SetStatusTexts(remindersInserted, selectedReminders.Count); return(true); }
private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) { BLIO.Log("Toolstrip option clicked: Duplicate (" + rem.Id + ")"); BLIO.Log("Setting up the duplicating process..."); BLIO.Log("duplicating reminder with id " + rem.Id); BLReminder.PushReminderToDatabase(rem); BLIO.Log("reminder duplicated."); UCReminders.Instance.UpdateCurrentPage(); new Thread(() => { //Log an entry to the database, for data! try { BLOnlineDatabase.DuplicateCount++; } catch (ArgumentException ex) { BLIO.Log("Exception at BLOnlineDatabase.DuplicateCount++. -> " + ex.Message); BLIO.WriteError(ex, ex.Message, true); } }).Start(); }