Ejemplo n.º 1
0
        private void CleanCacheHandler(object obj)
        {
            var appsFolder = $@"C:\Users\{Environment.UserName}\AppData\Local\Apps\2.0";
            var buildInfo  = new[]
            {
                new InfoData(
                    "Clean cache",
                    $@"You are going to clean local applications cache. Be sure that no deployed programs running now. Cache folder location: ""{
                        appsFolder}"". By the way cleaning can be done manually:{Environment.NewLine
                        }1. By cmd.exe command: ""rundll32 dfshim CleanOnlineAppCache""] {Environment.NewLine
                        }2. Or just remove [{appsFolder}] folder content.")
            };

            var buildModel = new BuildInfoViewModel(buildInfo);
            var buildView  = new BuildInfoView(buildModel)
            {
                Owner = Application.Current.MainWindow
            };

            if (buildView.ShowDialog().GetValueOrDefault())
            {
                string errorString, messageText;
                if (FlowUtils.CleanCache(out errorString))
                {
                    messageText = "Operation completed!";
                }
                else
                {
                    messageText = $"Unable complete cleaning cause of error:{Environment.NewLine}{errorString}";
                }

                MessageBox.Show(messageText, "Information", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }