protected override void OnExecute(object param)
{
try
{
//string packagename = Microsoft.VisualBasic.Interaction.InputBox("Enter package name that you want to unload.", "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.ShowLoadedPackages();
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 = "UnLoad Library(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++;
}
//PackageHelperMethods phm = new PackageHelperMethods();
UAReturn r = phm.PackageFileUnload(selectedpackages);// PackageFileUnload(packagename);
if (r != null && r.Success)
{
SendToOutputWindow(BSky.GlobalResources.Properties.Resources.UnloadPkg, r.CommandString);
}
else
{
string error = string.Empty;
if (r != null && r.Error != null && r.Error.Length > 0)
{
error = r.Error;
}
SendToOutputWindow(BSky.GlobalResources.Properties.Resources.ErrUnloadingPkg, error);
}
}
catch (Exception ex)
{
MessageBox.Show(BSky.GlobalResources.Properties.Resources.ErrUnloadingPkg2, BSky.GlobalResources.Properties.Resources.ErrorOccurred);
logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
}
}