PackageFileInstall() public method

public PackageFileInstall ( string pkgfilenames, bool autoLoad = true, bool overwrite = false ) : UAReturn
pkgfilenames string
autoLoad bool
overwrite bool
return BSky.Statistics.Common.UAReturn
 protected override void OnExecute(object param)
 {
     //Window1 appwindow = LifetimeService.Instance.Container.Resolve<Window1>();
     try
     {
         bool           autoLoad = true, overwrite = true;
         OpenFileDialog openFileDialog = new OpenFileDialog();
         //// Get initial Dir ////
         //string initDir = confService.GetConfigValueForKey("InitialDirectory");
         //openFileDialog.InitialDirectory = initDir;
         openFileDialog.Filter      = FileNameFilter;
         openFileDialog.Multiselect = true;
         bool?output = openFileDialog.ShowDialog(Application.Current.MainWindow);
         if (output.HasValue && output.Value)
         {
             string[]             pkgfilenames = openFileDialog.FileNames;
             PackageHelperMethods phm          = new PackageHelperMethods();
             UAReturn             r            = phm.PackageFileInstall(pkgfilenames, autoLoad, overwrite);// PackageFileInstall(pkgfilenames);//openFileDialog.FileName);
             if (r != null && r.Success)
             {
                 SendToOutputWindow("Install Package", r.SimpleTypeData.ToString());
                 MessageBox.Show("Please restart BlueSky Application to use the updated BlueSky package(s)", "Restart BlueSky Application", MessageBoxButton.OK, MessageBoxImage.Warning);
             }
             else
             {
                 if (r != null)
                 {
                     string msg = r.SimpleTypeData as string;
                     SendToOutputWindow("Error Installing Package", msg);
                 }
             }
             ///Set initial Dir.///
             //initDir = Path.GetDirectoryName(openFileDialog.FileName);
             //confService.ModifyConfig("InitialDirectory", initDir);
             //confService.RefreshConfig();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error while installing package.", "Error Occurred!");
         logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
     }
 }
 protected override void OnExecute(object param)
 {
     //Window1 appwindow = LifetimeService.Instance.Container.Resolve<Window1>();
     try
     {
         bool autoLoad = true, overwrite = true;
         OpenFileDialog openFileDialog = new OpenFileDialog();
         //// Get initial Dir ////
         //string initDir = confService.GetConfigValueForKey("InitialDirectory");
         //openFileDialog.InitialDirectory = initDir;
         openFileDialog.Filter = FileNameFilter;
         openFileDialog.Multiselect = true;
         bool? output = openFileDialog.ShowDialog(Application.Current.MainWindow);
         if (output.HasValue && output.Value)
         {
             string[] pkgfilenames = openFileDialog.FileNames;
             PackageHelperMethods phm = new PackageHelperMethods();
             UAReturn r = phm.PackageFileInstall(pkgfilenames, autoLoad, overwrite);// PackageFileInstall(pkgfilenames);//openFileDialog.FileName);
             if (r != null && r.Success)
             {
                 SendToOutputWindow("Install Package", r.SimpleTypeData.ToString());
                 MessageBox.Show("Please restart BlueSky Application to use the updated BlueSky package(s)", "Restart BlueSky Application", MessageBoxButton.OK, MessageBoxImage.Warning);
             }
             else
             {
                 if (r != null)
                 {
                     string msg = r.SimpleTypeData as string;
                     SendToOutputWindow("Error Installing Package", msg);
                 }
             }
             ///Set initial Dir.///
             //initDir = Path.GetDirectoryName(openFileDialog.FileName);
             //confService.ModifyConfig("InitialDirectory", initDir);
             //confService.RefreshConfig();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error while installing package.", "Error Occurred!");
         logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
     }
 }
Ejemplo n.º 3
0
 protected override void OnExecute(object param)
 {
     //Window1 appwindow = LifetimeService.Instance.Container.Resolve<Window1>();
     try
     {
         OpenFileDialog openFileDialog = new OpenFileDialog();
         //// Get initial Dir 12Feb2013 ////
         //string initDir = confService.GetConfigValueForKey("InitialDirectory");
         //openFileDialog.InitialDirectory = initDir;
         openFileDialog.Filter      = FileNameFilter;
         openFileDialog.Multiselect = true;
         bool?output = openFileDialog.ShowDialog(Application.Current.MainWindow);
         if (output.HasValue && output.Value)
         {
             string[]             pkgfilenames = openFileDialog.FileNames;
             PackageHelperMethods phm          = new PackageHelperMethods();
             UAReturn             r            = phm.PackageFileInstall(pkgfilenames);// PackageFileInstall(pkgfilenames);//openFileDialog.FileName);
             if (r != null && r.Success)
             {
                 SendToOutputWindow(BSky.GlobalResources.Properties.Resources.InstallPkg, r.SimpleTypeData.ToString());
             }
             else
             {
                 if (r != null)
                 {
                     string msg = r.SimpleTypeData as string;
                     SendToOutputWindow(BSky.GlobalResources.Properties.Resources.ErrInstallingRPkg, msg);
                 }
             }
             ///Set initial Dir. 12Feb2013///
             //initDir = Path.GetDirectoryName(openFileDialog.FileName);
             //confService.ModifyConfig("InitialDirectory", initDir);
             //confService.RefreshConfig();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(BSky.GlobalResources.Properties.Resources.ErrInstallingRPkg2, BSky.GlobalResources.Properties.Resources.ErrorOccurred);
         logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
     }
 }
        protected override void OnExecute(object param)
        {
            Window1 appwindow = LifetimeService.Instance.Container.Resolve <Window1>();

            try
            {
                //Now trying to install R .zip packages from local drive (minimum required R packages)
                InstallRequiredPackagesFromZip instRzip = new InstallRequiredPackagesFromZip();
                instRzip.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                instRzip.ShowDialog();
                string zipPath = instRzip.SelectedZipPath;
                if (zipPath.Length > 0)
                {
                    if (Directory.Exists(zipPath))
                    {
                        string[] zipFiles = null;
                        appwindow.setLMsgInStatusBar("Please wait ... Installing required R packages from local drive...");
                        ShowMouseBusy();
                        zipFiles = Directory.GetFiles(zipPath, "*.zip");
                        if (zipFiles == null || zipFiles.Length == 0)
                        {
                            MessageBox.Show("The path you have selected does not contain any R zip package files. Try again.", "No R package files found", MessageBoxButton.OK, MessageBoxImage.Warning);
                        }
                        else
                        {
                            PackageHelperMethods phm = new PackageHelperMethods();
                            UAReturn             r   = phm.PackageFileInstall(zipFiles);// PackageFileInstall(pkgfilenames);//openFileDialog.FileName);
                            if (r != null && r.Success)
                            {
                                SendToOutputWindow("Package(s) Installation Status:", r.SimpleTypeData.ToString());//"Install Package"
                            }
                            else
                            {
                                if (r != null)
                                {
                                    string msg = r.SimpleTypeData as string;
                                    SendToOutputWindow("Package(s) Installation Status:", msg);//"Error Installing Packages:"
                                }
                            }
                            ///Set initial Dir. 12Feb2013///
                            //initDir = Path.GetDirectoryName(openFileDialog.FileName);
                            //confService.ModifyConfig("InitialDirectory", initDir);
                            //confService.RefreshConfig();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid Path.", "Path not valid", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
                else//cancel minimum required install process
                {
                    MessageBox.Show("BlueSky application may not work properly if the required R pacakges are missing.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                ShowMouseFree();
            }
            catch (Exception ex)
            {
                ShowMouseFree();
                MessageBox.Show("Error while installing package.", "Error Occurred!");
                logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
            }
            appwindow.setLMsgInStatusBar("");
        }
Ejemplo n.º 5
0
        protected override void OnExecute(object param)
        {
            Window1 appwindow = LifetimeService.Instance.Container.Resolve <Window1>();

            try
            {
                //Now trying to install R .zip packages from local drive (minimum required R packages)
                InstallRequiredPackagesFromZip instRzip = new InstallRequiredPackagesFromZip();
                instRzip.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                instRzip.ShowDialog();
                string zipPath = instRzip.SelectedZipPath;
                if (zipPath.Length > 0)
                {
                    if (Directory.Exists(zipPath))
                    {
                        string[] zipFiles = null;
                        appwindow.setLMsgInStatusBar(BSky.GlobalResources.Properties.Resources.PlzWait + " " + BSky.GlobalResources.Properties.Resources.InstallingRPkgFromLocal);
                        ShowMouseBusy();
                        zipFiles = Directory.GetFiles(zipPath, "*.zip");
                        if (zipFiles == null || zipFiles.Length == 0)
                        {
                            MessageBox.Show(BSky.GlobalResources.Properties.Resources.RZipPkgNotInPath, BSky.GlobalResources.Properties.Resources.NoRPkgFound, MessageBoxButton.OK, MessageBoxImage.Warning);
                        }
                        else
                        {
                            PackageHelperMethods phm = new PackageHelperMethods();
                            UAReturn             r   = phm.PackageFileInstall(zipFiles);// PackageFileInstall(pkgfilenames);//openFileDialog.FileName);
                            if (r != null && r.Success)
                            {
                                SendToOutputWindow(BSky.GlobalResources.Properties.Resources.RPkgInstallStatus, r.SimpleTypeData.ToString());//"Install Package"
                            }
                            else
                            {
                                if (r != null)
                                {
                                    string msg = r.SimpleTypeData as string;
                                    SendToOutputWindow(BSky.GlobalResources.Properties.Resources.RPkgInstallStatus, msg);//"Error Installing Packages:"
                                }
                            }
                            ///Set initial Dir. 12Feb2013///
                            //initDir = Path.GetDirectoryName(openFileDialog.FileName);
                            //confService.ModifyConfig("InitialDirectory", initDir);
                            //confService.RefreshConfig();
                        }
                    }
                    else
                    {
                        MessageBox.Show(BSky.GlobalResources.Properties.Resources.InvalidPath, BSky.GlobalResources.Properties.Resources.InvalidPath2, MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
                else//cancel minimum required install process
                {
                    MessageBox.Show(BSky.GlobalResources.Properties.Resources.BSkyNotWorkReqPkgMissing,
                                    BSky.GlobalResources.Properties.Resources.warning, MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                ShowMouseFree();
            }
            catch (Exception ex)
            {
                ShowMouseFree();
                MessageBox.Show(BSky.GlobalResources.Properties.Resources.ErrInstallingRPkg2, BSky.GlobalResources.Properties.Resources.ErrorOccurred);
                logService.WriteToLogLevel("Error:", LogLevelEnum.Error, ex);
            }
            appwindow.setLMsgInStatusBar("");
        }