Exemplo n.º 1
0
 private void Random_Click(object sender, EventArgs e)
 {
     if (CheckChanged())
     {
         currentExcuse = new Excuse(random, selectedFolder);
         UpdateForm(false);
     }
 }
Exemplo n.º 2
0
 public void OpenFile(string fileToOPen)
 {
     using (Stream input = File.OpenRead(fileToOPen))
     {
         BinaryFormatter bf = new BinaryFormatter();
         Excuse          temporaryExcuse = (Excuse)bf.Deserialize(input);
         Description = temporaryExcuse.Description;
         Results     = temporaryExcuse.Results;
         LastUsed    = temporaryExcuse.LastUsed;
     }
 }
Exemplo n.º 3
0
 private void Random_Click(object sender, EventArgs e)
 {
     if (Directory.GetFiles(selectedFolder).Length == 0)
     {
         MessageBox.Show("There are no excuse ifles in the selected folder.");
     }
     else if (CheckChanged())
     {
         currentExcuse = new Excuse(random, selectedFolder);
         UpdateForm(false);
     }
 }
Exemplo n.º 4
0
        private void open_Click(object sender, EventArgs e)
        {
            if (CheckChanged())
            {
                openFileDialog1.InitialDirectory = selectedFolder;
                openFileDialog1.FileName         = excuseTextBox.Text + ".excuse";

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    currentExcuse = new Excuse(openFileDialog1.FileName);
                    UpdateForm(false);
                }
            }
        }
Exemplo n.º 5
0
 public void OpenFile(string fileToOPen)
 {
     try
     {
         using (Stream input = File.OpenRead(fileToOPen))
         {
             BinaryFormatter bf = new BinaryFormatter();
             Excuse          temporaryExcuse = (Excuse)bf.Deserialize(input);
             Description = temporaryExcuse.Description;
             Results     = temporaryExcuse.Results;
             LastUsed    = temporaryExcuse.LastUsed;
         }
     }
     catch (SerializationException)
     {
         MessageBox.Show("Unable to read " + fileToOPen);
         LastUsed = DateTime.Now;
     }
 }