Example #1
0
        /// <summary>
        /// Get a list of all Team Projects within the current Project Collection.
        /// </summary>
        /// <param name="projectState">The state of the Team Project(s) to query</param>
        /// <param name="count">The maximum number of Team Projects to return</param>
        /// <param name="skip">The number of Team Projects to skip</param>
        /// <returns>The list of Team Projects that match the criteria</returns>
        public async Task<IEnumerable<Project>> GetProjects(
            ProjectState projectState = ProjectState.All,
            int count = 0,
            int skip = 0)
        {
            var request = new TfsRestRequest("/_apis/projects");

            if (projectState != ProjectState.All)
            {
                request.AddParameter("statefilter", projectState.ToString());
            }

            if (count > 0)
            {
                request.AddParameter("top", count);
            }

            if (skip > 0)
            {
                request.AddParameter("$skip", skip);
            }

            Sequence<Project> projects = await Executor.Execute<Sequence<Project>>(request);
            return (projects != null) ? projects.Value : new List<Project>();
        }
Example #2
0
 public BuiltinPropertyInfo(ReflectedGetterSetter value, ProjectState projectState)
     : base(new LazyDotNetDict(value.PropertyType, projectState, true))
 {
     _value = value;
     _doc = null;
     _type = _value.PropertyType;
 }
Example #3
0
 public DictionaryInfo(HashSet<Namespace> keyTypes, HashSet<Namespace> valueTypes, ProjectState projectState, bool showClr)
     : base(projectState._dictType)
 {
     _keyTypes = keyTypes;
     _valueTypes = valueTypes;
     _getMethod = null;
 }
Example #4
0
 public Project(string name, DateTime startDate, string details, ProjectState state)
 {
     this.name = name;
     this.startDate = startDate;
     this.details = details;
     this.state = state;
 }
Example #5
0
 public Project(string projectName, DateTime projectStartDate, ProjectState projectState, string details = null)
 {
     this.ProjectName = projectName;
     this.ProjectStartDate = projectStartDate;
     this.ProjectState = projectState;
     this.Details = details;
 }
Example #6
0
 public BuiltinFieldInfo(ReflectedField value, ProjectState projectState)
     : base(new LazyDotNetDict(ClrModule.GetPythonType(value.FieldType), projectState, true))
 {
     _value = value;
     _doc = null;
     _type = ClrModule.GetPythonType(value.FieldType);
 }
 public Projects(string projectName, DateTime startDate, string detail, ProjectState state)
 {
     this.ProjectName = projectName;
     this.StartDate = startDate;
     this.Detail = detail;
     this.State = state;
 }
Example #8
0
 public Project(string projectName, DateTime projectStartDate, string details, ProjectState state)
 {
     this.ProjectName = projectName;
     this.ProjectStartDate = projectStartDate;
     this.Details = details;
     this.State = state;
 }
Example #9
0
 public ConstantInfo(object value, ProjectState projectState)
     : base((BuiltinClassInfo)projectState.GetNamespaceFromObjects(DynamicHelpers.GetPythonType(value)))
 {
     _value = value;
     _type = DynamicHelpers.GetPythonType(value);
     _builtinInfo = ((BuiltinClassInfo)projectState.GetNamespaceFromObjects(_type)).Instance;
 }
Example #10
0
 public Project(string projectName, string projectStartDate, string details, ProjectState projectState)
 {
     ProjectName = projectName;
     ProjectStartDate = projectStartDate;
     Details = details;
     ProjectState = projectState;
 }
Example #11
0
 public void CloseProject()
 {
     if (this.State == ProjectState.Open)
     {
         this.State = ProjectState.Closed;
     }
 }
        /// <summary>
        /// Gets all projects.
        /// </summary>
        /// <param name="client">The <see cref="ProjectHttpClient"/> to use.</param>
        /// <param name="stateFilter">Filter on team projects in a specific team project state.</param>
        /// <param name="pageSize">Page size to use while retrieving the projects.</param>
        /// <param name="includeCapabilities">Include capabilities (such as source control) in the team project result.</param>
        /// <param name="userState">The user state object.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public static async Task<IList<TeamProject>> GetAllProjects(this ProjectHttpClient client, ProjectState? stateFilter = null, int pageSize = 25, bool? includeCapabilities = null, object userState = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (client == null) throw new ArgumentNullException(nameof(client));
            if (pageSize <= 0) throw new ArgumentOutOfRangeException(nameof(pageSize));

            var result = new List<TeamProject>();

            int currentPage = 0;
            var currentProjectReferences = (await client.GetProjects(stateFilter, pageSize, currentPage, userState).ConfigureAwait(false)).ToList();
            while (currentProjectReferences.Count > 0)
            {
                foreach (var projectReference in currentProjectReferences)
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    result.Add(await client.GetProject(projectReference.Id, includeCapabilities, userState).ConfigureAwait(false));
                }

                // check whether the recently returned item(s) were less than the max page size
                if (currentProjectReferences.Count < pageSize)
                    break; // if so, break the loop as we've read all instances

                // otherwise continue
                cancellationToken.ThrowIfCancellationRequested();
                currentProjectReferences = (await client.GetProjects(stateFilter, pageSize, currentPage, userState).ConfigureAwait(false)).ToList();
            }

            cancellationToken.ThrowIfCancellationRequested();
            return result;
        }
