Merge pull request #123 from awolowiecki720/dev/easyInstall
Dev/easy install
This commit is contained in:
Коммит
135db18e02
|
@ -33,7 +33,15 @@
|
|||
Command="{Binding Path=BrowseForAppPackageCommand}"
|
||||
ToolTipService.ToolTip="Browse for the application package file"
|
||||
FontSize="16"
|
||||
Width="50" Height="40"
|
||||
Width="30" Height="40"
|
||||
Canvas.Left="585"/>
|
||||
<Button
|
||||
x:Name="browseForParentFolder"
|
||||
Content="~"
|
||||
Command="{Binding BrowseForParentFolderCommand}"
|
||||
ToolTipService.ToolTip="Browse for the installation folder"
|
||||
FontSize="16"
|
||||
Width="30" Height="40"
|
||||
Canvas.Left="550"/>
|
||||
</Canvas>
|
||||
<TextBlock
|
||||
|
@ -96,5 +104,11 @@
|
|||
Width="50" Height="40"
|
||||
Canvas.Left="550" Canvas.Top="46"/>
|
||||
</Canvas>
|
||||
<RadioButton Content="x86" HorizontalAlignment="Left" VerticalAlignment="Stretch"
|
||||
GroupName="Architecture" IsChecked="True" Checked="RadioButton_Checked"/>
|
||||
<RadioButton Content="x64" HorizontalAlignment="Left" VerticalAlignment="Stretch"
|
||||
GroupName="Architecture" Checked="RadioButton_Checked"/>
|
||||
<RadioButton Content="ARM" HorizontalAlignment="Left" VerticalAlignment="Stretch"
|
||||
GroupName="Architecture" Checked="RadioButton_Checked"/>
|
||||
</StackPanel>
|
||||
</ContentDialog>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace HoloLensCommander
|
||||
|
@ -38,5 +39,15 @@ namespace HoloLensCommander
|
|||
// Return the user's selections.
|
||||
((GetAppInstallFilesDialogViewModel)this.DataContext).UpdateUserData(this.appInstallFiles);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle check event for the dependencies radio buttons.
|
||||
/// </summary>
|
||||
/// <param name="sender">The object sending the event.</param>
|
||||
/// <param name="e">Event arguments.</param>
|
||||
private void RadioButton_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
((GetAppInstallFilesDialogViewModel)this.DataContext).ProcessorArchitectureValue = ((RadioButton)sender).Content.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,12 @@ namespace HoloLensCommander
|
|||
t = this.BrowseForAppPackageAsync();
|
||||
});
|
||||
|
||||
this.BrowseForParentFolderCommand = new Command(
|
||||
(parameter) =>
|
||||
{
|
||||
t = this.BrowseForParentFolderAsync();
|
||||
});
|
||||
|
||||
this.RemoveDependencyFileCommand = new Command(
|
||||
(parameter) =>
|
||||
{
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Windows.Storage;
|
||||
using Windows.Storage.AccessCache;
|
||||
using Windows.Storage.Pickers;
|
||||
|
||||
namespace HoloLensCommander
|
||||
|
@ -33,6 +35,12 @@ namespace HoloLensCommander
|
|||
public ICommand BrowseForAppPackageCommand
|
||||
{ get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Command used to allow the user to browse for the folder that contains installation files.
|
||||
/// </summary>
|
||||
public ICommand BrowseForParentFolderCommand
|
||||
{ get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Command used to allow the user to remove a dependency file.
|
||||
/// </summary>
|
||||
|
@ -95,6 +103,71 @@ namespace HoloLensCommander
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the browse for parents folder command.
|
||||
/// </summary>
|
||||
/// <returns>Task object used for tracking method completion.</returns>
|
||||
private async Task BrowseForParentFolderAsync()
|
||||
{
|
||||
FolderPicker folderPicker = new FolderPicker();
|
||||
folderPicker.ViewMode = PickerViewMode.List;
|
||||
folderPicker.SuggestedStartLocation = PickerLocationId.ComputerFolder;
|
||||
folderPicker.CommitButtonText = "Select";
|
||||
folderPicker.FileTypeFilter.Add("*");
|
||||
|
||||
StorageFolder folder = await folderPicker.PickSingleFolderAsync();
|
||||
if (folder!=null)
|
||||
{
|
||||
string appxFolderToken = StorageApplicationPermissions.FutureAccessList.Add(folder);
|
||||
await AutoAddInstallFiles(appxFolderToken);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task AutoAddInstallFiles(string appxFolderToken)
|
||||
{
|
||||
StorageFolder appPackageFolder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(appxFolderToken);
|
||||
IReadOnlyList<StorageFile> files = await appPackageFolder.GetFilesAsync();
|
||||
|
||||
Func<StorageFile, bool> appxFilter = f => f.FileType.Equals(".appx") || f.FileType.Equals(".appxbundle");
|
||||
StorageFile appxFile = files.FirstOrDefault(appxFilter);
|
||||
if (appxFile == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.AppPackageFile = appxFile;
|
||||
|
||||
StorageFile certFile = files.FirstOrDefault(f => f.FileType.Equals(".cer"));
|
||||
if (certFile == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.AppCertificateFile = certFile;
|
||||
|
||||
DependencyFiles.Clear();
|
||||
DependencyFileNames.Clear();
|
||||
|
||||
StorageFolder dependenciesFolder = await appPackageFolder.GetFolderAsync(@"Dependencies\x86");
|
||||
|
||||
if (this.ProcessorArchitectureValue == "x64")
|
||||
{
|
||||
dependenciesFolder = await appPackageFolder.GetFolderAsync(@"Dependencies\x64");
|
||||
}
|
||||
|
||||
if (this.ProcessorArchitectureValue == "ARM")
|
||||
{
|
||||
dependenciesFolder = await appPackageFolder.GetFolderAsync(@"Dependencies\ARM");
|
||||
}
|
||||
|
||||
IReadOnlyList<StorageFile> dependencies = await dependenciesFolder.GetFilesAsync();
|
||||
foreach (StorageFile dependency in dependencies.Where(appxFilter))
|
||||
{
|
||||
this.DependencyFiles.Add(dependency.Path, dependency);
|
||||
this.DependencyFileNames.Add(dependency.Path);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the remove dependency file command.
|
||||
/// </summary>
|
||||
|
|
|
@ -96,6 +96,24 @@ namespace HoloLensCommander
|
|||
public ObservableCollection<string> DependencyFileNames
|
||||
{ get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the selected processor architecture for installing dependency files
|
||||
/// </summary>
|
||||
private string processorArchitectureValue;
|
||||
public string ProcessorArchitectureValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.processorArchitectureValue;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.processorArchitectureValue = value;
|
||||
this.NotifyPropertyChanged("ProcessorArchitectureValue");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the selected file in the dependency files list.
|
||||
/// </summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче