コード例 #1
0
ファイル: Form1.cs プロジェクト: olivierdagenais/sharp-notes
        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();
        }
コード例 #2
0
        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;
        }