protected override void OnExecute(object param)
{
try
{
PackageHelperMethods phm = new PackageHelperMethods();
UAReturn rlst = phm.ShowInstalledPackages();
string[] installedpkgs = phm.GetUAReturnStringResult(rlst);
UAReturn rlst2 = phm.ShowLoadedPackages();
string[] loadededpkgs = phm.GetUAReturnStringResult(rlst2);
string[] strarr = phm.GetStringArrayUncommon(installedpkgs, loadededpkgs);
//Create UI show list of installed packges so that user can select and load them
SelectPackagesWindow spw = new SelectPackagesWindow(strarr);
spw.header = "Load 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++;
}
// Pass List of selected packages to load them
UAReturn r = phm.LoadPackageFromList(selectedpackages);// LoadPackageFromList();
if (r != null && r.Success)
{
SendToOutputWindow("Load Package(s)", r.CommandString);
}
else
{
if (r.CommandString != null && r.CommandString.Trim().Length < 1)
{
}
else if (r.CommandString != null && r.CommandString.Trim().Length > 0)
{
SendToOutputWindow("Error Loading Package(s)", r.CommandString);
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error while loading package.", "Error Occurred!");
logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
}
}