/// <summary>
 /// Shows a prompt where the user can enter a string
 /// </summary>
 /// <param name="title">The title the user should see when this prompt shows up</param>
 /// <returns></returns>
 public static string ShowText(string title)
 {
     newPrompt = new MaterialRemindMePrompt(title, PromptReason.TEXT);
     newPrompt.ShowDialog();
     BLIO.Log("RemindMePrompt closed and returned " + strReturnValue);
     return(strReturnValue);
 }
예제 #2
0
        private void btnOpenErrorPrompt_Click(object sender, EventArgs e)
        {
            BLIO.Log("btnOpenErrorPrompt_Click");
            string text = MaterialRemindMePrompt.ShowText("Enter a message");
            MaterialExceptionPopup pop = new MaterialExceptionPopup(new ReminderException("Test", null), text);

            pop.Show();
        }
 public static int ShowMinutes(string title, string description)
 {
     newPrompt = new MaterialRemindMePrompt(title, description, PromptReason.MINUTES);
     newPrompt.ShowDialog();
     if (minutes < 0)
     {
         minutes = 0;
     }
     return(minutes);
 }
 /// <summary>
 /// Shows a prompt where the user can enter a number
 /// </summary>
 /// <param name="title">The title the user should see when this prompt shows up</param>
 /// <returns></returns>
 public static int ShowNumber(string title, string description)
 {
     newPrompt = new MaterialRemindMePrompt(title, description, PromptReason.NUMERIC);
     newPrompt.ShowDialog();
     BLIO.Log("RemindMePrompt closed and returned " + intReturnValue);
     if (intReturnValue < 0)
     {
         intReturnValue = 0;
     }
     return(intReturnValue);
 }
예제 #5
0
        private void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            string text = MaterialRemindMePrompt.ShowText("Enter a message");

            if (!string.IsNullOrWhiteSpace(text))
            {
                MaterialMessageFormManager.MakeMessagePopup(text, 11);
            }
            else
            {
                MaterialMessageFormManager.MakeMessagePopup("This is a test.", 4);
            }
        }
예제 #6
0
        private void btnPostpone_Click(object sender, EventArgs e)
        {
            BLIO.Log("RemindMeMessageForm option clicked: Postpone (" + theReminder.Id + ")");
            isDialog = true;
            int minutes = MaterialRemindMePrompt.ShowMinutes("Select your postpone time", "(in minutes or in xhxxm format (1h20m) )");

            if (minutes <= 0)
            {
                BLIO.Log("Postponing reminder with " + minutes + " minutes DENIED.");
                return;
            }

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

            BLReminder.EditReminder(theReminder);//Push changes

            MUCReminders.Instance.UpdateCurrentPage();

            new Thread(() =>
            {
                //Log an entry to the database, for data!
                try
                {
                    BLOnlineDatabase.PostponeCount++;
                }
                catch (ArgumentException ex)
                {
                    BLIO.Log("Exception at BLOnlineDatabase.PostponeCount++. -> " + ex.Message);
                    BLIO.WriteError(ex, ex.Message, true);
                }
            }).Start();

            this.Close();
            this.Dispose();
        }
예제 #7
0
        private void btnSaveTheme_Click(object sender, EventArgs e)
        {
            if (currentSelectedTheme != null)
            {
                if (MaterialRemindMeBox.Show
                        ("Do you want to update the current theme, or save it under a new name? Press YES to update the current theme (\"" + currentSelectedTheme.ThemeName + "\"), and NO to save it under a new name.",
                        RemindMeBoxReason.YesNo) == DialogResult.Yes)
                {
                    if (currentSelectedTheme.IsDefault == 1)
                    {
                        MaterialRemindMeBox.Show("The selected theme is a default theme. You can't edit this theme. If you want to " +
                                                 "save this theme, save it under a different name instead (Press NO after saving)");

                        return;
                    }

                    //Update current theme
                    currentSelectedTheme.Primary      = (int)Enum.Parse(typeof(Primary), cbPrimary.SelectedItem.ToString());
                    currentSelectedTheme.DarkPrimary  = (int)Enum.Parse(typeof(Primary), cbDarkPrimary.SelectedItem.ToString());
                    currentSelectedTheme.LightPrimary = (int)Enum.Parse(typeof(Primary), cbLightPrimary.SelectedItem.ToString());
                    currentSelectedTheme.Accent       = (int)Enum.Parse(typeof(Accent), cbAccent.SelectedItem.ToString());
                    currentSelectedTheme.TextShade    = (int)Enum.Parse(typeof(TextShade), cbTextShade.SelectedItem.ToString());

                    currentSelectedTheme.Mode = (int)MaterialSkinManager.Instance.Theme;

                    BLLocalDatabase.Theme.UpdateTheme(currentSelectedTheme);
                    MaterialMessageFormManager.MakeMessagePopup("Succesfully updated theme \"" + currentSelectedTheme.ThemeName + "\"", 5);
                }
                else
                {
                    SaveNewTheme(MaterialRemindMePrompt.ShowText("Give this theme a name "));
                }
            }
            else //No currently selected thme, save as new theme
            {
                SaveNewTheme(MaterialRemindMePrompt.ShowText("Give this theme a name "));
            }
        }