Exemplo n.º 1
0
 public ActionStatus Act()
 {
     if (!_isBinded)
     {
         //bind
         if (PerspectiveHelper.LoginToServer() == null)
         {
             return(ActionStatus.Failed);
         }
         Entities.Project project = CommonActionsInstance.getInstance().GetSelectedProject();
         CommonData.ProjectName     = project.ProjectName;
         CommonData.ProjectRootPath = project.RootPath;
         if (!setBindProject(true))
         {
             return(ActionStatus.Failed);
         }
         CommonData.IsProjectBound = true;
         DoRetrieveResults(project);
         CommonData.IsWorkingOffline = false;
         return(ActionStatus.Success);
     }
     else
     {
         //unbind
         if (!setBindProject(false))
         {
             return(ActionStatus.Failed);
         }
         CommonData.IsProjectBound   = false;
         CommonData.IsWorkingOffline = false;
         return(ActionStatus.Success);
     }
 }
Exemplo n.º 2
0
        public ActionStatus Act()
        {
            if (PerspectiveHelper.LoginToServer() == null)
            {
                return(ActionStatus.Failed);
            }
            LoginData login = LoginHelper.LoadSaved();

            Entities.Project selectedProject = CommonActionsInstance.getInstance().GetSelectedProject();
            if (selectedProject == null)
            {
                return(ActionStatus.Failed);
            }
            CommonData.ProjectName     = selectedProject.ProjectName;
            CommonData.ProjectRootPath = selectedProject.RootPath;
            if (login != null && login.BindedProjects != null)
            {
                LoginData.BindProject bindPro = login.BindedProjects.Find(delegate(LoginData.BindProject bp)
                {
                    return(bp.ProjectName == selectedProject.ProjectName && bp.RootPath == selectedProject.RootPath);
                }
                                                                          );

                if (bindPro != null)
                {
                    CommonData.ProjectId       = bindPro.BindedProjectId;
                    CommonData.SelectedScanId  = bindPro.SelectedScanId;
                    CommonData.IsProjectBound  = bindPro.IsBound;
                    CommonData.IsProjectPublic = bindPro.IsPublic;
                }
                else
                {
                    CommonData.IsProjectBound = false;
                }
            }
            CommonActionsInstance.getInstance().BuildFileMapping();
            CommonActionsInstance.getInstance().ExecuteSystemCommand("File.SaveAll", string.Empty);
            DoScan(selectedProject);
            CommonData.IsWorkingOffline = false;
            return(ActionStatus.Success);
        }
Exemplo n.º 3
0
        public ActionStatus Act()
        {
            if (PerspectiveHelper.LoginToServer() == null)
            {
                return(ActionStatus.Failed);
            }
            LoginData login = LoginHelper.LoadSaved();

            Entities.Project selectedProject = CommonActionsInstance.getInstance().GetSelectedProject();
            if (selectedProject == null)
            {
                return(ActionStatus.Failed);
            }
            LoginData.BindProject bindPro = null;
            if (login != null && login.BindedProjects != null)
            {
                bindPro = login.BindedProjects.Find(delegate(LoginData.BindProject bp)
                {
                    return(bp.ProjectName == selectedProject.ProjectName && bp.RootPath == selectedProject.RootPath && bp.IsBound == true);
                }
                                                    );

                if (bindPro != null)
                {
                    CommonData.ProjectId       = bindPro.BindedProjectId;
                    CommonData.ProjectName     = selectedProject.ProjectName;
                    CommonData.ProjectRootPath = selectedProject.RootPath;
                }
                else
                {
                    return(ActionStatus.Failed);
                }
            }

            RetrieveResultsFromServer(bindPro, login);

            return(ActionStatus.Success);
        }