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(); }
public static void Save(WinBlogXConfig config) { XmlSerializer ser = new XmlSerializer(typeof(WinBlogXConfig)); using (StreamWriter writer = new StreamWriter(FileName)) { ser.Serialize(writer, config); } }
public Start() { InitializeComponent(); WinBlogXConfig config = WinBlogXConfig.Load(); foreach (string file in config.StartDialog.Mru) { existingProjects.Items.Add(file); } existingProjects.Items.Add("More..."); }
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)); } }