Ejemplo n.º 1
0
        public void ClearLocalDatabase()
        {
            var result = MessageBox.Show(AppResources.ClearLocalDatabaseConfirmation, AppResources.Confirm, MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                IsWorking = true;
                CacheService.CompressAsync(() =>
                {
                    long newLength;
                    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        var files = new List <TelegramFileInfo>();
                        newLength = GetDatabaseLength(store, files);
                    }

                    BeginOnUIThread(() =>
                    {
                        IsWorking           = false;
                        LocalDatabaseStatus = FileSizeConverter.Convert(newLength);

                        EventAggregator.Publish(new ClearLocalDatabaseEventArgs());
                    });
                });
            }
        }