ShowInstalledPackages() public method

public ShowInstalledPackages ( ) : UAReturn
return BSky.Statistics.Common.UAReturn
        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);
            }
        }
Ejemplo n.º 2
0
        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();
                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 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++;
                }

                phm = new PackageHelperMethods();
                UAReturn r = phm.PackageFileUninstall(selectedpackages);// PackageFileUninstall(packagename);
                if (r != null && r.Success)
                {
                    SendToOutputWindow(BSky.GlobalResources.Properties.Resources.UninstallPkg, r.CommandString);
                }
                else
                {
                    SendToOutputWindow(BSky.GlobalResources.Properties.Resources.ErrUninstallingPkg, "");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(BSky.GlobalResources.Properties.Resources.ErrUninstallingPkg, BSky.GlobalResources.Properties.Resources.ErrorOccurred);
                logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
            }
        }
        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();
                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 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++;
                }

                phm = new PackageHelperMethods();
                UAReturn r = phm.PackageFileUninstall(selectedpackages);// PackageFileUninstall(packagename);
                if (r != null && r.Success)
                {
                    SendToOutputWindow("Uninstall Package", r.CommandString);
                }
                else
                {
                    SendToOutputWindow("Error Uninstalling Package", "");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error while uninstalling package.", "Error Occurred!");
                logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
            }
        }
Ejemplo n.º 4
0
        public List <string> GetInstalledRPacakges()
        {
            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);
        }
        public List<string> GetInstalledRPacakges()
        {
            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("Error Getting Installed Packages", "");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error while getting installed packages.", "Error Occurred!");
                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;
        }