Example #13
0
 public Project(string name, DateTime startDate, ProjectState state, string detail)
 {
     this.Name = name;
     this.startDate = startDate;
     this.State = state;
     this.Detail = detail;
 }
Example #14
0
 public BuiltinClassInfo(PythonType classObj, ProjectState projectState)
     : base(new LazyDotNetDict(classObj, projectState, true))
 {
     // TODO: Get parameters from ctor
     // TODO: All types should be shared via projectState
     _type = classObj;
     _doc = null;
 }
Example #15
0
        public BuiltinFunctionInfo(BuiltinFunction function, ProjectState projectState)
            : base(ClrModule.GetPythonType(typeof(BuiltinFunction)), projectState)
        {
            // TODO: get return information, parameters, members
            _function = function;

            _returnTypes = Utils.GetReturnTypes(function, projectState);
            _doc = null;
        }
Example #16
0
 public BuiltinModule(PythonModule module, ProjectState projectState, bool showClr)
     : base(new LazyDotNetDict(new object[] { module }, projectState, showClr))
 {
     object name;
     if (!module.Get__dict__().TryGetValue("__name__", out name) || !(name is string)) {
         _name = String.Empty;
     } else {
         _name = name as string;
     }
 }
Example #17
0
        internal BuiltinFunctionOverloadResult(ProjectState state, BuiltinFunction overload, int removedParams, string name, params ParameterResult[] extraParams)
            : base(null, name)
        {
            _overload = overload;
            _extraParameters = extraParams;
            _removedParams = removedParams;
            _projectState = state;

            CalculateDocumentation();
        }
Example #18
0
        public BuiltinMethodInfo(BuiltinMethodDescriptor method, ProjectState projectState)
            : base(ClrModule.GetPythonType(typeof(BuiltinMethodDescriptor)), projectState)
        {
            // TODO: get return information, parameters, members
            _method = method;

            var function = PythonOps.GetBuiltinMethodDescriptorTemplate(method);
            _returnTypes = Utils.GetReturnTypes(function, projectState);
            _doc = null;
        }
Example #19
0
 public void CloseProject()
 {
     if (this.state == ProjectState.Open)
     {
         this.state = ProjectState.Closed;
     }
     else
     {
         Console.WriteLine("The project is already closed.");
     }
 }
 public BuildProjectEventArgs(
     ProjectItem projectItem, 
     ProjectState projectState, 
     DateTime eventTime, 
     BuildedProject buildedProjectInfo)
 {
     ProjectItem = projectItem;
     ProjectState = projectState;
     EventTime = eventTime;
     BuildedProjectInfo = buildedProjectInfo;
 }
Example #21
0
 /* ****************************************************************** */
 /* Constructors                                                       */
 /* ****************************************************************** */
 public ProjectBE()
 {
     title = "";
     description = "";
     creator = null;
     code = "";
     creationDate = new DateTime();
     expirationDate = new DateTime();
     state = ProjectState.Closed;
     credit = 0.0f;
     lastVersion = new DateTime();
     gitDir = "";
 }
Example #22
0
        public void Init()
        {
            var sIndex = new IndexState();
            var qIndex = new IndexQueries(sIndex);
            var hIndex = new IndexEventhandlers(sIndex);

            GivenMembership = new MembershipEventhandlers(hIndex);

            var sProject = new ProjectState();
            var qProject = new ProjectQueries(qIndex);
            var hProject = new ProjectEventhandlers(sProject, hIndex);

            WhenProject = new Project(qProject, hProject);
            GivenProject = WhenProject.Handle;
            ThenProject = new Mock<Contracts.Projects.IHandleEvents>();
            WhenProject.Handle = ThenProject.Object;
        }
Example #23
0
        public ProjectBE(string title, string description,
                            UserBE creator, string code,
                            DateTime creationDate, DateTime expirationDate,
                            float credit, DateTime lastVersion,
                            string gitDir)
        {
            this.code = generateCode();
            this.state = ProjectState.Active;

            this.title = title;
            this.description = description;
            this.creator = creator;
            this.credit = credit;
            this.creationDate = creationDate;
            this.expirationDate = expirationDate;
            this.lastVersion = lastVersion;
            this.gitDir = gitDir;
        }
