Ejemplo n.º 1
0
        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");
            }
        }
Ejemplo n.º 2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                BLIO.Log("btnOk pressed on ExceptionPopup. textbox text = " + tbFeedback.Text);
                string logTxtPath  = IOVariables.systemLog;
                string textBoxText = tbFeedback.Text; //Cant access tbNote in a thread. save the text in a variable instead

                if (string.IsNullOrWhiteSpace(textBoxText) || tbFeedback.ForeColor == Color.Gray)
                {
                    textBoxText = null;
                }

                BLOnlineDatabase.AddException(exception, DateTime.UtcNow, logTxtPath, textBoxText);

                if (textBoxText != null && tbFeedback.ForeColor != Color.Gray)
                {
                    RemindMeMessageFormManager.MakeMessagePopup("Feedback sent.\r\nThank you for taking the time!", 5);
                }

                //Set this boolean to true so that when this popup closes, we won't try to add another db entry
                customFeedback = true;
                btnOk.Enabled  = false;

                this.Close();
                this.Dispose();
            }
            catch { }
        }
Ejemplo n.º 3
0
        /*This was testing a custom color scheme
         * private void SetColorScheme()
         * {
         *
         *  string t = BLSettings.Settings.RemindMeTheme;
         *  RemindMeColorScheme colorTheme = BLSettings.GetColorTheme(BLSettings.Settings.RemindMeTheme);
         *  BLIO.Log("Setting RemindMe Color scheme \"" + BLSettings.Settings.RemindMeTheme + "\"");
         *  pnlSide.GradientBottomLeft = Color.FromArgb(Convert.ToInt16(colorTheme.PrimaryBottomLeft.Split(',')[0]), Convert.ToInt16(colorTheme.PrimaryBottomLeft.Split(',')[1]), Convert.ToInt16(colorTheme.PrimaryBottomLeft.Split(',')[2]));
         *  pnlSide.GradientBottomRight = Color.FromArgb(Convert.ToInt16(colorTheme.PrimaryBottomRight.Split(',')[0]), Convert.ToInt16(colorTheme.PrimaryBottomRight.Split(',')[1]), Convert.ToInt16(colorTheme.PrimaryBottomRight.Split(',')[2]));
         *  pnlSide.GradientTopLeft = Color.FromArgb(Convert.ToInt16(colorTheme.PrimaryTopLeft.Split(',')[0]), Convert.ToInt16(colorTheme.PrimaryTopLeft.Split(',')[1]), Convert.ToInt16(colorTheme.PrimaryTopLeft.Split(',')[2]));
         *  pnlSide.GradientTopRight = Color.FromArgb(Convert.ToInt16(colorTheme.PrimaryTopRight.Split(',')[0]), Convert.ToInt16(colorTheme.PrimaryTopRight.Split(',')[1]), Convert.ToInt16(colorTheme.PrimaryTopRight.Split(',')[2]));
         *
         *
         *  pnlMain.GradientBottomLeft = Color.FromArgb(Convert.ToInt16(colorTheme.SecondaryBottomLeft.Split(',')[0]), Convert.ToInt16(colorTheme.SecondaryBottomLeft.Split(',')[1]), Convert.ToInt16(colorTheme.SecondaryBottomLeft.Split(',')[2]));
         *  pnlMain.GradientBottomRight = Color.FromArgb(Convert.ToInt16(colorTheme.SecondaryBottomRight.Split(',')[0]), Convert.ToInt16(colorTheme.SecondaryBottomRight.Split(',')[1]), Convert.ToInt16(colorTheme.SecondaryBottomRight.Split(',')[2]));
         *  pnlMain.GradientTopLeft = Color.FromArgb(Convert.ToInt16(colorTheme.SecondaryTopLeft.Split(',')[0]), Convert.ToInt16(colorTheme.SecondaryTopLeft.Split(',')[1]), Convert.ToInt16(colorTheme.SecondaryTopLeft.Split(',')[2]));
         *  pnlMain.GradientTopRight = Color.FromArgb(Convert.ToInt16(colorTheme.SecondaryTopRight.Split(',')[0]), Convert.ToInt16(colorTheme.SecondaryTopRight.Split(',')[1]), Convert.ToInt16(colorTheme.SecondaryTopRight.Split(',')[2]));
         * }*/

        protected override void WndProc(ref Message m)
        {
            //This message will be sent when the RemindMeImporter imports reminders.
            if (m.Msg == WM_RELOAD_REMINDERS)
            {
                BLIO.Log("Reloading reminders after import from .remindme file");
                int currentReminderCount = BLReminder.GetReminders().Count;

                BLReminder.NotifyChange();

                if (UCReminders.Instance != null)
                {
                    UCReminders.Instance.UpdateCurrentPage();
                }

                if (!this.Visible) //don't make this message if RemindMe is visible, the user will see the changes if it is visible.
                {
                    RemindMeMessageFormManager.MakeMessagePopup(BLReminder.GetReminders().Count - currentReminderCount + " Reminder(s) succesfully imported!", 3);
                    BLIO.Log("Created reminders succesfully imported message popup (WndProc)");
                }

                if ((BLReminder.GetReminders().Count - currentReminderCount) > 0)
                {
                    new Thread(() =>
                    {
                        //Log an entry to the database, for data!
                        BLOnlineDatabase.ImportCount++;
                    }).Start();
                }
            }

            base.WndProc(ref m);
        }
