コード例 #1
0
        private async void execute_AddCommand(object obj)
        {
            isWorking = true;
            AddCommand.RaiseCanExecuteChanged();
            RemoveCommand.RaiseCanExecuteChanged();
            var result = await PowerShellUtils.AddAppxPackageAsync(InstallLocation);

            await RefreshRegisterStatusAsync();

            if (result)
            {
                MessageBox.Show("添加成功!", nameof(WindowsAppsRegister), MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("添加失败!", nameof(WindowsAppsRegister), MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            isWorking = false;
            AddCommand.RaiseCanExecuteChanged();
            RemoveCommand.RaiseCanExecuteChanged();
        }
コード例 #2
0
        private static void GetPinnedStartMenuInformation()
        {
            var tempOutputPath = $"{Path.GetTempPath()}{"TileIconifier"}\\";

            Directory.CreateDirectory(tempOutputPath);

            var tempFilePath = $"{tempOutputPath}{Path.GetFileNameWithoutExtension(Path.GetRandomFileName())}.xml";

            PowerShellUtils.DumpStartLayout(tempFilePath);
            PowerShellUtils.MarryAppIDs(_shortcutsCache);

            MarkPinnedShortcuts(tempFilePath);

            _shortcutsCache = _shortcutsCache.ToList();

            try
            {
                File.Delete(tempFilePath);
            }
            catch
            {
                // ignored
            }
        }
コード例 #3
0
 public async Task RefreshRegisterStatusAsync()
 {
     IsAdded = await PowerShellUtils.GetAppxPackageRegistered(Id);
 }