Example #24
0
        /// <summary>
        /// Auxiliary Constructor.
        /// Creates a new project business entity filling the fields
        /// with the provided ones.
        /// </summary>
        /// <param name="title">The title of the project.</param>
        /// <param name="description">The description of the project.</param>
        /// <param name="creator">The user which created the project.</param>
        /// <param name="code">The code of the project.</param>
        /// <param name="creationDate">The creation date.</param>
        /// <param name="expirationDate">The deadline of the project.</param>
        /// <param name="credit">The amount of credits the project has.</param>
        /// <param name="partitionCredit">The amount of credits in the current partition.</param>
        /// <param name="lastVersion">The date of the last partition.</param>
        /// <param name="gitDir">The git directory of the project.</param>
        public ProjectBE(string title, string description,
            UserBE creator, int code,
            DateTime creationDate, DateTime expirationDate,
            int credit, int partitionCredit, DateTime lastVersion,
            string gitDir)
        {
            this.code = code;
            this.state = ProjectState.Active;

            this.title = title;
            this.description = description;
            this.creator = creator;
            this.credit = credit;
            this.partitionCredit = partitionCredit;
            this.creationDate = creationDate;
            this.expirationDate = expirationDate;
            this.lastVersion = lastVersion;
            this.gitDir = gitDir;
        }
        //Save the modeling status
        public ProjectState PackProjectState()
        {
            ProjectState project = new ProjectState(this);

            return(project);
        }
Example #26
0
 private static bool HasAttribute <T>(this ProjectState state)
 {
     return(state.GetAttributes <T>().Length != 0);
 }
Example #27
0
 internal void AssignTo(Node assignStmt, Expression left, IAnalysisSet values)
 {
     if (left is NameExpression)
     {
         var l = (NameExpression)left;
         if (!string.IsNullOrEmpty(l.Name))
         {
             Scope.AssignVariable(
                 l.Name,
                 l,
                 _unit,
                 values
                 );
         }
     }
     else if (left is MemberExpression)
     {
         var l = (MemberExpression)left;
         if (!string.IsNullOrEmpty(l.Name))
         {
             foreach (var obj in Evaluate(l.Target))
             {
                 obj.SetMember(l, _unit, l.Name, values);
             }
         }
     }
     else if (left is IndexExpression)
     {
         var l        = (IndexExpression)left;
         var indexObj = Evaluate(l.Index);
         foreach (var obj in Evaluate(l.Target))
         {
             obj.SetIndex(assignStmt, _unit, indexObj, values);
         }
     }
     else if (left is SequenceExpression)
     {
         // list/tuple
         var l         = (SequenceExpression)left;
         var valuesArr = values.ToArray();
         for (int i = 0; i < l.Items.Count; i++)
         {
             if (valuesArr.Length > 0)
             {
                 foreach (var value in valuesArr)
                 {
                     AssignTo(assignStmt, l.Items[i], value.GetIndex(assignStmt, _unit, ProjectState.GetConstant(i)));
                 }
             }
             else
             {
                 AssignTo(assignStmt, l.Items[i], AnalysisSet.Empty);
             }
         }
     }
 }
 public bool IsMoreImportantThan(ProjectState state)
 {
     return(importance > state.importance);
 }
Example #29
0
 private static string GetDomainProjectName(ProjectState state, string domainName)
 {
     return(string.Format("{0}.{1}.Domain.{2}", state.NameSpace, state.Name, domainName));
 }
Example #30
0
 public override IDictionary <string, ISet <Namespace> > GetAllMembers(IModuleContext moduleContext)
 {
     return(ProjectState.GetAllMembers(_type, moduleContext));
 }
