private void selaaReseptejäToolStripMenuItem_Click(object sender, EventArgs e) { FileStream stream; OpenFileDialog o; OpenFileStream(out stream, out o); XmlSerializer serializer = new XmlSerializer(typeof(ReseptiModel)); if (o.ShowDialog() == DialogResult.OK) { try{ if ((stream = (FileStream)o.OpenFile()) != null) { using (stream){ ReseptiModel = (ReseptiModel)serializer.Deserialize(stream); ApplyVariables(); } } } catch (Exception eih) { throw new Exception(eih.Message); } } }
public NewRecipe() { InitializeComponent(); m = new ReseptiModel(); }