Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        public static void Save(WinBlogXConfig config)
        {
            XmlSerializer ser = new XmlSerializer(typeof(WinBlogXConfig));

            using (StreamWriter writer = new StreamWriter(FileName))
            {
                ser.Serialize(writer, config);
            }
        }
Ejemplo n.º 3
0
        public Start()
        {
            InitializeComponent();
            WinBlogXConfig config = WinBlogXConfig.Load();

            foreach (string file in config.StartDialog.Mru)
            {
                existingProjects.Items.Add(file);
            }
            existingProjects.Items.Add("More...");
        }
Ejemplo n.º 4
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));
            }
        }