Example #31
0
        public async Task FindAsync(
            ProjectState state,
            HashSet <Checksum> searchingChecksumsLeft,
            Dictionary <Checksum, object> result,
            CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            // verify input
            Contract.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksum));
            Contract.ThrowIfFalse(this == stateChecksum);

            if (searchingChecksumsLeft.Count == 0)
            {
                return;
            }

            if (searchingChecksumsLeft.Remove(Checksum))
            {
                result[Checksum] = this;
            }

            if (searchingChecksumsLeft.Remove(Info))
            {
                result[Info] = state.ProjectInfo.Attributes;
            }

            if (searchingChecksumsLeft.Remove(CompilationOptions))
            {
                Contract.ThrowIfNull(state.CompilationOptions, "We should not be trying to serialize a project with no compilation options; RemoteSupportedLanguages.IsSupported should have filtered it out.");
                result[CompilationOptions] = state.CompilationOptions;
            }

            if (searchingChecksumsLeft.Remove(ParseOptions))
            {
                Contract.ThrowIfNull(state.ParseOptions, "We should not be trying to serialize a project with no compilation options; RemoteSupportedLanguages.IsSupported should have filtered it out.");
                result[ParseOptions] = state.ParseOptions;
            }

            if (searchingChecksumsLeft.Remove(Documents.Checksum))
            {
                result[Documents.Checksum] = Documents;
            }

            if (searchingChecksumsLeft.Remove(ProjectReferences.Checksum))
            {
                result[ProjectReferences.Checksum] = ProjectReferences;
            }

            if (searchingChecksumsLeft.Remove(MetadataReferences.Checksum))
            {
                result[MetadataReferences.Checksum] = MetadataReferences;
            }

            if (searchingChecksumsLeft.Remove(AnalyzerReferences.Checksum))
            {
                result[AnalyzerReferences.Checksum] = AnalyzerReferences;
            }

            if (searchingChecksumsLeft.Remove(AdditionalDocuments.Checksum))
            {
                result[AdditionalDocuments.Checksum] = AdditionalDocuments;
            }

            if (searchingChecksumsLeft.Remove(AnalyzerConfigDocuments.Checksum))
            {
                result[AnalyzerConfigDocuments.Checksum] = AnalyzerConfigDocuments;
            }

            ChecksumCollection.Find(state.ProjectReferences, ProjectReferences, searchingChecksumsLeft, result, cancellationToken);
            ChecksumCollection.Find(state.MetadataReferences, MetadataReferences, searchingChecksumsLeft, result, cancellationToken);
            ChecksumCollection.Find(state.AnalyzerReferences, AnalyzerReferences, searchingChecksumsLeft, result, cancellationToken);

            await ChecksumCollection.FindAsync(state.DocumentStates, searchingChecksumsLeft, result, cancellationToken).ConfigureAwait(false);

            await ChecksumCollection.FindAsync(state.AdditionalDocumentStates, searchingChecksumsLeft, result, cancellationToken).ConfigureAwait(false);

            await ChecksumCollection.FindAsync(state.AnalyzerConfigDocumentStates, searchingChecksumsLeft, result, cancellationToken).ConfigureAwait(false);
        }
Example #32
0
 public static bool IsStandByState(this ProjectState state)
 {
     return(state.HasAttribute <ProjectStateStandByAttribute>());
 }
Example #33
0
        private void ProcessProjectChange(Solution solution, ProjectId projectId)
        {
            this.AssertIsForeground();

            // Remove anything we have associated with this project.
            _projectToInstalledPackageAndVersion.TryRemove(projectId, out var projectState);

            var project = solution.GetProject(projectId);

            if (project == null)
            {
                // Project was removed.  Nothing needs to be done.
                return;
            }

            // We really only need to know the NuGet status for managed language projects.
            // Also, the NuGet APIs may throw on some projects that don't implement the
            // full set of DTE APIs they expect.  So we filter down to just C# and VB here
            // as we know these languages are safe to build up this index for.
            if (project.Language != LanguageNames.CSharp &&
                project.Language != LanguageNames.VisualBasic)
            {
                return;
            }

            // Project was changed in some way.  Let's go find the set of installed packages for it.
            var dteProject = _workspace.TryGetDTEProject(projectId);

            if (dteProject == null)
            {
                // Don't have a DTE project for this project ID.  not something we can query NuGet for.
                return;
            }

            var installedPackages = new MultiDictionary <string, string>();
            var isEnabled         = false;

            // Calling into NuGet.  Assume they may fail for any reason.
            try
            {
                var installedPackageMetadata = _packageServices.GetInstalledPackages(dteProject);
                foreach (var metadata in installedPackageMetadata)
                {
                    if (metadata.VersionString != null)
                    {
                        installedPackages.Add(metadata.Id, metadata.VersionString);
                    }
                }

                isEnabled = true;
            }
            catch (ArgumentException e) when(IsKnownNugetIssue(e))
            {
                // Nuget may throw an ArgumentException when there is something about the project
                // they do not like/support.
            }
            catch (Exception e) when(FatalError.ReportWithoutCrash(e))
            {
            }

            var state = new ProjectState(isEnabled, installedPackages);

            _projectToInstalledPackageAndVersion.AddOrUpdate(
                projectId, state, (_1, _2) => state);
        }
Example #34
0
 public void CloseProject()
 {
     this.ProjectState = ProjectState.Closed;
 }
Example #35
0
 public void CloseProject()
 {
     this.State = ProjectState.closed;
 }
Example #36
0
        internal ProjectEntry(ProjectState state, string moduleName, string filePath, IAnalysisCookie cookie)
        {
            Debug.Assert(moduleName != null);
            Debug.Assert(filePath != null);

            _projectState = state;
            _moduleName = moduleName ?? "";
            _filePath = filePath;
            _cookie = cookie;
            _myScope = new ModuleInfo(_moduleName, this);
            _unit = new AnalysisUnit(_tree, new InterpreterScope[] { _myScope.Scope }, null);
        }
Example #37
0
 public static bool IsErrorState(this ProjectState state)
 {
     return(state == ProjectState.BuildError || state == ProjectState.CleanError);
 }
Example #38
0
        public static ControlTemplate GetAssociatedContent(this ProjectState state)
        {
            var atts = state.GetAttributes <AssociatedProjectStateVectorIconAttribute>();

            return((atts.Length != 0) ? atts[0].ControlTemplate : null);
        }
Example #39
0
 public static bool IsSuccessState(this ProjectState state)
 {
     return(state.HasAttribute <ProjectStateSuccessAttribute>());
 }
 public bool TryGetProjectState(ProjectId projectId, out ProjectState state)
 {
     return(_projectStates.TryGetValue(projectId, out state));
 }
Example #41
0
 public override bool CanExecute(ProjectState project, List <ActionParameter> parameters)
 {
     return(IsParamOk(parameters, NameParameter));
 }
Example #42
0
 public static bool IsErrorState(this ProjectState state)
 {
     return(state.HasAttribute <ProjectStateErrorAttribute>());
 }
Example #43
0
        public void AddNewProjectWeb(string projectName, int projectPrice, string projectDescription, DateTime projectStartDate, DateTime projectEndDate, ProjectState projectState, int managerId, int departmantId)
        {
            bool delay = false;

            if (projectEndDate < DateTime.Now)
            {
                delay = true;
            }
            using (var db = new CompanyDbContext())
            {
                var project = new ProjectClass.Project
                {
                    ProjectName        = projectName,
                    ProjectPrice       = projectPrice,
                    ProjectDescription = projectDescription,
                    ProjectStartDate   = projectStartDate,
                    ProjectEndDate     = projectEndDate,
                    ProjectState       = projectState,
                    DepartmentId       = departmantId,
                    ProjectManagerId   = managerId,
                    Delayed            = delay
                };
                db.Projects.Add(project);
                db.SaveChanges();
            }
        }
 public override IDictionary <string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext)
 {
     return(ProjectState.GetAllMembers(_type, moduleContext));
 }
Example #45
0
        internal void AssignTo(Node assignStmt, Expression left, IAnalysisSet values)
        {
            if (left is ExpressionWithAnnotation)
            {
                left = ((ExpressionWithAnnotation)left).Expression;
                // "x:t=..." is a recommended pattern - we do not want to
                // actually assign the ellipsis in this case.
                if (values.Any(v => v.TypeId == BuiltinTypeId.Ellipsis))
                {
                    values = AnalysisSet.Create(values.Where(v => v.TypeId != BuiltinTypeId.Ellipsis), values.Comparer);
                }
            }

            if (left is NameExpression)
            {
                var l = (NameExpression)left;
                if (!string.IsNullOrEmpty(l.Name))
                {
                    Scope.AssignVariable(
                        l.Name,
                        l,
                        _unit,
                        values
                        );
                }
            }
            else if (left is MemberExpression)
            {
                var l = (MemberExpression)left;
                if (!string.IsNullOrEmpty(l.Name))
                {
                    foreach (var obj in Evaluate(l.Target))
                    {
                        obj.SetMember(l, _unit, l.Name, values);
                    }
                }
            }
            else if (left is IndexExpression)
            {
                var l        = (IndexExpression)left;
                var indexObj = Evaluate(l.Index);
                foreach (var obj in Evaluate(l.Target))
                {
                    obj.SetIndex(assignStmt, _unit, indexObj, values);
                }
            }
            else if (left is SequenceExpression)
            {
                // list/tuple
                var l         = (SequenceExpression)left;
                var valuesArr = values.ToArray();
                for (int i = 0; i < l.Items.Count; i++)
                {
                    if (valuesArr.Length > 0)
                    {
                        foreach (var value in valuesArr)
                        {
                            AssignTo(assignStmt, l.Items[i], value.GetIndex(assignStmt, _unit, ProjectState.GetConstant(i)));
                        }
                    }
                    else
                    {
                        AssignTo(assignStmt, l.Items[i], AnalysisSet.Empty);
                    }
                }
            }
        }
