protected override void OnExecute(object param)
{
try
{
//string packagename = Microsoft.VisualBasic.Interaction.InputBox("Enter package name that you want to uninstall.", "Load Library", "");
//if (string.IsNullOrEmpty(packagename))
//{
// //MessageBox.Show("Title/Command cannot be empty, Exiting Dialog install", "Info: Dialog Title Empty.");
// return;
//}
PackageHelperMethods phm = new PackageHelperMethods();
//UAReturn rlst = phm.ShowInstalledPackages();
UAReturn rlst = phm.ShowUserRLibInstalledPackages();
string[] strarr = phm.GetUAReturnStringResult(rlst);
//Create UI show list of installed packges so that user can select and load them
SelectPackagesWindow spw = new SelectPackagesWindow(strarr);
spw.header = "Uninstall Package(s)";
spw.ShowDialog();
IList <string> sel = spw.SelectedItems;
if (sel == null)
{
return;
}
string[] selectedpackages = new string[sel.Count];
int i = 0;
foreach (string s in sel)
{
selectedpackages[i] = s;
i++;
}
phm = new PackageHelperMethods();
UAReturn r = phm.PackageFileUninstall(selectedpackages);// PackageFileUninstall(packagename);
if (r != null && r.Success)
{
SendToOutputWindow(BSky.GlobalResources.Properties.Resources.UninstallPkg, r.CommandString, false);
}
else
{
string err = r.Error != null && r.Error.Length > 1 ? r.Error : string.Empty;
SendToOutputWindow(BSky.GlobalResources.Properties.Resources.ErrUninstallingPkg, err, false);
}
}
catch (Exception ex)
{
MessageBox.Show(BSky.GlobalResources.Properties.Resources.ErrUninstallingPkg, BSky.GlobalResources.Properties.Resources.ErrorOccurred);
logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
}
}