/// <summary>
 /// Close command that handles saving of the notes for the databases.
 /// </summary>
 public void Closing()
 {
     CloseAllPreviews();
     GlobalSettings.Instance.SaveSettings();
     _cache.CleanCache();
     _favorites.CheckForRemovedFavorites();
 }
Example #2
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            FrameworkElement button = sender as FrameworkElement;

            switch (button.Tag as string)
            {
            case "gotoTestPage": Tools.Navigate(typeof(TestPage), null); break;

            case "checkUpdate": Settings.CheckUpdate(); break;

            case "reset":
                bool b = true;
                if (!string.IsNullOrEmpty(Settings.Get <string>("Uid")))
                {
                    MessageDialog dialog = new MessageDialog("进行此操作会同时退出登录。\n你确定吗?", "提示");
                    dialog.Commands.Add(new UICommand("是"));
                    dialog.Commands.Add(new UICommand("否"));
                    if ((await dialog.ShowAsync()).Label == "是")
                    {
                        Settings.Logout();
                    }
                    else
                    {
                        b = false;
                    }
                }
                if (b)
                {
                    ApplicationData.Current.LocalSettings.Values.Clear();
                }
                break;

            case "CleanCache":
                CleanCacheButton.IsEnabled = CacheContentListView.IsEnabled = false;
                foreach (var item in CacheContentListView.SelectedItems.Select(i => CacheContentListView.Items.IndexOf(i)))
                {
                    await ImageCache.CleanCache((ImageType)item);
                }
                CacheContentListView.SelectedIndex = -1;
                CacheContentListView.IsEnabled     = true;
                break;

            case "feedback":
                Tools.OpenLink("https://github.com/oboard/CoolApk-UWP/issues");
                break;
            }
        }