Beispiel #1
0
        private void btnRemoveSong_Click(object sender, EventArgs e)
        {
            cbSound.SelectedItem = null;
            cbSound.Text         = "";
            Settings set = BLSettings.GetSettings();

            set.DefaultTimerSound = "";
            BLSettings.UpdateSettings(set);
        }
Beispiel #2
0
        private void cbAdvancedReminders_OnChange(object sender, EventArgs e)
        {
            BLIO.Log("Checkbox change (Advanced Reminder)");
            Settings set = BLSettings.GetSettings();

            set.EnableAdvancedReminders = cbAdvancedReminders.Checked ? 1 : 0;

            BLSettings.UpdateSettings(set);
            BLIO.Log("Advanced Reminder setting changed to: " + cbAdvancedReminders.Checked.ToString());
        }
Beispiel #3
0
        private void cbEnableQuicktimer_OnChange(object sender, EventArgs e)
        {
            BLIO.Log("Checkbox change (Quick timer)");
            Settings set = BLSettings.GetSettings();

            set.EnableQuickTimer = cbQuicktimer.Checked ? 1 : 0;

            BLSettings.UpdateSettings(set);
            BLIO.Log("Quick timer setting changed to: " + cbQuicktimer.Checked.ToString());
        }
Beispiel #4
0
 private void btnYes_Click(object sender, EventArgs e)
 {
     result = DialogResult.Yes;
     if (cbDontRemind.Checked)
     {
         Settings settingsObject = BLSettings.GetSettings();
         settingsObject.HideReminderConfirmation = 1;
         BLSettings.UpdateSettings(settingsObject);
     }
     newMessageBox.Close();
 }
Beispiel #5
0
        private void cbSound_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxItem selectedItem = (ComboBoxItem)cbSound.SelectedItem;

            if (selectedItem != null)
            {
                Songs    selectedSong = (Songs)selectedItem.Value;
                Settings set          = BLSettings.GetSettings();
                set.DefaultTimerSound = selectedSong.SongFilePath;
                BLSettings.UpdateSettings(set);
            }
        }
        private void pbVideoPath_Click(object sender, EventArgs e)
        {
            string path = FSManager.Folders.GetSelectedFolderPath();

            if (!string.IsNullOrEmpty(path))
            {
                tbVideoPath.Text = path;
                Settings set = BLSettings.GetSettings();
                set.VideoPath = path;
                BLSettings.UpdateSettings(set);
            }
        }
        private void pbSoundFile_Click(object sender, EventArgs e)
        {
            string file = FSManager.Files.GetSelectedFileWithPath("Wave File", "*.wav");

            if (!string.IsNullOrEmpty(file))
            {
                //Get the current settings
                Settings set = BLSettings.GetSettings();
                //Alter the sound file of the settings
                set.SoundFile = file;
                //Write it to the database
                BLSettings.UpdateSettings(set);

                tbSoundFile.Text = file;
            }
        }
Beispiel #8
0
        private void cbEnableOneHourBeforeNotification_OnChange(object sender, EventArgs e)
        {
            BLIO.Log("Checkbox change (Enable 1h before)");
            Settings set = BLSettings.GetSettings();

            if (cbOneHourBeforeNotification.Checked)
            {
                set.EnableHourBeforeReminder = 1;
            }
            else
            {
                set.EnableHourBeforeReminder = 0;
            }

            BLSettings.UpdateSettings(set);
            BLIO.Log("1 hour before reminder setting changed to: " + cbOneHourBeforeNotification.Checked.ToString());
        }
Beispiel #9
0
        private void cbEnableRemindMeMessages_OnChange(object sender, EventArgs e)
        {
            BLIO.Log("Checkbox change (todays reminder popup)");
            Settings set = BLSettings.GetSettings();

            if (cbRemindMeMessages.Checked)
            {
                set.EnableReminderCountPopup = 1;
            }
            else
            {
                set.EnableReminderCountPopup = 0;
            }


            BLSettings.UpdateSettings(set);
            BLIO.Log("Today's reminder popup setting changed to: " + cbRemindMeMessages.Checked.ToString());
        }
