Exemplo n.º 1
0
        public static void SaveToIsolatedStorage()
        {
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (!gRouteTrackViewModel.CurrentRoute.IsFinished)
                {
                    using (IsolatedStorageFileStream fileStream = isf.CreateFile("CurrentRoute.xml"))
                    {
                        StreamWriter writter = new StreamWriter(fileStream);
                        writter.Write(GPointConverter.FromGRouteToIsolatedStorageFormat(gRouteTrackViewModel.CurrentRoute));
                        writter.Close();
                    }
                }

                using (IsolatedStorageFileStream fileStream = isf.CreateFile("Routes.xml"))
                {
                    StreamWriter writter = new StreamWriter(fileStream);
                    writter.Write(GPointConverter.FromGRoutesToIsolatedStorageFormat(gRouteTrackViewModel.RoutesOnPhone.ToList <GRoute>()));
                    writter.Close();
                }
            }
        }