Ejemplo n.º 4
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            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))
                {
                    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(File.ReadAllText(IOVariables.uniqueString), note, subject, email);
                RemindMeMessageFormManager.MakeMessagePopup("Feedback Sent. Thank you!", 5);
                tbEmail.Text   = "";
                tbSubject.Text = "";
                tbNote.Text    = "";
                BLIO.Log("Message sent!");
            }
            catch
            {
                RemindMeMessageFormManager.MakeMessagePopup("Something went wrong. Could not send the e-mail", 3);
            }
        }
Ejemplo n.º 5
0
        private void tmrFadeout_Tick(object sender, EventArgs e)
        {
            if (this.Bounds.Contains(MousePosition)) //Cursor in the message? reset opacity to 1 and restart timeout timer
            {
                this.Opacity  = 1;
                secondsPassed = 0;

                if (!disableFadeout)
                {
                    tmrTimeout.Start();
                }
            }
            else //Cursor out of the message? safely reduce opacity "slowly"
            {
                this.Opacity -= 0.02;
                if (this.Opacity <= 0)
                {
                    tmrFadeout.Stop();

                    tmrFadein.Dispose();
                    tmrFadeout.Dispose();
                    tmrTimeout.Dispose();
                    BLIO.Log("Message form (" + lblText.Text + ") disposed.");
                    this.Dispose();
                    RemindMeMessageFormManager.RepositionActivePopups();
                }
            }
        }
