예제 #1
0
        private void load_default()
        {
            PictureList pl;

            pl = Picture.ExtractListFromPath(Environment.GetFolderPath(Environment.SpecialFolder.CommonPictures));
            Album a = new Album(pl, "Shared Pictures");
            albums = new AlbumList();
            albums.Add(a);
            albums.SetActive(a);
        }
예제 #2
0
        private void load()
        {
            string path = "Albums.xml";
            FileStream fs;

            if (!File.Exists(path))
            {
                fs = File.Create(path);
                fs.Close();
            }

            using (StreamReader rd = new StreamReader("Albums.xml"))
            {
                try
                {
                    albums = _xs.Deserialize(rd) as AlbumList;
                    if (albums.Count >= 1)
                    {
                        albums.SetActive(0);
                    }
                }
                catch (Exception excp)
                {
                    Console.WriteLine("********");
                    Console.WriteLine("********");
                    Console.WriteLine("******** " + excp.Message);
                    Console.WriteLine("******** " + excp.InnerException.Message);
                    Console.WriteLine("********");
                    Console.WriteLine("********");
                }
                finally
                {
                    rd.Close();
                }

                if (albums == null)
                {
                    load_default();
                    save();
                }
            }
        }