internal static ProjectScanStatuses BindProject(Entities.Project project)
        {
            Logger.Create().Debug("BindProjectByType in");
            ProjectScanStatuses status = ProjectScanStatuses.CanceledByUser;

            try
            {
                status = LoginAndBindSelectedProject(project);
                if (status == ProjectScanStatuses.Success)
                {
                    ShowResultLogic showResultLogic = new ShowResultLogic();
                    showResultLogic.Act();

                    status = ProjectScanStatuses.Success;
                }
                else if (status == ProjectScanStatuses.CanceledByUser)
                {
                    //Do nothing...
                }
                else
                {
                    TopMostMessageBox.Show("Unable to retrieve results.", "Error", System.Windows.Forms.MessageBoxButtons.OK);
                }

                CommonActionsInstance.getInstance().ClearScanProgressView();

                CommonActionsInstance.getInstance().CloseScanProgressView();
            }
            catch (Exception err)
            {
                Logger.Create().Error(err);
            }
            return(status);
        }
        private void DoScan(Entities.Project project)
        {
            try
            {
                if (!LoginHelper.IsScanner)
                {
                    TopMostMessageBox.Show("User is not allowed to scan", "Error");
                    return;
                }

                // verify that was selected correct project
                if (!string.IsNullOrEmpty(project.RootPath))
                {
                    System.Threading.ThreadPool.QueueUserWorkItem(delegate(object state)
                    {
                        try
                        {
                            CxViewerAction.CxVSWebService.CxWSQueryVulnerabilityData[] scanData = null;
                            long scanId = 0;

                            ProjectScanStatuses status = _scanHelper.DoScan(project, IsIncremental, ref scanData, ref scanId);

                            if (status == ProjectScanStatuses.Success)
                            {
                                LoginData login = LoginHelper.LoadSaved();
                                PerspectiveHelper.ShowStored(scanData, login, scanId);
                                CommonActionsInstance.getInstance().ShowReportView();
                            }

                            CommonActionsInstance.getInstance().ClearScanProgressView();
                            CommonActionsInstance.getInstance().CloseScanProgressView();
                        }
                        catch (Exception err)
                        {
                            Logger.Create().Error(err);
                            LoginHelper.DoLogout();
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                TopMostMessageBox.Show(ex.Message, "Error");
                Logger.Create().Error(ex.ToString());
            }
        }