private void WorkTemplate2_Click(object sender, RoutedEventArgs e)
        {
            WorkTemplate2Window window = new WorkTemplate2Window();

            window.ShowActivated = true;
            window.Show();
        }
Exemple #2
0
        private void Open_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Filter = "resume builder file(*.rmsbldr)|*.rmsbldr|All files(*.*)|*.*";

            if (open.ShowDialog() == true)
            {
                BinaryFormatter formatter = new BinaryFormatter();

                object template;
                // десериализация
                using (FileStream fs = new FileStream(open.FileName, FileMode.OpenOrCreate))
                {
                    template = formatter.Deserialize(fs);
                }
                if (template is WorkTemplate)
                {
                    WorkTemplateWindow window = new WorkTemplateWindow((WorkTemplate)template);
                    window.ShowActivated = true;
                    window.Show();
                }
                else if (template is WorkTemplate2)
                {
                    WorkTemplate2Window window = new WorkTemplate2Window((WorkTemplate2)template);
                    window.ShowActivated = true;
                    window.Show();
                }
            }
        }