Пример #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string textBoxText = tbNote.Text; //Cant access tbNote in a thread. save the text in a variable instead
                string customMess  = "[CUSTOM USER INPUT]\r\n" + textBoxText + "\r\n\r\n---------------Default below--------------------\r\nOops! An error has occured. Here's the details:\r\n\r\n" + ex.ToString();

                if (ex is ReminderException)
                {
                    ReminderException theException = (ReminderException)ex;
                    if (theException.Reminder != null)
                    {
                        theException.Reminder.Note = "Removed for privacy reasons";
                        theException.Reminder.Name = "Removed for privacy reasons";

                        customMess += "\r\n\r\nThis exception is an ReminderException! Let's see if we can figure out what's wrong with it....\r\n";
                        customMess += "ID:    " + theException.Reminder.Id + "\r\n";
                        customMess += "Deleted:    " + theException.Reminder.Deleted + "\r\n";
                        customMess += "Date:  " + theException.Reminder.Date + "\r\n";
                        customMess += "RepeatType:    " + theException.Reminder.RepeatType + "\r\n";
                        customMess += "Enabled:   " + theException.Reminder.Enabled + "\r\n";
                        customMess += "DayOfMonth:    " + theException.Reminder.DayOfMonth + "\r\n";
                        customMess += "EveryXCustom:  " + theException.Reminder.EveryXCustom + "\r\n";
                        customMess += "RepeatDays:    " + theException.Reminder.RepeatDays + "\r\n";
                        customMess += "SoundFilePath: " + theException.Reminder.SoundFilePath + "\r\n";
                        customMess += "PostponeDate:  " + theException.Reminder.PostponeDate + "\r\n";
                        customMess += "Hide:  " + theException.Reminder.Hide + "\r\n";
                    }
                }
                RemindMeMessageFormManager.MakeMessagePopup("Feedback sent.\r\nThank you for taking the time!", 5);
                BLOnlineDatabase.AddException(ex, DateTime.UtcNow, BLIO.GetLogTxtPath());
                this.Dispose();
            }
            catch { }


            //Set this boolean to true so that when this popup closes, we won't try to send another e-mail
            sentCustomEmail = true;
        }
Пример #2
0
        private void PreviewReminder()
        {
            if (rem == null)
            {
                BLIO.Log("Reminder in PreviewReminder() is null. Interesting... ;)");
                RemindMeMessageFormManager.MakeMessagePopup("Could not preview that reminder. It doesn't exist anymore!", 4, "Error");
                return;
            }

            BLIO.Log("Previewing reminder with id " + rem.Id);
            Reminder previewRem = CopyReminder(rem);

            previewRem.Id = -1; //give the >temporary< reminder an invalid id, so that the real reminder won't be altered
            Popup p = new Popup(previewRem);

            p.Show();
            new Thread(() =>
            {
                //Log an entry to the database, for data!
                try
                {
                    try
                    {
                        BLOnlineDatabase.PreviewCount++;
                    }
                    catch (ArgumentException ex)
                    {
                        BLIO.Log("Exception at BLOnlineDatabase.PreviewCount++. -> " + ex.Message);
                        BLIO.WriteError(ex, ex.Message, true);
                    }
                }
                catch (ArgumentException ex)
                {
                    BLIO.Log("Exception at BLOnlineDatabase.PreviewCount++. -> " + ex.Message);
                    BLIO.WriteError(ex, ex.Message, true);
                }
            }).Start();
        }
Пример #3
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            BLIO.Log("(UCSupport)btnSend_Click");
            try
            {
                BLIO.Log("Attempting to send a message to the RemindMe developer..");

                //Don't do anything if there's no text
                if (string.IsNullOrWhiteSpace(tbNote.Text) || tbNote.Text == "Type your message here...")
                {
                    return;
                }

                //Don't do anything without internet
                if (!BLIO.HasInternetAccess())
                {
                    RemindMeMessageFormManager.MakeMessagePopup("You do not currently have an active internet connection", 3);
                    return;
                }

                string email   = tbEmail.Text;
                string subject = tbSubject.Text;
                string note    = tbNote.Text;

                BLOnlineDatabase.InsertEmailAttempt(BLLocalDatabase.Setting.Settings.UniqueString, note, subject, email);
                RemindMeMessageFormManager.MakeMessagePopup("Feedback Sent. Thank you!", 5);
                tbEmail.Text   = "";
                tbSubject.Text = "";
                tbNote.Text    = "";
                label3.Focus();
                BLIO.Log("Message sent!");
            }
            catch (Exception ex)
            {
                BLIO.Log("Error in UCSUpport.btnSend_Click. Could not send the message! Exception type: " + ex.GetType().ToString() + "   Stacktrace:\r\n" + ex.StackTrace);
                RemindMeMessageFormManager.MakeMessagePopup("Something went wrong. Could not send the e-mail", 3);
            }
        }