Ejemplo n.º 6
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            BLIO.Log("(UCSupport)bunifuFlatButton1_Click [btnView]");
            if (lvMessages.SelectedItems.Count > 0)
            {
                ListViewItem itm = lvMessages.SelectedItems[0];

                RemindMeMessages mess = BLOnlineDatabase.GetRemindMeMessageById(Convert.ToInt32(itm.Tag));
                if (mess == null)
                {
                    RemindMeMessageFormManager.MakeMessagePopup("Could not show this message. It does not exist anymore", 4);
                    lvMessages.Items.Remove(itm);
                    BLLocalDatabase.ReadMessage.DeleteMessage(Convert.ToInt32(itm.Tag));
                    return; //Doesn't exist in the database anymore
                }

                if (mess.NotificationType == "REMINDMEBOX")
                {
                    BLIO.Log("Attempting to show the user a RemindMe message(REMINDMEBOX)...");
                    RemindMeBox.Show("A Message from the creator of RemindMe", mess.Message.Replace("¤", Environment.NewLine), RemindMeBoxReason.OK);
                }
                else if (mess.NotificationType == "REMINDMEMESSAGEFORM")
                {
                    BLIO.Log("Attempting to show the user a RemindMe message(REMINDMEMESSAGEFORM)...");
                    RemindMeMessageFormManager.MakeMessagePopup(mess.Message.Replace("¤", Environment.NewLine), mess.NotificationDuration.Value);
                }
                else
                {
                    BLIO.Log("Attempting to show the user a RemindMe message FAILED. Notificationtype=" + mess.NotificationType + "  Message=" + mess.Message + "  Id=" + mess.Id);
                    RemindMeMessageFormManager.MakeMessagePopup("Could not preview this message. Unknown notification type", 4);
                    lvMessages.Items.Remove(itm);
                    BLLocalDatabase.ReadMessage.DeleteMessage(mess.Id);
                }
            }
        }
Ejemplo n.º 7
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            BLPopupDimensions.ResetToDefaults();
            RemindMeMessageFormManager.MakeMessagePopup("Succesfully reset settings.", 4);

            FillValues();
            ApplyPreviewChanges();
        }
Ejemplo n.º 8
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            BLIO.Log("(UCResizePopup)btnReset_Click");
            BLLocalDatabase.PopupDimension.ResetToDefaults();
            RemindMeMessageFormManager.MakeMessagePopup("Succesfully reset settings.", 4);

            FillValues();
            ApplyPreviewChanges();
        }