Example #46
0
 /// <summary>
 /// Vrati projekt do vychoziho stavu. Vola se vzdy po provedeni simulace pro jednu firmu.
 /// Nikde volani teto metody nepridavejte. Jeji volani je j*z implementovano v cyklu, ve kterem
 /// jsou spousteny simulace pro jednotlive firmy.
 /// </summary>
 public void Reset()
 {
     State       = ProjectState.Waiting;
     ManDaysDone = 0;
 }
        //Reconstruct the saved modeling status
        public void UnpackProjectState(ProjectState project)
        {
            //Unpack the virgin status of the project
            this.boolVirgin = project.VirginState;

            if (!boolVirgin)
            {
                //Unpack the lists that go into making the validation chart.
                this.listValidationSpecificity = project.ValidationDictionary["specificity"];
                this.listTruePos  = project.ValidationDictionary["tpos"];
                this.listTrueNeg  = project.ValidationDictionary["tneg"];
                this.listFalsePos = project.ValidationDictionary["fpos"];
                this.listFalseNeg = project.ValidationDictionary["fneg"];

                //Unpack the lists that are used to set the model's decision threshold
                this.listCandidateSpecificity = project.ThresholdingDictionary["specificity"];
                this.listCandidateThresholds  = project.ThresholdingDictionary["threshold"];
                this.intThresholdIndex        = project.ThresholdingIndex;

                //Unpack the contents of the threshold and exponent text boxes
                this.tbExponent.Text  = project.ExponentTextbox;
                this.tbThreshold.Text = project.ThresholdTextBox;

                //Unpack the user's selected transformation of the dependent variable.
                if (project.ModelState.DependentVariableTransform.Type == DependentVariableTransforms.none)
                {
                    this.rbValue.Checked = true;
                }
                else if (project.ModelState.DependentVariableTransform.Type == DependentVariableTransforms.Ln)
                {
                    this.rbLoge.Checked = true;
                }
                else if (project.ModelState.DependentVariableTransform.Type == DependentVariableTransforms.Log10)
                {
                    this.rbLog10.Checked = true;
                }
                else if (project.ModelState.DependentVariableTransform.Type == DependentVariableTransforms.Power)
                {
                    this.rbPower.Checked = true;
                }
                else
                {
                    this.rbValue.Checked = true;
                }

                //Now make sure the selected transformation is reflected behind the scenes, too.
                EventArgs e = new EventArgs();
                rbValue_CheckedChanged(this, e);
                rbLogeValue_CheckedChanged(this, e);
                rbLog10Value_CheckedChanged(this, e);
                rbPower_CheckedChanged(this, e);

                //Restore the model state.
                UnpackModelState(project.ModelState);

                //Now restore the elements of the user interface.
                this.pnlThresholdingButtons.Visible = project.ThresholdingButtonsVisible;
                this.btnSelectModel.Enabled         = project.ThresholdingButtonsVisible;
                PopulateResults(this.ipyModel);
                InitializeValidationChart();
                AnnotateChart();
            }
        }
 public Project(string projectName, DateTime projectStateDate, ProjectState state)
 {
     this.ProjectName      = projectName;
     this.ProjectStartDate = projectStateDate;
     this.State            = state;
 }
 public Project(string projectName, DateTime projectStateDate, ProjectState state, string details)
     : this(projectName, projectStateDate, state)
 {
     this.Details = details;
 }
Example #50
0
        private void Parse(bool enqueueOnly, CancellationToken cancel)
        {
#if DEBUG
            Debug.Assert(Monitor.IsEntered(this));
#endif
            var parse  = GetCurrentParse();
            var tree   = parse?.Tree;
            var cookie = parse?.Cookie;
            if (tree == null)
            {
                return;
            }

            var oldParent = MyScope.ParentPackage;
            if (FilePath != null)
            {
                ProjectState.ModulesByFilename[FilePath] = MyScope;
            }

            if (oldParent != null)
            {
                // update us in our parent package
                oldParent.AddChildPackage(MyScope, _unit);
            }
            else if (FilePath != null)
            {
                // we need to check and see if our parent is a package for the case where we're adding a new
                // file but not re-analyzing our parent package.
                string parentFilename;
                if (ModulePath.IsInitPyFile(FilePath))
                {
                    // subpackage
                    parentFilename = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(FilePath)), "__init__.py");
                }
                else
                {
                    // just a module
                    parentFilename = Path.Combine(Path.GetDirectoryName(FilePath), "__init__.py");
                }

                ModuleInfo parentPackage;
                if (ProjectState.ModulesByFilename.TryGetValue(parentFilename, out parentPackage))
                {
                    parentPackage.AddChildPackage(MyScope, _unit);
                }
            }

            _unit = new AnalysisUnit(tree, MyScope.Scope);
            AnalysisLog.NewUnit(_unit);

            MyScope.Scope.Children = new List <InterpreterScope>();
            MyScope.Scope.ClearNodeScopes();
            MyScope.Scope.ClearNodeValues();
            MyScope.Scope.ClearLinkedVariables();
            MyScope.Scope.ClearVariables();
            MyScope.ClearUnresolvedModules();
            _unit.State.ClearDiagnostics(this);

            MyScope.EnsureModuleVariables(_unit.State);

            foreach (var value in MyScope.Scope.AllVariables)
            {
                value.Value.EnqueueDependents();
            }

            // collect top-level definitions first
            var walker = new OverviewWalker(this, _unit, tree);
            tree.Walk(walker);

            MyScope.Specialize();

            // It may be that we have analyzed some child packages of this package already, but because it wasn't analyzed,
            // the children were not registered. To handle this possibility, scan analyzed packages for children of this
            // package (checked by module name first, then sanity-checked by path), and register any that match.
            if (ModulePath.IsInitPyFile(FilePath))
            {
                string pathPrefix = PathUtils.EnsureEndSeparator(Path.GetDirectoryName(FilePath));
                var    children   =
                    from pair in ProjectState.ModulesByFilename
                    // Is the candidate child package in a subdirectory of our package?
                    let fileName = pair.Key
                                   where fileName.StartsWithOrdinal(pathPrefix, ignoreCase: true)
                                   let moduleName = pair.Value.Name
                                                    // Is the full name of the candidate child package qualified with the name of our package?
                                                    let lastDot = moduleName.LastIndexOf('.')
                                                                  where lastDot > 0
                                                                  let parentModuleName = moduleName.Substring(0, lastDot)
                                                                                         where parentModuleName == MyScope.Name
                                                                                         select pair.Value;
                foreach (var child in children)
                {
                    MyScope.AddChildPackage(child, _unit);
                }
            }

            _unit.Enqueue();

            if (!enqueueOnly)
            {
                ProjectState.AnalyzeQueuedEntries(cancel);
            }

            // publish the analysis now that it's complete/running
            Analysis = new ModuleAnalysis(
                _unit,
                ((ModuleScope)_unit.Scope).CloneForPublish(),
                DocumentUri,
                AnalysisVersion
                );
        }