Пример #4
0
        private void btnAddFiles_Click(object sender, EventArgs e)
        {
            int           songsAdded = 0;
            List <string> songPaths  = FSManager.Files.GetSelectedFilesWithPath("", "*.mp3; *.wav;").ToList();

            if (songPaths.Count == 1 && songPaths[0] == "")//The user canceled out
            {
                return;
            }

            BLIO.Log("user selected " + songPaths.Count + " mp3 / wav files.");

            List <Songs> songs = new List <Songs>();

            foreach (string songPath in songPaths)
            {
                Songs song = new Songs();
                song.SongFileName = Path.GetFileName(songPath);
                song.SongFilePath = songPath;
                songs.Add(song);
            }
            BLSongs.InsertSongs(songs);
            BLIO.Log("Inserted " + songs.Count + " sound files into RemindMe");

            foreach (Songs song in songs)
            {
                if (!ListViewContains(song.SongFilePath))
                {
                    songsAdded++;
                    ListViewItem item = new ListViewItem(song.SongFilePath);
                    item.Tag = song.Id;
                    lvSoundFiles.Items.Add(item);
                }
            }
            RemindMeMessageFormManager.MakeMessagePopup(songsAdded + " Files added to RemindMe.", 4);

            LoadSongs();
        }
Пример #5
0
        private void DownloadMsi()
        {
            new Thread(() =>
            {
                try
                {
                    this.BeginInvoke((MethodInvoker)async delegate
                    {
                        try
                        {
                            BLIO.Log("New version on github! starting download...");
                            updater = new RemindMeUpdater();
                            updater.startDownload();

                            while (!updater.Completed)
                            {
                                await Task.Delay(500);
                            }

                            RemindMeMessageFormManager.MakeMessagePopup("RemindMe has a new version available to update!\r\nClick the update button on RemindMe on the left panel!", 10);

                            btnNewUpdate.Visible = true;
                            BLIO.Log("Completed downloading the new .msi from github!");
                        }
                        catch
                        {
                            BLIO.Log("Downloading new version of RemindMe failed! :(");
                        }
                    });
                }
                catch (Exception ex)
                {
                    BLIO.Log("Failed downloading MSI. " + ex.ToString());
                }
            }).Start();
        }
