Exemplo n.º 1
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            NoteWindowMessageBox Message = new NoteWindowMessageBox();

            File.Delete(this.path);
            Message.Text = "Note deleted!";
            Message.Show();
            this.Close();
        }
Exemplo n.º 2
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            /// CHECK LINES BEFORE SAVE
            if (string.IsNullOrWhiteSpace(yearBox.Text) || string.IsNullOrWhiteSpace(MonthBox.Text) || string.IsNullOrWhiteSpace(DayBox.Text) || string.IsNullOrWhiteSpace(MinBox.Text) || string.IsNullOrWhiteSpace(HourBox.Text) || string.IsNullOrWhiteSpace(TitleBox.Text) || string.IsNullOrWhiteSpace(DescriptionBox.Text))
            {
                NoteWindowMessageBox Message = new NoteWindowMessageBox();
                Message.Text = "Please set all information in Window!"; /// CHANGE REMINDER FOR CUSTOM
                Message.Show();
            }
            else
            {
                TextWriter Save = new StreamWriter(yearBox.Text + MonthBox.Text + DayBox.Text + HourBox.Text + MinBox.Text + ".mnote");
                Save.WriteLine("N");
                Save.WriteLine(yearBox.Text);
                Save.WriteLine(MonthBox.Text);
                Save.WriteLine(DayBox.Text);
                Save.WriteLine(HourBox.Text + ":" + MinBox.Text);
                Save.WriteLine(TitleBox.Text);
                ///CHECKING REMINDER
                if (ReminderBox.CheckState == CheckState.Checked)
                {
                    Save.WriteLine("1");
                }
                else
                {
                    Save.WriteLine("0");
                }

                ///ADDING DESCRIPTION WITH MULTILINES
                for (int i = 0; i < DescriptionBox.Lines.Length; i++)
                {
                    Save.WriteLine(DescriptionBox.Lines[i]);
                }

                Save.Close();
                NoteWindowMessageBox Message = new NoteWindowMessageBox();
                Message.Text = "Note Added!";
                Message.Show();
            }
        }