Ejemplo n.º 9
0
        private bool Exportreminders()
        {
            if (GetSelectedRemindersFromListview().Count > 0)
            {
                string selectedPath = FSManager.Folders.GetSelectedFolderPath();

                if (selectedPath != null)
                {
                    BLIO.Log("User selected a valid path");

                    Exception possibleException = BLReminder.ExportReminders(GetSelectedRemindersFromListview(), selectedPath);
                    if (possibleException == null)
                    {
                        BLIO.Log("No problems encountered (exception null)");
                        SetStatusTexts(GetSelectedRemindersFromListview().Count, BLReminder.GetReminders().Count);
                    }
                    else if (possibleException is UnauthorizedAccessException)
                    {
                        BLIO.Log("Problem encountered: Unauthorized");
                        if (RemindMeBox.Show("Could not save reminders to \"" + selectedPath + "\"\r\nDo you wish to place them on your desktop instead?", RemindMeBoxReason.YesNo) == DialogResult.Yes)
                        {
                            BLIO.Log("Trying to save to desktop instead...");
                            possibleException = BLReminder.ExportReminders(GetSelectedRemindersFromListview(), Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
                            if (possibleException != null)
                            {//Did saving to desktop go wrong, too?? just show a message
                                BLIO.Log("Trying to save to desktop didnt work either");
                                RemindMeBox.Show("Something went wrong. Could not save the reminders to your desktop.", RemindMeBoxReason.OK);
                                return(false);
                            }
                            else
                            {//Saving to desktop did not throw an exception
                                BLIO.Log("Saved to desktop");
                                SetStatusTexts(GetSelectedRemindersFromListview().Count, BLReminder.GetReminders().Count);
                            }
                        }
                    }
                    else
                    {
                        RemindMeMessageFormManager.MakeMessagePopup("Backup failed.", 6);
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                RemindMeMessageFormManager.MakeMessagePopup("Please select one or more reminder(s)", 6);
            }
            return(true);
        }
Ejemplo n.º 10
0
        private void SetStatusTexts(int completedReminders, int totalReminders)
        {
            foreach (ListViewItem item in lvReminders.CheckedItems)
            {
                lvReminders.Items.Remove(item);
            }

            if (completedReminders > 0)
            {
                RemindMeMessageFormManager.MakeMessagePopup("Succesfully " + this.transferType.ToString().ToLower() + "ed " + completedReminders + " reminders.", 4);
            }
        }
Ejemplo n.º 11
0
        private void btnNewUpdate_Click(object sender, EventArgs e)
        {
            string allowUpdate = "";

            try
            {
                if (UCTimer.RunningTimers.Count > 0 && !this.Visible)
                {
                    if (RemindMeBox.Show("You have (" + UCTimer.RunningTimers.Count + ") active timers running.\r\n\r\nAre you sure you wish to update and close RemindMe? These timers will not be saved", RemindMeBoxReason.YesNo) == DialogResult.Yes)
                    {
                        allowUpdate = "Y";
                    }
                    else
                    {
                        allowUpdate = "N";
                    }
                }
                else
                {
                    if (allowUpdate == "" || allowUpdate == "Y")
                    {
                        //make sure the popup wont happen when remindme gets closed by Application.Exit()
                        UCTimer.RunningTimers.Clear();


                        BLIO.Log("Installing the new version from github!");

                        if (!File.Exists(IOVariables.rootFolder + "SetupRemindMe.msi"))
                        {
                            RemindMeBox.Show("Could not update RemindMe. Please try again later");
                            BLIO.Log("SetupRemindMe.msi was not found on the hard drive.. hmmmmm... suspicious.... ;)");
                            return;
                        }


                        ProcessStartInfo info = new ProcessStartInfo(IOVariables.rootFolder + "install.bat");
                        info.Verb = "runas";

                        Process process = new Process();
                        process.StartInfo = info;
                        process.Start();

                        Application.Exit();
                    }
                }
            }
            catch
            {
                RemindMeMessageFormManager.MakeMessagePopup("Cancelled installation.", 2);
                BLIO.Log("Cancelled installation.");
            }
        }
Ejemplo n.º 12
0
        private void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            string text = RemindMePrompt.ShowText("Enter a message");

            if (!string.IsNullOrWhiteSpace(text))
            {
                RemindMeMessageFormManager.MakeMessagePopup(text, 11);
            }
            else
            {
                RemindMeMessageFormManager.MakeMessagePopup("This is a test.", 4);
            }
        }
Ejemplo n.º 13
0
 private void tmrCheckForUpdates_Tick(object sender, EventArgs e)
 {
     try
     {
         if (showUpdateMessage && Directory.Exists(IOVariables.applicationFilesFolder + "\\old") && Directory.GetFiles(IOVariables.applicationFilesFolder + "\\old").Count() > 0)
         {
             RemindMeMessageFormManager.MakeMessagePopup("RemindMe has updated.\r\nRestart RemindMe to load these changes directly.", 15);
             tmrCheckForUpdates.Stop();
         }
     }
     catch (Exception ex)
     {
         BLIO.Log("CheckForUpdates FAILED. " + ex.GetType().ToString());
         BLIO.WriteError(ex, "Error in tmrCheckForUpdates_Tick");
     }
 }
Ejemplo n.º 14
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            BLIO.Log("(UCSound)btnPreview_Click");
            if (lvSoundFiles.SelectedItems.Count == 1)
            {
                Songs selectedSong = BLLocalDatabase.Song.GetSongById((long)lvSoundFiles.SelectedItems[0].Tag);
                BLIO.Log("Attempting to preview sound file with id " + selectedSong.Id);

                if (btnPreview.Iconimage == imgPlay)
                {
                    if (System.IO.File.Exists(selectedSong.SongFilePath))
                    {
                        BLIO.Log("Sound file exists on the hard drive");
                        btnPreview.Iconimage = imgStop;

                        myPlayer.URL = selectedSong.SongFilePath;
                        mediaInfo    = myPlayer.newMedia(myPlayer.URL);

                        //Start the timer. the timer ticks when the song ends. The timer will then reset the picture of the play button
                        if (mediaInfo.duration > 0)
                        {
                            tmrMusic.Interval = (int)(mediaInfo.duration * 1000);
                        }
                        else
                        {
                            tmrMusic.Interval = 1000;
                        }
                        tmrMusic.Start();


                        myPlayer.controls.play();
                        BLIO.Log("Playing sound.");
                    }
                    else
                    {
                        RemindMeMessageFormManager.MakeMessagePopup("Could not preview the selected song. Does it still exist?", 4);
                    }
                }
                else
                {
                    BLIO.Log("Stopping sound");
                    btnPreview.Iconimage = imgPlay;
                    myPlayer.controls.stop();
                    tmrMusic.Stop();
                }
            }
        }
Ejemplo n.º 15
0
        private void btnAddFiles_Click(object sender, EventArgs e)
        {
            BLIO.Log("(UCSound)btnAddFiles_Click");
            int           songsAdded = 0;
            List <string> songPaths  = FSManager.Files.GetSelectedFilesWithPath("Sound files", "*.mp3; *.wav; *.ogg; *.3gp; *.aac; *.flac; *.webm; *.aiff; *.wma; *.alac;").ToList();

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

            BLIO.Log("user selected " + songPaths.Count + " sound files.");



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

            foreach (string songPath in songPaths)
            {
                myPlayer.URL = songPath;
                mediaInfo    = myPlayer.newMedia(myPlayer.URL);
                myPlayer.controls.play();
                myPlayer.controls.stop();

                Songs song = new Songs();
                song.SongFileName = Path.GetFileName(songPath);
                song.SongFilePath = songPath;
                songs.Add(song);
            }
            BLLocalDatabase.Song.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);
            Form1.Instance.ucSettings.FillSoundCombobox();
            LoadSongs();
        }
Ejemplo n.º 16
0
        private void PopupRemindMeMessage(RemindMeMessages mess)
        {
            //Update the counter on the message
            BLIO.Log("Attempting to update an message with id " + mess.Id);
            BLOnlineDatabase.UpdateRemindMeMessageCount(mess.Id);

            switch (mess.NotificationType)
            {
            case "REMINDMEBOX":
                RemindMeBox.Show("RemindMe Developer", "This is a message from the developer of RemindMe.\r\n\r\n" + mess.Message.Replace("¤", Environment.NewLine), RemindMeBoxReason.OK);
                break;

            case "REMINDMEMESSAGEFORM":
                RemindMeMessageFormManager.MakeMessagePopup(mess.Message.Replace("¤", Environment.NewLine), mess.NotificationDuration.Value, "RemindMe Developer");
                break;
            }
        }
Ejemplo n.º 17
0
        private void btnRemoveFiles_Click(object sender, EventArgs e)
        {
            List <Songs> toRemoveSongs = new List <Songs>();

            foreach (ListViewItem selectedItem in lvSoundFiles.SelectedItems)
            {
                toRemoveSongs.Add(BLSongs.GetSongById(Convert.ToInt32(selectedItem.Tag)));
                lvSoundFiles.Items.Remove(selectedItem);
            }

            BLSongs.RemoveSongs(toRemoveSongs);

            if (toRemoveSongs.Count > 0)
            {
                RemindMeMessageFormManager.MakeMessagePopup(toRemoveSongs.Count + " Files removed from RemindMe.", 4);
            }
        }
Ejemplo n.º 18
0
        private void btnRemoveFiles_Click(object sender, EventArgs e)
        {
            BLIO.Log("(UCSound)btnRemoveFiles_Click");
            List <Songs> toRemoveSongs = new List <Songs>();

            foreach (ListViewItem selectedItem in lvSoundFiles.SelectedItems)
            {
                toRemoveSongs.Add(BLLocalDatabase.Song.GetSongById(Convert.ToInt32(selectedItem.Tag)));
                lvSoundFiles.Items.Remove(selectedItem);
            }

            BLLocalDatabase.Song.RemoveSongs(toRemoveSongs);

            if (toRemoveSongs.Count > 0)
            {
                RemindMeMessageFormManager.MakeMessagePopup(toRemoveSongs.Count + " Files removed from RemindMe.", 4);
                Form1.Instance.ucSettings.FillSoundCombobox();
            }
        }
