private void InstallPackage([NotNull] string serverFileName) { Debug.ArgumentNotNull(serverFileName, nameof(serverFileName)); var d = new InstallPackageDialog(); d.Initialize(Site, serverFileName); AppHost.Shell.ShowDialog(d); }
private void Install([NotNull] PackageInformation package) { Debug.ArgumentNotNull(package, nameof(package)); var d = new InstallPackageDialog(); d.Initialize(package.Site, package.ServerFileName); AppHost.Shell.ShowDialog(d); }
private void InstallPackage([NotNull] object sender, [NotNull] RoutedEventArgs e) { Debug.ArgumentNotNull(sender, nameof(sender)); Debug.ArgumentNotNull(e, nameof(e)); if (Site == null) { return; } var dialog = new OpenFileDialog { Title = Resources.UploadViewer_Browse_Upload_Package_File, CheckFileExists = true, DefaultExt = @".zip", Filter = @"Packages|*.zip|All files|*.*" }; if (dialog.ShowDialog() != true) { return; } ExecuteCompleted completed = delegate(string response, ExecuteResult result) { if (!DataService.HandleExecute(response, result)) { return; } var packageListBox = PackageListBox; if (packageListBox != null) { var packageManager = packageListBox.GetAncestor <PackageManagerDialog>(); if (packageManager != null) { packageManager.RefreshSiteRepositories(); } } var d = new InstallPackageDialog(); d.Initialize(Site, response); AppHost.Shell.ShowDialog(d); }; var contents = File.ReadAllBytes(dialog.FileName); var data = Convert.ToBase64String(contents); Site.DataService.ExecuteAsync("Packages.Upload", completed, data, Path.GetFileName(dialog.FileName)); }
private void Install([NotNull] PackageInformation package) { Debug.ArgumentNotNull(package, nameof(package)); if (AppHost.MessageBox("The package will be uploaded to the web site before installing.\n\nAre you sure you want to continue?", Resources.Confirmation, MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK) { return; } var fileName = package.LocalFileName; if (!DataService.CheckFileSize(fileName, package.Site.Connection)) { return; } var contents = File.ReadAllBytes(fileName); var data = Convert.ToBase64String(contents); ExecuteCompleted completed = delegate(string response, ExecuteResult result) { if (!DataService.HandleExecute(response, result)) { return; } package.ServerFileName = response; var packageListBox = PackageListBox; if (packageListBox != null) { var packageManager = packageListBox.GetAncestor <PackageManagerDialog>(); if (packageManager != null) { packageManager.RefreshSiteRepositories(); } } var d = new InstallPackageDialog(); d.Initialize(package.Site, package.ServerFileName); AppHost.Shell.ShowDialog(d); }; package.Site.DataService.ExecuteAsync("Packages.Upload", completed, data, Path.GetFileName(fileName)); }
public override void Execute(object parameter) { var context = parameter as IFileSelectionContext; if (context == null) { return; } var file = context.Files.FirstOrDefault(); if (file == null) { return; } var d = new InstallPackageDialog(); d.Initialize(file.FileUri.Site, file.FileUri.ToServerPath()); AppHost.Shell.ShowDialog(d); }