Exemplo n.º 1
0
        public SettingContentViewModel()
        {
            LoginOutCommand = new RelayCommand(async(state) =>
            {
                var dialogResult = await MessageDialogUtility.ShowMessageAsync("您确认要退出登录吗?", "退出登录");
                if (dialogResult == MessageDialogResult.OK)
                {
                    Global.ClearUserStatus();

                    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        if (Window.Current?.Content is Frame rootFrame)
                        {
                            rootFrame.BackStack.Clear();
                        }
                    });

                    await TryNavigateAsync(typeof(NoLoginView));
                }
            });

            ClearCacheCommand = new RelayCommand(async(state) =>
            {
                var dialogResult = await MessageDialogUtility.ShowMessageAsync("您确认要清除所有缓存吗?", "缓存清理");
                if (dialogResult == MessageDialogResult.OK)
                {
                    Global.ClearCacheSetting();

                    await LocalCacheUtility.ClearLocalCacheFile();

                    await MessageDialogUtility.ShowMessageAsync("缓存清理完成", "缓存清理", MessageDialogType.OK);

                    var cacheSize = await LocalCacheUtility.GetLocalCacheSizeAsync(true);
                    CacheSize     = VariousUtility.ByteSizeToString(cacheSize);
                }
            });

            AboutSoftWareLicenseCommand = new RelayCommand((state) =>
            {
                var args = new ContentPageArgs()
                {
                    Name           = "软件授权",
                    ContentElement = new SoftWareLicenseContentView(),
                };
                ContentNavigation(args);
            });

            AboutUsCommand = new RelayCommand((state) =>
            {
                var args = new ContentPageArgs()
                {
                    Name           = "关于我们",
                    ContentElement = new AboutUsContentView(),
                };
                ContentNavigation(args);
            });

            AboutSoftWareCommand = new RelayCommand((state) =>
            {
                var args = new ContentPageArgs()
                {
                    Name           = "免责声明",
                    ContentElement = new AboutSoftWareContentView(),
                };
                ContentNavigation(args);
            });
        }
Exemplo n.º 2
0
        protected override async Task InitializationAsync()
        {
            var cacheSize = await LocalCacheUtility.GetLocalCacheSizeAsync(true);

            CacheSize = VariousUtility.ByteSizeToString(cacheSize);
        }