Ejemplo n.º 19
0
        private void SaveChanges()
        {
            try
            {
                PopupDimensions dimension = new PopupDimensions();
                dimension.FontNoteSize  = (long)trbNoteFont.Value;
                dimension.FontTitleSize = (long)trbTitleFont.Value;
                dimension.FormWidth     = (long)trbWidth.Value;
                dimension.FormHeight    = (long)trbHeight.Value;
                BLLocalDatabase.PopupDimension.UpdatePopupDimensions(dimension);


                RemindMeMessageFormManager.MakeMessagePopup("Succesfully changed settings.", 4);
            }
            catch
            {
                RemindMeMessageFormManager.MakeMessagePopup("Changing settings failed", 4);
            }
        }
Ejemplo n.º 20
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            BLIO.Log("Import button pressed. Loading reminders into listview");
            remindersFromRemindMeFile.Clear();
            ToggleButton(sender);
            lvReminders.Items.Clear();

            string remindmeFile = FSManager.Files.GetSelectedFileWithPath("RemindMe backup file", "*.remindme");

            if (remindmeFile == null || remindmeFile == "")
            {//user pressed cancel
                btnImport.selected = false;
                return;
            }
            BLIO.Log("Valid .remindme file selected");

            try
            {
                List <object> toImportReminders = BLReminder.DeserializeRemindersFromFile(remindmeFile).Cast <object>().ToList();


                if (toImportReminders != null)
                {
                    BLIO.Log(toImportReminders.Count - 1 + " reminders in this .remindme file");
                    transferType = ReminderTransferType.IMPORT;

                    foreach (object rem in toImportReminders)
                    {
                        if (rem.GetType() == typeof(Reminder))
                        {
                            BLFormLogic.AddReminderToListview(lvReminders, (Reminder)rem);
                            remindersFromRemindMeFile.Add((Reminder)rem);
                        }
                    }
                }
            }
            catch
            {
                RemindMeMessageFormManager.MakeMessagePopup("Error loading reminder(s)", 6);
            }
        }
Ejemplo n.º 21
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;
        }
Ejemplo n.º 22
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();
        }
Ejemplo n.º 23
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();
        }
Ejemplo n.º 24
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);
            }
        }
Ejemplo n.º 25
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();
        }