Пример #6
0
        private void Popup2_Load(object sender, EventArgs e)
        {
            try
            {
                BLIO.Log("Popup_load");
                AdvancedReminderProperties          avrProps = BLLocalDatabase.AVRProperty.GetAVRProperties(rem.Id);
                List <AdvancedReminderFilesFolders> avrFF    = BLLocalDatabase.AVRProperty.GetAVRFilesFolders(rem.Id);
                if (avrProps != null) //Not null? this reminder has advanced properties.
                {
                    BLIO.Log("Reminder " + rem.Id + " has advanced reminder properties!");
                    this.Visible = avrProps.ShowReminder == 1;

                    if (!string.IsNullOrWhiteSpace(avrProps.BatchScript))
                    {
                        if (!this.Visible)
                        {
                            RemindMeMessageFormManager.MakeMessagePopup("Activating script of Reminder:\r\n \"" + rem.Name + "\"", 3);
                        }

                        BLIO.ExecuteBatch(avrProps.BatchScript);
                    }
                }
                else
                {
                    BLIO.Log("Reminder " + rem.Id + " does not have advanced reminder properties");
                }

                if (avrFF != null && avrFF.Count > 0)
                {
                    //Go through each action, for example c:\test , delete. c:\sometest\testFile.txt , open
                    foreach (AdvancedReminderFilesFolders avr in avrFF)
                    {
                        if (avr.Action.ToString() == "Open")
                        {
                            BLIO.Log("Executing advanced reminder action \"Open\"");

                            if (File.Exists(avr.Path) || Directory.Exists(avr.Path))
                            {
                                System.Diagnostics.Process.Start(avr.Path);
                            }
                        }
                        else if (avr.Action.ToString() == "Delete")
                        {
                            BLIO.Log("Executing advanced reminder action \"Delete\"");

                            FileAttributes attr = File.GetAttributes(avr.Path);
                            //Check if it's a file or a directory
                            if (File.Exists(avr.Path))
                            {
                                File.Delete(avr.Path);
                            }
                            else if (Directory.Exists(avr.Path))
                            {
                                Directory.Delete(avr.Path, true);
                            }
                        }
                    }
                }

                if (this.Visible)
                {
                    tmrFadeIn.Start();
                }
                else
                {
                    btnOk_Click(sender, e);
                    return;
                }

                BLIO.Log("Attempting to parse date...");
                DateTime date = Convert.ToDateTime(rem.Date.Split(',')[0]);
                BLIO.Log("Date succesfully converted (" + date + ")");

                lblSmallDate.Text = date.ToShortDateString() + " " + date.ToShortTimeString();
                lblRepeat.Text    = BLReminder.GetRepeatTypeText(rem);

                if (!string.IsNullOrWhiteSpace(rem.PostponeDate))
                {
                    BLIO.Log("Reminder has a postpone date.");

                    pbDate.BackgroundImage = Properties.Resources.RemindMeZzz;
                    lblSmallDate.Text      = Convert.ToDateTime(rem.PostponeDate) + " (Postponed)";
                }

                //If some country has a longer date string, move the repeat icon/text more to the right so it doesnt overlap
                while (lblSmallDate.Bounds.IntersectsWith(pbRepeat.Bounds))
                {
                    pbRepeat.Location  = new Point(pbRepeat.Location.X + 5, pbRepeat.Location.Y);
                    lblRepeat.Location = new Point(lblRepeat.Location.X + 5, lblRepeat.Location.Y);
                }

                //Play the sound
                if (rem.SoundFilePath != null && rem.SoundFilePath != "")
                {
                    if (System.IO.File.Exists(rem.SoundFilePath))
                    {
                        BLIO.Log("SoundFilePath not null / empty and exists on the hard drive!");
                        myPlayer.URL = rem.SoundFilePath;
                        myPlayer.controls.play();
                        BLIO.Log("Playing sound");
                    }
                    else
                    {
                        BLIO.Log("SoundFilePath not null / empty but doesn't exist on the hard drive!");
                        RemindMeBox.Show("Could not play " + Path.GetFileNameWithoutExtension(rem.SoundFilePath) + " located at \"" + rem.SoundFilePath + "\" \r\nDid you move,rename or delete the file ?\r\nThe sound effect has been removed from this reminder. If you wish to re-add it, select it from the drop-down list.", RemindMeBoxReason.OK);
                        //make sure its removed from the reminder
                        rem.SoundFilePath = "";
                    }
                }

                FlashWindowHelper.Start(this);
                //this.MaximumSize = this.Size;

                if (BLLocalDatabase.Setting.IsAlwaysOnTop())
                {
                    this.TopMost  = true; //Popup will be always on top. no matter what you are doing, playing a game, watching a video, you will ALWAYS see the popup.
                    this.TopLevel = true;
                }
                else
                {
                    this.TopMost     = false;
                    this.WindowState = FormWindowState.Minimized;
                }


                lblTitle.Text = rem.Name;

                if (rem.Note != null)
                {
                    lblNoteText.Text = rem.Note.Replace("\\n", Environment.NewLine);
                }

                if (rem.Note == "")
                {
                    lblNoteText.Text = "( No text set )";
                }

                lblNoteText.Text = Environment.NewLine + lblNoteText.Text;



                if (rem.Date == null)
                {
                    rem.Date = DateTime.Now.ToString();
                }
            }
            catch (Exception ex)
            {
                ReminderException remEx = new ReminderException(BLReminder.ToString(rem), rem);
                remEx.StackTrace = ex.StackTrace; //Copy the stacktrace

                BLIO.WriteError(remEx, "Error loading reminder popup");
                BLIO.Log("Popup_load FAILED. Exception -> " + ex.Message);
            }
        }
Пример #7
0
 private void bunifuFlatButton2_Click(object sender, EventArgs e)
 {
     RemindMeMessageFormManager.MakeMessagePopup("This is a test.", 4);
 }
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     BLIO.Log("[AVR] Saving & hiding AVR form");
     RemindMeMessageFormManager.MakeMessagePopup("Advanced settings applied to this reminder!", 5);
     Hide();
 }
