private List <string> GetListOfInstalledRPkgs() { List <string> installed = new List <string>(); try { PackageHelperMethods phm = new PackageHelperMethods(); UAReturn r = phm.ShowInstalledPackages();// ShowInstalledPackages(); if (r != null && r.Success && r.SimpleTypeData != null) { //SendToOutputWindow(r.CommandString, "Show Installed Packages"); string[] strarr = null; if (r.SimpleTypeData.GetType().Name.Equals("String")) { strarr = new string[1]; strarr[0] = r.SimpleTypeData as string; } else if (r.SimpleTypeData.GetType().Name.Equals("String[]")) { strarr = r.SimpleTypeData as string[]; } //strarr to list foreach (string s in strarr) { installed.Add(s); } } else { ////SendToOutputWindow(BSky.GlobalResources.Properties.Resources.ErrGettingInstalledPkgs, "", false); } } catch (Exception ex) { MessageBox.Show(BSky.GlobalResources.Properties.Resources.ErrGettingInstalledPkgs2, BSky.GlobalResources.Properties.Resources.ErrorOccurred); logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex); } return(installed); }
private void dfltAddPackageButton_Click(object sender, RoutedEventArgs e) { #region This code is same as in LoadPackageFRomListCommand.cs in OnExecute() //get package name from another window 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 = "Select Packages."; 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++; } #endregion foreach (string s in selectedpackages) { dfltpackagelistbox.Items.Add(s); } //ApplyPackageButton.IsEnabled = true; }