Ejemplo n.º 26
0
 private void lblExit_Click(object sender, EventArgs e)
 {
     this.Dispose();
     RemindMeMessageFormManager.RepositionActivePopups();
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Alternative Form_load method since form_load doesnt get called until you first double-click the RemindMe icon due to override SetVisibleCore
        /// </summary>
        private void FormLoad()
        {
            try
            {
                BLIO.Log("RemindMe_Load");
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();


                lblVersion.Text   = "Version " + IOVariables.RemindMeVersion;
                RemindMeIcon.Text = "RemindMe " + IOVariables.RemindMeVersion;

                if (Path.GetDirectoryName(Application.ExecutablePath).EndsWith("\\Debug"))
                {
                    lblVersion.Text += " - DEV BUILD";
                }

                //set unique user string
                BLIO.WriteUniqueString();

                //Default view should be reminders
                pnlMain.Controls.Add(ucReminders);

                RemindMeMessageFormManager.MakeTodaysRemindersPopup();
                BLIO.Log("Today's reminders popup created");

                //Create an shortcut in the windows startup folder if it doesn't already exist
                if (!System.IO.File.Exists(IOVariables.startupFolderPath + "\\RemindMe" + ".lnk"))
                {
                    FSManager.Shortcuts.CreateShortcut(IOVariables.startupFolderPath, "RemindMe", System.Windows.Forms.Application.StartupPath + "\\" + "RemindMe.exe", "Shortcut of RemindMe");
                }
                else
                {
                    WshShell     shell = new WshShell();                                                                       //Create a new WshShell Interface
                    IWshShortcut link  = (IWshShortcut)shell.CreateShortcut(IOVariables.startupFolderPath + "\\RemindMe.lnk"); //Link the interface to our shortcut

                    //shortcut does exist, let's see if the target of that shortcut isn't the old RemindMe in the programs files
                    if (link.TargetPath.ToString().Contains("StefanGansevlesPrograms") || link.TargetPath.ToString().Contains("Program Files"))
                    {
                        BLIO.Log("Deleting old .lnk shortcut of RemindMe");
                        System.IO.File.Delete(IOVariables.startupFolderPath + "\\RemindMe.lnk");
                        FSManager.Shortcuts.CreateShortcut(IOVariables.startupFolderPath, "RemindMe", IOVariables.applicationFilesFolder + "RemindMe.exe", "Shortcut of RemindMe");
                    }
                }


                if (Debugger.IsAttached) //Debugging ? show extra option
                {
                    btnDebugMode.Visible = true;
                }


                BLLocalDatabase.Song.InsertWindowsSystemSounds();

                tmrUpdateRemindMe.Start();

                //If the setup still exists, delete it
                System.IO.File.Delete(IOVariables.rootFolder + "SetupRemindMe.msi");

                Settings set = BLLocalDatabase.Setting.Settings;
                //Call the timer once
                Thread tr = new Thread(() =>
                {
                    //wait a bit, then call the update timer once. It then runs every 5 minutes
                    Thread.Sleep(5000);
                    tmrUpdateRemindMe_Tick(null, null);
                    BLOnlineDatabase.InsertOrUpdateUser(set.UniqueString);

                    if (set.LastVersion == null)
                    {
                        set.LastVersion = IOVariables.RemindMeVersion;
                    }

                    BLLocalDatabase.Setting.UpdateSettings(set);
                });
                tr.Start();


                this.Opacity       = 0;
                this.ShowInTaskbar = true;
                this.Show();
                tmrInitialHide.Start();

                Random r = new Random();
                tmrCheckRemindMeMessages.Interval = (r.Next(60, 300)) * 1000; //Random interval between 1 and 5 minutes
                tmrCheckRemindMeMessages.Start();
                BLIO.Log("tmrCheckRemindMeMessages.Interval = " + tmrCheckRemindMeMessages.Interval / 1000 + " seconds.");


                stopwatch.Stop();
                BLIO.Log("formLoad() took " + stopwatch.ElapsedMilliseconds + " ms");

                BLIO.Log("RemindMe loaded");
            }
            catch (Exception ex)
            {
                BLIO.Log("Exception in formLoadAsync() -> " + ex.GetType().ToString());
                BLOnlineDatabase.AddException(ex, DateTime.Now, IOVariables.systemLog);
            }
        }
Ejemplo n.º 28
0
 private void bunifuFlatButton2_Click(object sender, EventArgs e)
 {
     RemindMeMessageFormManager.MakeMessagePopup("This is a test.", 4);
 }
Ejemplo n.º 29
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);
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Alternative Form_load method since form_load doesnt get called until you first double-click the RemindMe icon due to override SetVisibleCore
        /// </summary>
        private async Task formLoadAsync()
        {
            BLIO.Log("RemindMe_Load");

            BLIO.WriteUpdateBatch(Application.StartupPath);

            lblVersion.Text = "Version " + IOVariables.RemindMeVersion;

            Settings set = BLSettings.Settings;

            //set unique user string
            if (string.IsNullOrWhiteSpace(set.UniqueString))
            {
                if (File.Exists(IOVariables.uniqueString))
                {
                    set.UniqueString = File.ReadAllText(IOVariables.uniqueString);
                    BLSettings.UpdateSettings(set);
                }

                File.Delete(IOVariables.uniqueString);
            }
            BLIO.WriteUniqueString();

            if (set.LastVersion != null && (new Version(set.LastVersion) < new Version(IOVariables.RemindMeVersion)))
            {
                BLIO.Log("[VERSION CHECK] New version! last version: " + set.LastVersion + "  New version: " + IOVariables.RemindMeVersion);
                //User has a new RemindMe version!
                string releaseNotesString = "";

                foreach (KeyValuePair <string, string> entry in UpdateInformation.ReleaseNotes)
                {
                    if (new Version(entry.Key) > new Version(set.LastVersion))
                    {
                        releaseNotesString += "Version " + entry.Key + "\r\n" + entry.Value + "\r\n\r\n\r\n";
                    }
                }
                WhatsNew wn = new WhatsNew(set.LastVersion, releaseNotesString);
                wn.Show();


                //Before updating the lastVersion, log the update in the db
                BLOnlineDatabase.AddNewUpgrade(DateTime.Now, set.LastVersion, IOVariables.RemindMeVersion);

                //Update the lastVersion
                set.LastVersion = IOVariables.RemindMeVersion;
            }
            else
            {
                BLIO.Log("[VERSION CHECK] No new version! lastVersion: " + set.LastVersion + "  New version: " + IOVariables.RemindMeVersion);
            }

            //Default view should be reminders
            pnlMain.Controls.Add(ucReminders);

            RemindMeMessageFormManager.MakeTodaysRemindersPopup();
            BLIO.Log("Today's reminders popup created");

            //Create an shortcut in the windows startup folder if it doesn't already exist
            if (!File.Exists(IOVariables.startupFolderPath + "\\RemindMe" + ".lnk"))
            {
                FSManager.Shortcuts.CreateShortcut(IOVariables.startupFolderPath, "RemindMe", System.Windows.Forms.Application.StartupPath + "\\" + "RemindMe.exe", "Shortcut of RemindMe");
            }


            if (Debugger.IsAttached) //Debugging ? show extra option
            {
                btnDebugMode.Visible = true;
            }


            BLSongs.InsertWindowsSystemSounds();

            tmrUpdateRemindMe.Start();

            //If the setup still exists, delete it
            File.Delete(IOVariables.rootFolder + "SetupRemindMe.msi");

            //Call the timer once
            Thread tr = new Thread(() =>
            {
                //wait a bit, then call the update timer once. It then runs every 5 minutes
                Thread.Sleep(5000);
                tmrUpdateRemindMe_Tick(null, null);
                BLOnlineDatabase.InsertOrUpdateUser(set.UniqueString);
                Thread.Sleep(1500);
                if (set.LastVersion == null)
                {
                    //First time user! log it in the db
                    BLOnlineDatabase.InsertFirstTimeUser(set.UniqueString);
                    set.LastVersion = IOVariables.RemindMeVersion;
                }
                BLSettings.UpdateSettings(set);
            });

            tr.Start();



            this.Opacity       = 0;
            this.ShowInTaskbar = true;
            this.Show();
            tmrInitialHide.Start();

            //Insert the errorlog.txt into the DB if it is not empty
            if (new FileInfo(IOVariables.errorLog).Length > 0)
            {
                BLOnlineDatabase.InsertLocalErrorLog(set.UniqueString, File.ReadAllText(IOVariables.errorLog), File.ReadLines(IOVariables.errorLog).Count());
                File.WriteAllText(IOVariables.errorLog, "");
            }

            Random r = new Random();

            tmrCheckRemindMeMessages.Interval = (r.Next(60, 300)) * 1000; //Random interval between 1 and 5 minutes
            tmrCheckRemindMeMessages.Start();
            BLIO.Log("tmrCheckRemindMeMessages.Interval = " + tmrCheckRemindMeMessages.Interval / 1000 + " seconds.");
            BLIO.Log("RemindMe loaded");
            Cleanup();
        }