Пример #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     BLReminder.DeleteReminder(rem);
     this.rem = null;
     UCReminders.GetInstance().UpdateCurrentPage();
     UCReminders.GetInstance().RefreshPage();
 }
Пример #2
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            BLIO.Log("Confirm button pressed (UCImportExport)");
            bool success = false;

            switch (transferType)
            {
            case ReminderTransferType.IMPORT:
                BLIO.Log("Importing reminders ... (UCImportExport)");
                success = ImportReminders();
                break;

            case ReminderTransferType.EXPORT:
                BLIO.Log("Exporting reminders ... (UCImportExport)");
                success = Exportreminders();
                break;

            case ReminderTransferType.RECOVER:
                BLIO.Log("Recovering reminders ... (UCImportExport)");
                success = RecoverReminders();
                break;
            }
            if (success)
            {
                foreach (ListViewItem item in lvReminders.CheckedItems)
                {
                    lvReminders.Items.Remove(item);
                }
            }



            ToggleButton(null);
            UCReminders.GetInstance().UpdateCurrentPage();
        }
Пример #3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            rem = BLReminder.GetReminderById(rem.Id);

            if (rem == null)
            {
                goto close;
            }

            if (rem.Id != -1 && rem.Deleted == 0) //Don't do stuff if the id is -1, invalid. the id is set to -1 when the user previews an reminder
            {
                if (BLReminder.GetReminderById(rem.Id) == null)
                {
                    //The reminder popped up, it existed, but when pressing OK it doesn't exist anymore (maybe the user deleted it or tempered with the .db file)
                    BLIO.Log("DETECTED NONEXISTING REMINDER WITH ID " + rem.Id + ", Attempted to press OK on a reminder that somehow doesn't exist");
                    goto close;
                }

                if (cbPostpone.Checked)
                {
                    BLIO.Log("Postponing reminder with id " + rem.Id);
                    if (numPostponeTime.Value == 0)
                    {
                        return;
                    }

                    DateTime newReminderTime = new DateTime();

                    if (cbPostpone.Checked && tbtime.ForeColor == Color.White && !string.IsNullOrWhiteSpace(tbtime.Text)) //postpone option is x minutes
                    {
                        newReminderTime  = DateTime.Now.AddMinutes(BLFormLogic.GetTextboxMinutes(tbtime));
                        rem.PostponeDate = newReminderTime.ToString();
                    }
                    else
                    {
                        rem.PostponeDate = null;
                        BLReminder.UpdateReminder(rem);
                    }



                    BLIO.Log("Postpone date assigned to reminder");
                    rem.Enabled = 1;
                    BLReminder.EditReminder(rem);
                    BLIO.Log("Reminder postponed!");
                }
                else
                {
                    rem.PostponeDate = null;
                    BLReminder.UpdateReminder(rem);
                }
            }

close:
            UCReminders.GetInstance().UpdateCurrentPage();
            BLIO.Log("Stopping media player & Closing popup");
            myPlayer.controls.stop();
            btnOk.Enabled = false;
            this.Close();
        }
Пример #4
0
        public Form1()
        {
            BLIO.Log("Construct Form");
            InitializeComponent();
            instance = this;

            AppDomain.CurrentDomain.SetData("DataDirectory", IOVariables.databaseFile);
            BLIO.CreateSettings();
            BLIO.CreateDatabaseIfNotExist();


            //User controls that will be loaded into the "main" panel
            ucReminders    = new UCReminders();
            ucImportExport = new UCImportExport();
            ucSound        = new UCSound();
            ucOverlay      = new UCSettings();
            ucResizePopup  = new UCResizePopup();
            ucSupport      = new UCSupport();
            ucDebug        = new UCDebugMode();
            ucTimer        = new UCTimer();

            //Turn them invisible
            ucImportExport.Visible = false;
            ucSound.Visible        = false;
            ucOverlay.Visible      = false;
            ucResizePopup.Visible  = false;
            ucSupport.Visible      = false;
            ucDebug.Visible        = false;
            ucTimer.Visible        = false;

            //Add all of them(invisible) to the panel
            pnlMain.Controls.Add(ucImportExport);
            pnlMain.Controls.Add(ucSound);
            pnlMain.Controls.Add(ucOverlay);
            pnlMain.Controls.Add(ucResizePopup);
            pnlMain.Controls.Add(ucSupport);
            pnlMain.Controls.Add(ucDebug);
            pnlMain.Controls.Add(ucTimer);

            pnlMain.Controls.Add(ucReminders);
            ucReminders.Visible = true;
            ucReminders.Initialize();

            m_GlobalHook        = Hook.GlobalEvents();
            m_GlobalHook.KeyUp += GlobalKeyPress;

            //Set the Renderer of the menustrip to our custom renderer, which sets the highlight and border collor to DimGray, which is the same
            //As the menu's themselves, which means you will not see any highlighting color or border. This renderer also makes the text of the selected
            //toolstrip items white.
            RemindMeTrayIconMenuStrip.Renderer = new MyToolStripMenuRenderer();


            UpdateInformation.Initialize();

            formLoadAsync();
            Thread.Sleep(2000);
            RemindMeIcon.Visible = true;
            BLIO.Log("Form constructed");
        }
