예제 #1
0
파일: MyApp.cs 프로젝트: benrnz-sv/Mikado1
        public static void SetStorageFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                var defaultDatabase = new ApplicationDatabase
                {
                    MyInt      = 11,
                    MyTextData = "The quick brown fox jumped over the lazy dog.",
                    NetWorth   = 25.21M,
                };
                using (var stream = new FileStream(fileName, FileMode.CreateNew))
                {
                    XamlServices.Save(stream, defaultDatabase);
                }
            }

            using (var stream = new FileStream(fileName, FileMode.Open))
            {
                MyData = (ApplicationDatabase)XamlServices.Load(stream);
            }
        }
예제 #2
0
파일: MyApp.cs 프로젝트: benrnz-sv/Mikado1
        public static void SetStorageFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                var defaultDatabase = new ApplicationDatabase
                {
                    MyInt = 11,
                    MyTextData = "The quick brown fox jumped over the lazy dog.",
                    NetWorth = 25.21M,
                };
                using (var stream = new FileStream(fileName, FileMode.CreateNew))
                {
                    XamlServices.Save(stream, defaultDatabase);
                }
            }

            using (var stream = new FileStream(fileName, FileMode.Open))
            {
                MyData = (ApplicationDatabase) XamlServices.Load(stream);
            }
        }