Пример #9
0
        public void Initialize()
        {
            try
            {
                List <Reminder> corruptedReminders = BLReminder.CheckForCorruptedReminders();

                if (corruptedReminders != null)
                {
                    string message = "RemindMe has detected";
                    if (corruptedReminders.Count > 1)
                    {
                        message += " problems with the following reminders: \r\n";

                        foreach (Reminder rem in corruptedReminders)
                        {
                            message += "- " + rem.Name + "\r\n";
                        }

                        message += "\r\nThey have been removed from your list of reminders.";
                    }
                    else
                    {
                        message += " a problem with the reminder:\r\n\"" + corruptedReminders[0].Name + "\". \r\nIt has been removed from your list of reminders.";
                    }

                    RemindMeMessageFormManager.MakeMessagePopup(message, 0);
                }

                BLIO.Log("Loading reminders from database");
                //Give initial value to newReminderUc
                newReminderUc           = new UCNewReminder(this);
                newReminderUc.Visible   = false;
                newReminderUc.saveState = false;
                this.Parent.Controls.Add(newReminderUc);


                Form1.Instance.ucNewReminder = newReminderUc;
                //BLFormLogic.AddRemindersToListview(lvReminders, BLReminder.GetReminders().Where(r => r.Hide == 0).ToList()); //Get all "active" reminders);

                BLIO.Log("Starting the reminder timer");
                tmrCheckReminder.Start();

                pnlReminders.Visible = true;

                pnlReminders.DragDrop  += UCReminders_DragDrop;
                pnlReminders.DragEnter += UCReminders_DragEnter;


                int             counter           = 0;
                List <Reminder> activeReminders   = BLReminder.GetReminders().Where(r => r.Hide == 0).OrderBy(r => Convert.ToDateTime(r.Date.Split(',')[0])).Where(r => r.Enabled == 1).ToList();
                List <Reminder> disabledReminders = BLReminder.GetReminders().Where(r => r.Hide == 0).OrderBy(r => Convert.ToDateTime(r.Date.Split(',')[0])).Where(r => r.Enabled == 0).ToList();

                foreach (Reminder rem in activeReminders)
                {
                    if (pnlReminders.Controls.Count >= 7)
                    {
                        break;                                   //Only 7 reminders on 1 page
                    }
                    pnlReminders.Controls.Add(new UCReminderItem(rem));

                    if (counter > 0)
                    {
                        pnlReminders.Controls[counter].Location = new Point(0, pnlReminders.Controls[counter - 1].Location.Y + pnlReminders.Controls[counter - 1].Size.Height);
                    }

                    counter++;
                }

                foreach (Reminder rem in disabledReminders)
                {
                    if (pnlReminders.Controls.Count >= 7)
                    {
                        break;
                    }

                    pnlReminders.Controls.Add(new UCReminderItem(rem));

                    if (counter > 0)
                    {
                        pnlReminders.Controls[counter].Location = new Point(0, pnlReminders.Controls[counter - 1].Location.Y + pnlReminders.Controls[counter - 1].Size.Height);
                    }

                    counter++;
                }

                if (activeReminders.Count + disabledReminders.Count < 7) //Less than 7 reminders, let's fit in some empty UCReminderItem 's
                {
                    for (int i = (activeReminders.Count + disabledReminders.Count); i < 7; i++)
                    {
                        pnlReminders.Controls.Add(new UCReminderItem(null));

                        if (counter > 0)
                        {
                            pnlReminders.Controls[counter].Location = new Point(0, pnlReminders.Controls[counter - 1].Location.Y + pnlReminders.Controls[counter - 1].Size.Height);
                        }

                        counter++;
                    }
                }

                if (BLReminder.GetReminders().Where(r => r.Hide == 0).ToList().Count <= 7)
                {
                    Form1.Instance.UpdatePageNumber(-1); //Tell form1 that there are not more than 1 pages
                }
                else
                {
                    btnNextPage.Iconimage = Properties.Resources.NextWhite;
                    Form1.Instance.UpdatePageNumber(pageNumber);
                }
            }
            catch (Exception ex)
            {
                BLIO.Log("UCReminders.Initialize() FAILED. Type -> " + ex.GetType().ToString());
                BLIO.Log("Message -> " + ex.Message);
            }
        }
