Пример #1
0
        public App()
        {
            current = this;
            WinBlogXConfig config = WinBlogXConfig.Load();

            if (config.StartDialog.Mru.Count > 0)
            {
                string path = config.StartDialog.Mru[0];
                if (File.Exists(path))
                {
                    WinBlogXProject proj = null;

                    XmlSerializer ser = new XmlSerializer(typeof(WinBlogXProject));
                    using (StreamReader reader = new StreamReader(path))
                    {
                        proj = ser.Deserialize(reader) as WinBlogXProject;
                    }
                    if (proj != null)
                    {
                        proj.Upgrade();

                        SimpleBrowser browser = new SimpleBrowser(proj);
                        browser.Show();
                        return;
                    }
                }
            }

            new Start().Show();
        }
Пример #2
0
        void Open(string path)
        {
            WinBlogXProject proj = null;

            XmlSerializer ser = new XmlSerializer(typeof(WinBlogXProject));

            using (StreamReader reader = new StreamReader(path))
            {
                proj = ser.Deserialize(reader) as WinBlogXProject;
            }
            if (proj != null)
            {
                proj.Upgrade();

                WinBlogXConfig config = WinBlogXConfig.Load();
                config.StartDialog.AddMru(path);
                WinBlogXConfig.Save(config);

                SimpleBrowser browser = new SimpleBrowser(proj);
                browser.Show();

                BeginInvoke(new MethodInvoker(Close));
            }
        }