Пример #5
0
 private void duplicateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     BLIO.Log("Setting up the duplicating process...");
     BLIO.Log("duplicating reminder with id " + rem.Id);
     BLReminder.PushReminderToDatabase(rem);
     BLIO.Log("reminder duplicated.");
     UCReminders.GetInstance().UpdateCurrentPage();
 }
Пример #6
0
 private void lblDisable_Click(object sender, EventArgs e)
 {
     theReminder.Enabled = 0;                                   //Set the enabled flag of this reminder to false
     BLReminder.EditReminder(theReminder);                      //Push the edited reminder to the database
     UCReminders.GetInstance().UpdateCurrentPage();             //Show the change in RemindMe's main listview
     BLIO.Log("Reminder with id" + theReminder.Id + " Disabled from the RemindMe message form");
     this.Dispose();
 }
Пример #7
0
        private void skipToNextDateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BLIO.Log("Skipping reminder with id " + rem.Id + " to its next date");
            //The reminder object has now been altered. The first date has been removed and has been "skipped" to it's next date
            BLReminder.SkipToNextReminderDate(rem);
            //push the altered reminder to the database
            BLReminder.EditReminder(rem);

            //Refresh to show changes
            UCReminders.GetInstance().UpdateCurrentPage();
        }
Пример #8
0
        public UCReminders()
        {
            InitializeComponent();

            instance = this;

            if (BLReminder.GetReminders().Count == 0)
            {
                pnlReminders.BackgroundImage = Properties.Resources.NoReminders2;
            }
        }
Пример #9
0
        private void removePostponeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BLIO.Log("Removing postpone from reminder with id " + rem.Id);
            rem.PostponeDate = null;
            BLReminder.EditReminder(rem);

            pbRepeat.Location  = new Point(168, 26);
            lblRepeat.Location = new Point(195, 30);
            LoadReminderData();
            UCReminders.GetInstance().UpdateCurrentPage();
        }
Пример #10
0
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (RemindMeBox.Show("Are you really sure you wish to permanentely delete \"" + rem.Name + "\" ?", RemindMeBoxReason.YesNo) == DialogResult.Yes)
     {
         BLIO.Log("Permanentely deleting reminder with id " + rem.Id + " ...");
         this.Visible = false;
         BLReminder.PermanentelyDeleteReminder(rem);
         BLIO.Log("Reminder permanentely deleted.");
         UCReminders.GetInstance().UpdateCurrentPage();
         UCReminders.GetInstance().RefreshPage();
     }
 }
Пример #11
0
 private void lblSkip_Click(object sender, EventArgs e)
 {
     //The reminder object has now been altered. The first date has been removed and has been "skipped" to it's next date
     BLReminder.SkipToNextReminderDate(theReminder);
     BLIO.Log("Skipped reminder with id " + theReminder.Id + " to it's next date from the RemindMe message form");
     //push the altered reminder to the database
     BLReminder.EditReminder(theReminder);
     BLIO.Log("Edited reminder with id " + theReminder.Id);
     //Show the change in RemindMe's main listview
     UCReminders.GetInstance().UpdateCurrentPage();
     //Finally, close this message
     this.Dispose();
 }
Пример #12
0
        public UCReminders()
        {
            InitializeComponent();
            sizes = BLListviewColumnSizes.GetcolumnSizes();
            ReminderMenuStrip.Renderer = new MyToolStripMenuRenderer();

            instance = this;

            if (BLReminder.GetReminders().Count == 0)
            {
                pnlReminders.BackgroundImage = Properties.Resources.NoReminders2;
            }
        }
Пример #13
0
        private void btnDisable_Click(object sender, EventArgs e)
        {
            if (rem.Enabled == 1)
            {
                btnDisable.Image = Properties.Resources.turnedOffTwo;
                rem.Enabled      = 0;
            }
            else
            {
                btnDisable.Image = Properties.Resources.turnedOn;
                rem.Enabled      = 1;
            }

            BLReminder.EditReminder(rem);
            UCReminders.GetInstance().UpdateCurrentPage();
            UCReminders.GetInstance().RefreshPage();
        }
