public Form1() { InitializeComponent(); player = new Player( PlayNext ); library = Library.Load(libraryFile); UpdateLibrary(); new InterceptKeys(HandleGlobalKey); RefreshStatus(); timer = new System.Timers.Timer(1000) { AutoReset = true }; timer.Elapsed += timer_Elapsed; timer.Start(); }
public static Library Load(string path) { Library result; if (!File.Exists(path)) result = new Library(); else { var s = new XmlSerializer(typeof(Library)); using (var file = File.OpenRead(path)) result = (Library)s.Deserialize(file); } result.libraryFile = path; return result; }