Beispiel #10
0
        private void enableWarningToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BLIO.Log("Attempting to re-enable the hide warning on reminders....");

            //Get the current settings from the database
            Settings currentSettings = BLSettings.GetSettings();

            //Set the hiding of the confirmation on hiding a reminder to false
            currentSettings.HideReminderConfirmation = 0;

            //Make the right-click menu option invisible
            enableWarningToolStripMenuItem.Visible = false;

            //Push the updated settings to the database
            BLSettings.UpdateSettings(currentSettings);

            BLIO.Log("Re-enabled the hide warning on reminders!");
        }
Beispiel #11
0
        private void cbPopupType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbPopupType.SelectedItem.ToString() == "Always on top (Recommended)")
            {
                alwaysOnTop = 1;
                BLIO.Log("Popup type selected index changed to always on top.");
            }
            else
            {
                alwaysOnTop = 0;
                BLIO.Log("Popup type selected index changed to minimized.");
            }

            Settings set = BLSettings.GetSettings();

            set.AlwaysOnTop = alwaysOnTop;

            BLSettings.UpdateSettings(set);
            BLIO.Log("Updated popup type.");
        }
Beispiel #12
0
        private void UCWindowOverlay_Load(object sender, EventArgs e)
        {
            if (BLSettings.GetSettings() == null)
            {
                Settings set = new Settings();
                set.AlwaysOnTop = alwaysOnTop;
                set.StickyForm  = 0;
                set.EnableHourBeforeReminder = 1;
                set.EnableReminderCountPopup = 1;
                set.EnableQuickTimer         = 1;
                BLSettings.UpdateSettings(set);
            }

            //Since we're not going to change the contents of this combobox anyway, we're just going to do it like this
            if (BLSettings.IsAlwaysOnTop())
            {
                cbPopupType.SelectedItem = cbPopupType.Items[0];
            }
            else
            {
                cbPopupType.SelectedItem = cbPopupType.Items[1];
            }

            cbRemindMeMessages.Checked          = BLSettings.IsReminderCountPopupEnabled();
            cbOneHourBeforeNotification.Checked = BLSettings.IsHourBeforeNotificationEnabled();
            cbQuicktimer.Checked        = BLSettings.GetSettings().EnableQuickTimer == 1;
            cbAdvancedReminders.Checked = BLSettings.GetSettings().EnableAdvancedReminders == 1;

            Hotkeys timerKey = BLHotkeys.TimerPopup;

            foreach (string m in timerKey.Modifiers.Split(','))
            {
                tbTimerHotkey.Text += m + " + ";
            }
            tbTimerHotkey.Text += timerKey.Key;

            //Fill the combobox to select a timer popup sound with data
            FillSoundCombobox();
            //Set the item the user selected as text
            string def = BLSettings.GetSettings().DefaultTimerSound;

            if (def == null) //User has no default sound combobox
            {
                foreach (ComboBoxItem itm in cbSound.Items)
                {
                    if (itm.Text.ToLower().Contains("unlock")) //Set the default timer sound to windows unlock
                    {
                        Songs    sng = (Songs)itm.Value;
                        Settings set = BLSettings.GetSettings();
                        set.DefaultTimerSound = sng.SongFilePath;
                        BLSettings.UpdateSettings(set);
                    }
                }
            }
            if (BLSettings.GetSettings().DefaultTimerSound == null)//Still null? well damn.
            {
                return;
            }

            cbSound.Items.Add(new ComboBoxItem(Path.GetFileNameWithoutExtension(BLSettings.GetSettings().DefaultTimerSound), BLSongs.GetSongByFullPath(BLSettings.GetSettings().DefaultTimerSound)));
            cbSound.Text = Path.GetFileNameWithoutExtension(BLSettings.GetSettings().DefaultTimerSound);
        }
Beispiel #13
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.GetSettings();

            if (set.LastVersion != null && (new 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();

                //Update lastVersion
                set.LastVersion = IOVariables.RemindMeVersion;
                BLSettings.UpdateSettings(set);
            }

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

            MessageFormManager.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();

            BLIO.Log("RemindMe loaded");
            Cleanup();

            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);
            });

            tr.Start();


            this.Opacity       = 0;
            this.ShowInTaskbar = true;
            this.Show();
            tmrInitialHide.Start();
        }
Beispiel #14
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();
        }
 public bool PostUpdateSettings([FromBody] KeyValuePair <int, decimal> pair)
 {
     return(BLSettings.UpdateSettings(pair));
 }