Пример #1
0
        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 = "";
                }
            }
        }
Пример #2
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);
        }
Пример #3
0
        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();
            }
        }