コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
 public NewRecipe()
 {
     InitializeComponent();
     m = new ReseptiModel();
 }