Ejemplo n.º 1
0
        private static async Task UpdateDatabaseAsync()
        {
            string      ErrorMessage;
            StorageFile ResourceFile;

            try
            {
                ResourceFile = await Package.Current.InstalledLocation.GetFileAsync(@"DataLayer\" + App.DefaultDBName);

                await ResourceFile.CopyAsync(ApplicationData.Current.LocalFolder, App.DefaultDBName, NameCollisionOption.ReplaceExisting);
            }
            catch (Exception e)
            {
                ErrorMessage = e.Message;
                //TODO: log message
            }
        }
Ejemplo n.º 2
0
        private static async Task CopyDatabaseAsync(string dbName)
        {
            string      ErrorMessage;
            StorageFile ResourceFile;

            try
            {
                ResourceFile = await Package.Current.InstalledLocation.GetFileAsync(@"DataLayer\" + dbName);

                StorageFolder dest = ApplicationData.Current.LocalFolder;
                await ResourceFile.CopyAsync(ApplicationData.Current.LocalFolder);

                // DEBUG
                //var instPath = ResourceFile.Path.ToString();
                //App.ContentPath = instPath.Remove(instPath.LastIndexOf('\\')+1);
                //App.ContentPath = dest.Path;
            }
            catch (Exception e)
            {
                ErrorMessage = e.Message;
                //TODO: log message
            }
        }