//------------------------------------------------------------------------------------------------------------------------------- // Show the note: it is the startup of the creation process of the note //------------------------------------------------------------------------------------------------------------------------------- public static short Show(string desc, Type type = Type.INFO, string tit = "Notifier", bool isDialog = false, int timeout = 0, Form inApp = null) { short updated_note_id = 0, // If there is already a note with the same content updated_note_occurency = 0; // update it and do not create a new one if (NotifierAlreadyPresent(desc, type, tit, isDialog, out updated_note_id, out updated_note_occurency)) { Update(updated_note_id, desc, type, "[" + ++updated_note_occurency + "] " + tit); } else { Notifier not = new Notifier(desc, // Instantiate the Note type, tit, isDialog, timeout, inApp); not.Show(); // Show the note if (not.timeout_ms >= 500) // Start autoclose timer (if any) { not.timerResetEvent = new AutoResetEvent(false); BackgroundWorker timer = new BackgroundWorker(); timer.DoWork += timer_DoWork; timer.RunWorkerCompleted += timer_RunWorkerCompleted; timer.RunWorkerAsync(not); // Timer (temporary notes) } notes.Add(not); // Add to our collection of Notifiers updated_note_id = not.ID; } return(updated_note_id); // Return the current ID of the created/updated Note }
// Used to get a better MessageBox invocation style #region SIMPLE NOTE CREATION AND MODIFY // SIMPLE NOTES public static short Show(string desc, Type type = Type.INFO, string tit = "Notifier") { // If there is already a note with the same content, update it and do not create a new one short updated_note_id = 0, updated_note_occurency = 0; if (NotifierAlreadyPresent(desc, type, tit, out updated_note_id, out updated_note_occurency)) { ID = updated_note_id; Update(ID, desc, type, "[" + updated_note_occurency + "] " + tit); } else { // Instantiate the Notifier form Notifier not = new Notifier(desc, type, tit); not.Show(); // Add to our collection of Notifiers, cause "OpenForms" // is currently buggy Notifiers.Add(not); } // Return the current ID of the created Notifier return(ID); }