Пример #14
0
        private void postponeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int minutes = RemindMePrompt.ShowMinutes("Select your postpone time", "(in minutes or in xhxxm format (1h20m) )");

            if (rem.PostponeDate == null)//No postpone yet, create it
            {
                rem.PostponeDate = Convert.ToDateTime(rem.Date.Split(',')[0]).AddMinutes(minutes).ToString();
            }
            else//Already a postponedate, add the time to that date
            {
                rem.PostponeDate = Convert.ToDateTime(rem.PostponeDate).AddMinutes(minutes).ToString();
            }

            BLReminder.EditReminder(rem);//Push changes

            UCReminders.GetInstance().UpdateCurrentPage();
        }
Пример #15
0
        private void btnReminders_Click(object sender, EventArgs e)
        {
            foreach (Control c in pnlMain.Controls)
            {
                c.Visible = false;
            }

            if (ucNewReminder != null && ucNewReminder.saveState)
            {
                ucNewReminder.Visible = true;
            }
            else
            {
                ucReminders.Visible = true;
                UCReminders.GetInstance().UpdateCurrentPage();
            }
            ToggleButton(sender);
        }
Пример #16
0
        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("Received message WM_RELOAD_REMINDERS");
                int currentReminderCount = BLReminder.GetReminders().Count;

                BLReminder.NotifyChange();
                UCReminders.GetInstance().UpdateCurrentPage();

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

            base.WndProc(ref m);
        }
Пример #17
0
        private void hideReminderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string message = "You can hide reminders with this option. The reminder will not be deleted, you just won't be able to see it"
                             + " in the list of reminders. This creates a sense of surprise.\r\n\r\nDo you wish to hide this reminder?";

            BLIO.Log("Attempting to hide reminder(s)");
            if (BLSettings.HideReminderOptionEnabled || RemindMeBox.Show(message, RemindMeBoxReason.YesNo, true) == DialogResult.Yes)
            {
                //Enable the hide flag here
                rem.Hide = 1;
                BLIO.Log("Marked reminder with id " + rem.Id + " as hidden");
                BLReminder.EditReminder(rem);
                UCReminders.GetInstance().UpdateCurrentPage();
                UCReminders.GetInstance().RefreshPage();
            }
            else
            {
                BLIO.Log("Attempting to hide reminder(s) failed.");
            }
        }
Пример #18
0
        //All uncaught exceptions will go here instead. We will replace the default windows popup with our own custom one and filter out what kind of exception is being thrown
        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            if (e.Exception is ReminderException)
            {
                ReminderException theException = (ReminderException)e.Exception;
                BLIO.WriteError(e.Exception, "Error with this reminder (" + theException.Reminder.Name + ") !");
                ShowError(e.Exception, "Reminder error!", theException.Message);
                UCReminders.GetInstance().UpdateCurrentPage();
            }
            else if (e.Exception is DirectoryNotFoundException)
            {
                DirectoryNotFoundException theException = (DirectoryNotFoundException)e.Exception;
                BLIO.WriteError(theException, "Folder not found.");
                ShowError(e.Exception, e.Exception.GetType().ToString(), theException.Message);
            }

            else if (e.Exception is UnauthorizedAccessException)
            {
                UnauthorizedAccessException theException = (UnauthorizedAccessException)e.Exception;
                BLIO.WriteError(e.Exception, "Unauthorized!");
                ShowError(e.Exception, "Unauthorized!", "RemindMe is not authorized for this action.\r\nThis can be resolved by running RemindMe in administrator-mode.");
            }

            //Here we just filter out some type of exceptions and give different messages, at the bottom is the super Exception, which can be anything.
            else if (e.Exception is FileNotFoundException)
            {
                FileNotFoundException theException = (FileNotFoundException)e.Exception; //needs in instance to call .FileName
                BLIO.WriteError(theException, "Could not find the file located at \"" + theException.FileName);
                ShowError(e.Exception, "File not found.", "Could not find the file located at \"" + theException.FileName + "\"\r\nHave you moved,renamed or deleted the file?");
            }

            else if (e.Exception is System.Data.Entity.Core.EntityException)
            {
                BLIO.WriteError(e.Exception, "System.Data.Entity.Core.EntityException");
                ShowError(e.Exception, "System.Data.Entity.Core.EntityException", "There was a problem executing SQL!");
            }

            else if (e.Exception is ArgumentNullException)
            {
                BLIO.WriteError(e.Exception, "Null argument");
                ShowError(e.Exception, "Null argument", "Null argument exception! Whoops! this is not on your end!");
            }

            else if (e.Exception is NullReferenceException)
            {
                BLIO.WriteError(e.Exception, "Null reference");
                ShowError(e.Exception, "Null reference", "Null reference exception! Whoops! this is not on your end!");
            }

            else if (e.Exception is SQLiteException)
            {
                BLIO.WriteError(e.Exception, "SQLite Database exception");
                ShowError(e.Exception, "SQLite Database exception", "Remindme has encountered a database error!\r\nThis might or might not be on your end. It can be on your end if you modified the database file");
            }

            else if (e.Exception is PathTooLongException)
            {
                BLIO.WriteError(e.Exception, "The path to the file is too long.");
                ShowError(e.Exception, "File Path too long.", "The path to the file is too long!.");
            }

            else if (e.Exception is StackOverflowException)
            {
                BLIO.WriteError(e.Exception, "StackOverFlowException");
                ShowError(e.Exception, "StackOverFlowException", "RemindMe has encountered a stackoverflow! This is probably not your fault. Sorry!");
            }

            else if (e.Exception is OutOfMemoryException)
            {
                BLIO.WriteError(e.Exception, "Out of Memory");
                ShowError(e.Exception, "Out of Memory", "RemindMe is out of memory!");
            }
            else if (e.Exception is DbUpdateConcurrencyException)
            {
                BLIO.WriteError(e.Exception, "Database error.");
                ShowError(e.Exception, "Database error!", "Database error encountered!");
            }

            else if (e.Exception is Exception)
            {
                BLIO.WriteError(e.Exception, "Unknown exception in main.");
                ShowError(e.Exception, "Unknown", "Unknown exception in main.");
            }
        }