Пример #10
0
        private void tmrCheckReminder_Tick(object sender, EventArgs e)
        {
            try
            {
                if (BLReminder.GetReminders().Where(r => r.Enabled == 1).ToList().Count <= 0)
                {
                    tmrCheckReminder.Stop(); //No existing reminders? no enabled reminders? stop timer.
                    BLIO.Log("Stopping the reminder checking timer, because there are no more (enabled) reminders");
                    return;
                }

                //If a day has passed since the start of RemindMe, we may want to refresh the listview.
                //There might be reminders happening on this day, if so, we show the time of the reminder, instead of the day
                if (dayOfStartRemindMe < DateTime.Now.Day)
                {
                    BLIO.Log("Dawn of a new day -24 hours remaining- ");
                    UpdateCurrentPage();
                    dayOfStartRemindMe = DateTime.Now.Day;
                    RemindMeMessageFormManager.MakeTodaysRemindersPopup();
                    //Update lastOnline. If you keep RemindMe running and put your pc to sleep instead of turning it off, it would never get updated without this
                    BLOnlineDatabase.InsertOrUpdateUser(BLLocalDatabase.Setting.Settings.UniqueString);
                }


                //We will check for reminders here every 5 seconds.
                foreach (Reminder rem in BLReminder.GetReminders())
                {
                    //Create the popup. Do the other stuff afterwards.
                    if ((rem.PostponeDate != null && Convert.ToDateTime(rem.PostponeDate) <= DateTime.Now && rem.Enabled == 1) || (Convert.ToDateTime(rem.Date.Split(',')[0]) <= DateTime.Now && rem.PostponeDate == null && rem.Enabled == 1))
                    {
                        //temporarily disable it. When the user postpones the reminder, it will be re-enabled.
                        rem.Enabled = 0;
                        BLReminder.EditReminder(rem);
                        MakeReminderPopup(rem);
                        UpdateCurrentPage();
                    }
                    else
                    {
                        // -- In this part we will create popups at the users right bottom corner of the screen saying x reminder is happening in 1 hour or x minutes -- \\
                        if (BLLocalDatabase.Setting.IsHourBeforeNotificationEnabled() && rem.Enabled == 1)
                        {
                            DateTime theDateToCheckOn; //Like this we dont need an if ánd an else with the same code
                            if (rem.PostponeDate != null)
                            {
                                theDateToCheckOn = Convert.ToDateTime(rem.PostponeDate);
                            }
                            else
                            {
                                theDateToCheckOn = Convert.ToDateTime(rem.Date.Split(',')[0]);
                            }


                            //The timespan between the date and now.
                            TimeSpan timeSpan = Convert.ToDateTime(theDateToCheckOn) - DateTime.Now;
                            if (timeSpan.TotalMinutes >= 59.50 && timeSpan.TotalMinutes <= 60)
                            {
                                remindersToHappenInAnHour.Add(rem);
                            }
                        }
                    }
                }


                string message = "You have " + remindersToHappenInAnHour.Count + " reminders set in 60 minutes:\r\n";
                int    count   = 1;
                foreach (Reminder rem in remindersToHappenInAnHour)
                {
                    //Don't show "reminderName in 60 minutes!" if the reminder doesn't "Show" when popped up, silent reminders.
                    if (BLLocalDatabase.AVRProperty.GetAVRProperties(rem.Id) != null && BLLocalDatabase.AVRProperty.GetAVRProperties(rem.Id).ShowReminder != 1)
                    {
                        continue;
                    }

                    if (remindersToHappenInAnHour.Count > 1)
                    {
                        message += count + ") " + rem.Name + Environment.NewLine;
                    }
                    else
                    {
                        message = rem.Name + " in 60 minutes!";
                    }

                    count++;
                }

                if (remindersToHappenInAnHour.Count > 1 && count > 1) //cut off the last \n
                {
                    message = message.Remove(message.Length - 2, 2);

                    if (!popupMessages.Contains(message)) //Don't create this popup if we have already created it once before
                    {
                        RemindMeMessageFormManager.MakeMessagePopup(message, 6);
                    }

                    popupMessages.Add(message);
                }
                else if (remindersToHappenInAnHour.Count > 0 && count > 1)
                {
                    if (!popupMessages.Contains(message)) //Don't create this popup if we have already created it once before
                    {
                        RemindMeMessageFormManager.MakeMessagePopup(message, 6, remindersToHappenInAnHour[0]);
                    }

                    popupMessages.Add(message);
                }

                remindersToHappenInAnHour.Clear();
            }
            catch (Exception ex)
            {
                BLIO.Log("CheckReminder FAILED!!! " + ex.GetType().ToString());
                BLIO.WriteError(ex, "!!! Error in tmrCheckReminder_Tick");
            }
        }