示例#1
0
 private void newNoteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FormServiceNotesChild formChild = new FormServiceNotesChild();
     formChild.MdiParent = this;
     formChild.WindowState = FormWindowState.Maximized;
     formChild.Show();
 }
示例#2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string noteRead = string.Empty;
            string fileName;

            DialogResult result;

            using(OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                result = openFileDialog.ShowDialog();
                fileName = openFileDialog.FileName;
            }

            if (fileName != string.Empty)
            {
                //read the content of the file into a new service note
                //close the file
                using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
                {

                    try
                    {
                        StreamReader sr = new StreamReader(fs);
                        noteRead = sr.ReadToEnd();

                    }
                    catch (Exception)
                    {
                        throw new FileLoadException();
                    }

                }

                //open a service note
                FormServiceNotesChild formChild = new FormServiceNotesChild();
                formChild.MdiParent = this;
                formChild.WindowState = FormWindowState.Maximized;
                formChild.serviceNote = noteRead;
                formChild.Show();
                //?save that filename for the save dialog?

            }
            else 
            {
                //no file selected
                //throw new FileNotFoundException();
            }

        }