Example #51
0
 public SetInfo(HashSet <Namespace> valueTypes, ProjectState projectState, bool showClr)
     : base(projectState._setType)
 {
     _valueTypes = valueTypes;
 }
Example #52
0
        public void Find(
            ProjectState state,
            HashSet <Checksum> searchingChecksumsLeft,
            Dictionary <Checksum, object> result,
            CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            // verify input
            Contract.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksum));
            Contract.ThrowIfFalse(this == stateChecksum);

            if (searchingChecksumsLeft.Remove(Checksum))
            {
                result[Checksum] = this;
            }

            if (searchingChecksumsLeft.Remove(Info))
            {
                result[Info] = state.ProjectInfo.Attributes;
            }

            if (searchingChecksumsLeft.Remove(CompilationOptions))
            {
                result[CompilationOptions] = state.CompilationOptions;
            }

            if (searchingChecksumsLeft.Remove(ParseOptions))
            {
                result[ParseOptions] = state.ParseOptions;
            }

            if (searchingChecksumsLeft.Remove(Documents.Checksum))
            {
                result[Documents.Checksum] = Documents;
            }

            if (searchingChecksumsLeft.Remove(ProjectReferences.Checksum))
            {
                result[ProjectReferences.Checksum] = ProjectReferences;
            }

            if (searchingChecksumsLeft.Remove(MetadataReferences.Checksum))
            {
                result[MetadataReferences.Checksum] = MetadataReferences;
            }

            if (searchingChecksumsLeft.Remove(AnalyzerReferences.Checksum))
            {
                result[AnalyzerReferences.Checksum] = AnalyzerReferences;
            }

            if (searchingChecksumsLeft.Remove(AdditionalDocuments.Checksum))
            {
                result[AdditionalDocuments.Checksum] = AdditionalDocuments;
            }

            Find(state.DocumentStates, searchingChecksumsLeft, result, cancellationToken);
            Find(state.ProjectReferences, ProjectReferences, searchingChecksumsLeft, result, cancellationToken);
            Find(state.MetadataReferences, MetadataReferences, searchingChecksumsLeft, result, cancellationToken);
            Find(state.AnalyzerReferences, AnalyzerReferences, searchingChecksumsLeft, result, cancellationToken);
            Find(state.AdditionalDocumentStates, searchingChecksumsLeft, result, cancellationToken);
        }
Example #53
0
 public static ProjectKey ToProjectKey(SolutionState solutionState, ProjectState projectState)
 => ToProjectKey(SolutionKey.ToSolutionKey(solutionState), projectState);
Example #54
0
 public EnumInstanceInfo(object value, ProjectState projectState)
     : base(value, projectState)
 {
 }
Example #55
0
 public static ProjectKey ToProjectKey(SolutionKey solutionKey, ProjectState projectState)
 => new(solutionKey, projectState.Id, projectState.FilePath, projectState.Name, projectState.GetParseOptionsChecksum());
