/// <summary> /// Looks for key combinations to launch the timer form (to set a timer quickly) /// </summary> /// <param name="sender"></param> /// <param name="e">The keyeventargs which contains the pressed keys</param> private void GlobalKeyPress(object sender, KeyEventArgs e) { if (BLSettings.GetSettings().EnableQuickTimer != 1) //Not enabled? don't do anything { return; } if (!e.Shift && !e.Control && !e.Alt) //None of the key key's (get it?) pressed? return. { return; } //Good! now let's check if the KeyCode is not alt shift or ctr if (e.KeyCode == Keys.Alt || e.KeyCode == Keys.ControlKey || e.KeyCode == Keys.ShiftKey) { return; } timerHotkey = BLHotkeys.TimerPopup; if (e.Modifiers.ToString().Replace(" ", string.Empty) == timerHotkey.Modifiers && e.KeyCode.ToString() == timerHotkey.Key) { BLIO.Log("Timer hotkey combination pressed!"); TimerPopup quickTimer = new TimerPopup(); quickTimer.Show(); } }
private void HideOrShowEnableHideWarning() { //The option enableWarningToolStripMenuItem.Visible = BLSettings.GetSettings().HideReminderConfirmation == 1; BLIO.Log("Showing enable hide warning option from right click menu: " + (BLSettings.GetSettings().HideReminderConfirmation == 1)); }
private void Timer_Tick(object sender, EventArgs e) { if (popupDate <= DateTime.Now)//Let's make the popup { timer.Stop(); Reminder rem = new Reminder(); rem.Date = popupDate.ToShortDateString() + " " + popupDate.ToShortTimeString(); rem.RepeatType = ReminderRepeatType.NONE.ToString(); rem.Id = -1; //Set it to our "Invalid id" number. It is not a real reminder after all. rem.Name = "Timer"; rem.Note = timerText; Settings set = BLSettings.GetSettings(); rem.SoundFilePath = set.DefaultTimerSound; Popup pop = new Popup(rem); pop.Show(); //Let's remove this timer. It's served its purpose ucTimer.RemoveTimer(this); this.Dispose(); } }
private void btnRemoveSong_Click(object sender, EventArgs e) { cbSound.SelectedItem = null; cbSound.Text = ""; Settings set = BLSettings.GetSettings(); set.DefaultTimerSound = ""; BLSettings.UpdateSettings(set); }
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()); }
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()); }
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(); }
private void Popup_Load(object sender, EventArgs e) { pnlText.VerticalScroll.Visible = true; //Set the maximum width of the panel, so that there won't be a horizontal scrollbar, but only a vertical one(if there is a lot of text) lblNoteText.MaximumSize = new Size(pnlText.Width - 20, 0); lblTitle.MaximumSize = new Size(pnlTitle.Width - 20, 0); pnlTopGradient.SendToBack(); FlashWindowHelper.Start(this); this.MaximumSize = this.Size; if (BLSettings.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; } //Show what date this reminder was set for if (rem.PostponeDate == null) { lblDate.Text = "This reminder was set for " + rem.Date.Split(',')[0]; } else { lblDate.Text = "This reminder was set for " + rem.PostponeDate; } lblTitle.Text = rem.Name; lblNoteText.Text = rem.Note.Replace("\\n", Environment.NewLine); //Play the sound if (rem.SoundFilePath != null && rem.SoundFilePath != "") { if (System.IO.File.Exists(rem.SoundFilePath)) { myPlayer.URL = rem.SoundFilePath; myPlayer.controls.play(); } else { 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 = ""; } } }
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); } }
/// <summary> /// makes the popup that shows howmany reminders are set for today /// </summary> public static void MakeTodaysRemindersPopup() { int reminderCount = BLReminder.GetTodaysReminders().Count; if (BLSettings.IsReminderCountPopupEnabled()) { if (reminderCount > 0) { MakeMessagePopup("You have " + reminderCount + " Reminder(s) set for today.", 3); } else { MakeMessagePopup("You have no reminders set for today.", 3); } } }
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; } }
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()); }
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()); }
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!"); }
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."); }
public CommonSettings GetAllSettings() { return(BLSettings.GetAllSettings()); }
public bool PostUpdateSettings([FromBody] KeyValuePair <int, decimal> pair) { return(BLSettings.UpdateSettings(pair)); }
public List <CommonDiscounts> GetDiscountSettings() { return(BLSettings.GetDiscountSettings()); }
/// <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 PostUpdateDiscount([FromBody] CommonDiscounts disc) { return(BLSettings.UpdateDiscount(disc)); }
private void Popup2_Load(object sender, EventArgs e) { BLIO.Log("Popup_load"); AdvancedReminderProperties avrProps = BLAVRProperties.GetAVRProperties(rem.Id); List <AdvancedReminderFilesFolders> avrFF = BLAVRProperties.GetAVRFilesFolders(rem.Id); if (avrProps != null) //Not null? this reminder has advanced properties. { BLIO.Log("Reminder " + rem.Id + " has advanced reminder properties!"); if (!string.IsNullOrWhiteSpace(avrProps.BatchScript)) { BLIO.ExecuteBatch(avrProps.BatchScript); } this.Visible = avrProps.ShowReminder == 1; } 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") { if (File.Exists(avr.Path) || Directory.Exists(avr.Path)) { System.Diagnostics.Process.Start(avr.Path); } } else if (avr.Action.ToString() == "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; } DateTime date = Convert.ToDateTime(rem.Date.Split(',')[0]); lblSmallDate.Text = date.ToShortDateString() + " " + date.ToShortTimeString(); lblRepeat.Text = BLReminder.GetRepeatTypeText(rem); if (!String.IsNullOrWhiteSpace(rem.PostponeDate)) { 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 (BLSettings.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 + Environment.NewLine + lblNoteText.Text; if (rem.Date == null) { rem.Date = DateTime.Now.ToString(); } }
private void tmrCheckReminder_Tick(object sender, EventArgs e) { 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; MessageFormManager.MakeTodaysRemindersPopup(); } //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 (BLSettings.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) { if (remindersToHappenInAnHour.Count > 1) { message += count + ") " + rem.Name + Environment.NewLine; } else { message = rem.Name + " in 60 minutes!"; } count++; } if (remindersToHappenInAnHour.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 { MessageFormManager.MakeMessagePopup(message, 8); } popupMessages.Add(message); } else if (remindersToHappenInAnHour.Count > 0) { if (!popupMessages.Contains(message)) //Don't create this popup if we have already created it once before { MessageFormManager.MakeMessagePopup(message, 8, remindersToHappenInAnHour[0]); } popupMessages.Add(message); } remindersToHappenInAnHour.Clear(); }
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); }
/// <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(); }