Пример #19
0
        public Form1()
        {
            BLIO.Log("===  Initializing RemindMe Version " + IOVariables.RemindMeVersion + "  ===");
            LogWindowsInfo(); //Windows version info etc
            LogCultureInfo(); //Datetime info in their country
            Cleanup();
            AppDomain.CurrentDomain.SetData("DataDirectory", IOVariables.databaseFile);
            BLIO.CreateSettings();
            BLIO.CreateDatabaseIfNotExist();
            InitializeComponent();
            //--

            instance = this;

            //User controls that will be loaded into the "main" panel
            ucReminders    = new UCReminders();
            ucImportExport = new UCImportExport();
            ucSound        = new UCSound();
            ucSettings     = new UCSettings();
            ucResizePopup  = new UCResizePopup();
            ucSupport      = new UCSupport();
            ucDebug        = new UCDebugMode();
            ucTimer        = new UCTimer();
            ucTheme        = new UCTheme();

            //Turn them invisible
            ucImportExport.Visible = false;
            ucSound.Visible        = false;
            ucSettings.Visible     = false;
            ucResizePopup.Visible  = false;
            ucSupport.Visible      = false;
            ucDebug.Visible        = false;
            ucTimer.Visible        = false;
            ucTheme.Visible        = false;

            //Add all of them(invisible) to the panel
            pnlMain.Controls.Add(ucImportExport);
            pnlMain.Controls.Add(ucSound);
            pnlMain.Controls.Add(ucSettings);
            pnlMain.Controls.Add(ucResizePopup);
            pnlMain.Controls.Add(ucSupport);
            pnlMain.Controls.Add(ucDebug);
            pnlMain.Controls.Add(ucTimer);
            pnlMain.Controls.Add(ucTheme);

            pnlMain.Controls.Add(ucReminders);
            ucReminders.Visible = true;
            ucReminders.Initialize();

            m_GlobalHook          = Hook.GlobalEvents();
            m_GlobalHook.KeyDown += GlobalKeyPressDown;
            m_GlobalHook.KeyUp   += GlobalKeyPressUp;

            //Set the Renderer of the menustrip to our custom renderer, which sets the highlight and border collor to DimGray, which is the same
            //As the menu's themselves, which means you will not see any highlighting color or border. This renderer also makes the text of the selected
            //toolstrip items white.
            RemindMeTrayIconMenuStrip.Renderer = new MyToolStripMenuRenderer();


            UpdateInformation.Initialize();

            FormLoad();

            SystemEvents.PowerModeChanged += OnPowerChange;

            RemindMeIcon.Visible = true;

            //Update LastOnline every 5 minutes
            tmrPingActivity.Start();

            tmrDumpLogTxtContents.Start();

            tmrEnableDatabaseAccess.Start();

            SetButtonSpacing();

            BLIO.Log("===  Initializing RemindMe Complete  ===");
        }
Пример #20
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     UCReminders.GetInstance().EditReminder(rem);
 }