Example #56
0
 public XamlProjectEntry(ProjectState projectState, string filename)
 {
     _projectState = projectState;
     _filename = filename;
 }
        //public async Task<List<ProjectDTO>> PrepareProjects(List<ProjectDTO> list)
        //{
        //    foreach (var i in list)
        //    {
        //        await GetProjectAmountAndProgress(i);
        //        GetRemainingTime(i);
        //    }

        //    return list;
        //}

        public async Task <TransactionResult> SaveProjectTransaction(ProjectDTO projectDTO, string user)
        {
            try
            {
                AspNetUsers _user = await context.AspNetUsers.Where(u => u.UserName == user).FirstOrDefaultAsync();

                ProjectCategory _projectCategory = null;
                if (projectDTO.CategoryFK != null)
                {
                    _projectCategory = await context.ProjectCategory.FindAsync(projectDTO.CategoryFK);
                }
                ProjectState _projectState = null;
                if (projectDTO.StateFK != null)
                {
                    _projectState = await context.ProjectState.FindAsync(projectDTO.StateFK);
                }

                if (projectDTO.Id == null || projectDTO.Id == 0)
                {
                    Project project = new Project()
                    {
                        AspNetUsers      = _user,
                        Title            = projectDTO.Title,
                        Description      = projectDTO.Description,
                        ShortDescription = projectDTO.ShortDescription,
                        Goal             = projectDTO.Goal,
                        Video            = projectDTO.Video,
                        ProjectCategory  = _projectCategory,
                        DueDate          = projectDTO.DueDate,
                        IsActive         = true,
                        ProjectState     = _projectState,
                        CreatedDate      = DateTime.Now
                    };
                    context.Project.Add(project);
                    await context.SaveChangesAsync();

                    return(new TransactionResult(TransResult.Success, "Success", null, project.Id));
                }
                else
                {
                    Project project = await context.Project.FindAsync(projectDTO.Id);

                    if (project.AspNetUsers != _user)
                    {
                        return(new TransactionResult(TransResult.Fail, "This is not your project", null));
                    }
                    project.Title            = projectDTO.Title;
                    project.Description      = projectDTO.Description;
                    project.ShortDescription = projectDTO.ShortDescription;
                    project.Goal             = projectDTO.Goal;
                    project.Video            = projectDTO.Video;
                    project.ProjectCategory  = _projectCategory;
                    project.DueDate          = projectDTO.DueDate;
                    project.IsActive         = true;
                    project.ProjectState     = _projectState;
                    await context.SaveChangesAsync();

                    return(new TransactionResult(TransResult.Success, "Success", null));
                }
            }
            catch (Exception ex) { return(new TransactionResult(TransResult.Fail, ex.Message, ex)); }
        }
Example #58
0
 public ProjectState CloseProject()
 {
     this.State = ProjectState.Closed;
     return this.State;
 }
        private void ProcessProjectChange(Solution solution, ProjectId projectId)
        {
            this.AssertIsForeground();

            // Remove anything we have associated with this project.
            _projectToInstalledPackageAndVersion.TryRemove(projectId, out var projectState);

            var project = solution.GetProject(projectId);

            if (project == null)
            {
                // Project was removed.  Nothing needs to be done.
                return;
            }

            // We really only need to know the NuGet status for managed language projects.
            // Also, the NuGet APIs may throw on some projects that don't implement the
            // full set of DTE APIs they expect.  So we filter down to just C# and VB here
            // as we know these languages are safe to build up this index for.
            if (project.Language != LanguageNames.CSharp &&
                project.Language != LanguageNames.VisualBasic)
            {
                return;
            }

            // Project was changed in some way.  Let's go find the set of installed packages for it.
            var dteProject = _workspace.TryGetDTEProject(projectId);

            if (dteProject == null)
            {
                // Don't have a DTE project for this project ID.  not something we can query NuGet for.
                return;
            }

            var installedPackages = new MultiDictionary <string, string>();
            var isEnabled         = false;

            // Calling into NuGet.  Assume they may fail for any reason.
            try
            {
                var installedPackageMetadata = _packageInstallerServices.Value.GetInstalledPackages(dteProject);
                foreach (var metadata in installedPackageMetadata)
                {
                    if (metadata.VersionString != null)
                    {
                        installedPackages.Add(metadata.Id, metadata.VersionString);
                    }
                }

                isEnabled = true;
            }
            catch (ArgumentException e) when(IsKnownNugetIssue(e))
            {
                // Nuget may throw an ArgumentException when there is something about the project
                // they do not like/support.
            }
            catch (InvalidOperationException e) when(e.StackTrace.Contains("NuGet.PackageManagement.VisualStudio.NetCorePackageReferenceProject.GetPackageSpecsAsync"))
            {
                // NuGet throws an InvalidOperationException if details
                // for the project fail to load. We don't need to report
                // these, and can assume that this will work on a future
                // project change
                // This should be removed with https://github.com/dotnet/roslyn/issues/33187
            }
            catch (Exception e) when(FatalError.ReportWithoutCrash(e))
            {
            }

            var state = new ProjectState(isEnabled, installedPackages);

            _projectToInstalledPackageAndVersion[projectId] = state;
        }
Example #60
-1
 public BuiltinEventInfo(ReflectedEvent value, ProjectState projectState)
     : base(ClrModule.GetPythonType(value.Info.EventHandlerType), projectState)
 {
     _value = value;
     _doc = null;
     _type = ClrModule.GetPythonType(value.Info.EventHandlerType);
 }