public PropertyValidationResult(ValidationStatus validationStatus, string message)
 {
     Status = validationStatus;
     IsValid = validationStatus == ValidationStatus.Valid;
     DisplayValidationError = validationStatus == ValidationStatus.Invalid;
     Message = message;
 }
Esempio n. 2
0
        /// <summary>
        /// Raises the draw keyword collection class entry event.
        /// </summary>
        /// <param name="position">Position.</param>
        /// <param name="element">Element in the list.</param>
        /// <param name="identifierGUIContent">Identifier GUI content.</param>
        /// <param name="existingIdentifierNames">Existing identifier names.</param>
        /// <param name="defaultStatus">Default status.</param>
        /// <param name="infoTooltip">Info tooltip.</param>
        /// <param name="missingStyleDescriptor">Missing style descriptor.</param>
        /// <param name="styles">Styles assigned to the <see cref="Candlelight.UI.HyperTextProcessor"/>.</param>
        /// <param name="assignedCollections">
        /// All <see cref="Candlelight.KeywordCollection"/> objects assigned to the
        /// <see cref="Candlelight.UI.HyperTextProcessor"/>.
        /// </param>
        private static void OnDrawKeywordCollectionClassEntry(
            Rect position,
            SerializedProperty element,
            GUIContent identifierGUIContent,
            IEnumerable <string> existingIdentifierNames,
            ValidationStatus defaultStatus,
            string infoTooltip,
            string missingStyleDescriptor,
            HyperTextStyles styles,
            IEnumerable <KeywordCollection> assignedCollections
            )
        {
            position.height = EditorGUIUtility.singleLineHeight;
            float oldLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 60f;
            position.width = (position.width - EditorGUIX.standardHorizontalSpacing) * 0.6f;
            SerializedProperty collectionProperty = element.FindPropertyRelative("m_Collection");
            ValidationStatus   collectionStatus   = ValidationStatus.Warning;

            if (collectionProperty.objectReferenceValue != null)
            {
                collectionStatus =
                    assignedCollections.Count(item => item == collectionProperty.objectReferenceValue) > 1 ?
                    ValidationStatus.Error : ValidationStatus.Okay;
            }
            EditorGUIX.DisplayPropertyFieldWithStatus(
                position,
                collectionProperty,
                collectionStatus,
                null,
                true,
                collectionStatus == ValidationStatus.Okay ?
                "" : collectionStatus == ValidationStatus.Error ?
                string.Format(
                    "Keyword collection {0} used for multiple different styles on this object.",
                    collectionProperty.objectReferenceValue.name
                    ) :
                "Assign a keyword collection to automatically apply this style to keywords."
                );
            EditorGUIUtility.labelWidth = 40f;
            position.x     += position.width;
            position.width *= 0.6666666667f;
            string           identifierName = element.FindPropertyRelative("m_ClassName").stringValue;
            ValidationStatus status         = defaultStatus;

            if (!string.IsNullOrEmpty(identifierName))
            {
                if (styles == null)
                {
                    infoTooltip =
                        "No styles assigned to this object. Keywords from this collection will use default style";
                    status = ValidationStatus.Warning;
                }
                else
                {
                    int matches = existingIdentifierNames.Count(existingId => existingId == identifierName);
                    if (matches == 1)
                    {
                        status      = ValidationStatus.Okay;
                        infoTooltip = string.Empty;
                    }
                    else
                    {
                        status      = ValidationStatus.Error;
                        infoTooltip = string.Format(
                            "No custom {0} {1} found in {2}.",
                            missingStyleDescriptor, identifierName, styles.name
                            );
                    }
                }
            }
            EditorGUIX.DisplayPropertyFieldWithStatus(
                position,
                element.FindPropertyRelative("m_ClassName"),
                status,
                identifierGUIContent,
                true,
                infoTooltip
                );
            EditorGUIUtility.labelWidth = oldLabelWidth;
        }
Esempio n. 3
0
 public override string FieldValidation(ValidationStatus validationStatus) => null;
Esempio n. 4
0
 public string TimeEditValidation(ValidationStatus validationStatus) => null;
Esempio n. 5
0
        public void T_Level()
        {
            level = Level.LT_Level;
            useTmaInsteadOfTsa = false;
            validationStatus = ValidationStatus.Valid;
            trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full;

            trace.TraceInformation("T-Level: Sealing");
            Stream output = Seal();

            trace.TraceInformation("T-Level: Verify");
            Verify(output);

            output.Position = 0;

            trace.TraceInformation("T-Level: Unseal");
            Unseal(output);

            output.Close();
        }
 new = PropertyValidationResult(ValidationStatus.Valid);
Esempio n. 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ValidationIssue"/> class.
        /// </summary>
        /// <param name="res">The resource.</param>
        /// <param name="stat">The validation status.</param>
        /// <param name="code">The validation status code.</param>
        /// <param name="msg">The message.</param>
        public ValidationIssue(IResource res, ValidationStatus stat, ValidationStatusCode code, string msg)
        {
            Check.NotNull(res, "res"); //NOXLATE
            Check.NotEmpty(msg, "msg"); //NOXLATE

            this.Resource = res;
            this.Status = stat;
            this.Message = msg;
            this.StatusCode = code;
        }
Esempio n. 8
0
 public override string SelectValidation(ValidationStatus validationStatus) => ToValidationStatus(validationStatus);
 private void validate(string serverAddress)
 {
     validationSidebar.SidebarSourceLocation = null;
     status = ValidationStatus.Validating;
     validationSidebar.Start(serverAddress);
     validateOptionsAndAdjustControlStates();
 }
Esempio n. 10
0
 public virtual string FileValidation(ValidationStatus validationStatus) => ValidationStatus(validationStatus);
Esempio n. 11
0
 public virtual string CheckValidation(ValidationStatus validationStatus) => ValidationStatus(validationStatus);
Esempio n. 12
0
 public string ValidateNormalize(string value, out ValidationStatus<StringValidationErrorCode> status)
 {
     if (value != null && (NormalizationFunctions_PreValidationFirst & StringNormalizationFunctions.TrimTrailingAsciiSpaces) != 0)
     {
         int n = value.Length;
         while (0 < n && value[n - 1] == ' ') --n;
         if (n == 0 && (NormalizationFunctions_PreValidationFirst & StringNormalizationFunctions.EmptyStringToNull) != 0)
         {
             value = null;
         }
         else
         {
             value = value.Substring(0, n);
         }
     }
     else if (value != null && value.Length == 0 && (NormalizationFunctions_PreValidationFirst & StringNormalizationFunctions.EmptyStringToNull) != 0)
     {
         value = null;
     }
     if (value != null && NormalizationFunction_PreValidationSecond != null)
     {
         value = NormalizationFunction_PreValidationSecond(value);
     }
     status = Validate(value);
     if (status == ValidationStatus<StringValidationErrorCode>.Success && value != null && NormalizationFunction_PostValidationIfValid != null)
     {
         value = NormalizationFunction_PostValidationIfValid(value);
     }
     return value;
 }
Esempio n. 13
0
        public void B_Level()
        {
            level = Level.B_Level;
            validationStatus = ValidationStatus.Valid;
            trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full;

            trace.TraceInformation("B-Level: Sealing");
            Stream output = Seal();

            trace.TraceInformation("B-Level: Verify");
            Verify(output);

            output.Position = 0;

            trace.TraceInformation("B-Level: Unseal");
            Unseal(output);

            output.Close();
        }
Esempio n. 14
0
        public void T_LevelTma()
        {
            level = Level.LT_Level;
            useTmaInsteadOfTsa = true;
            validationStatus = ValidationStatus.Valid;
            trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full;

            trace.TraceInformation("T-Level TMA: Seal");
            Stream output = Seal();

            trace.TraceInformation("T-Level TMA: Verify from TMA");
            VerifyFromTma(output);

            output.Position = 0;

            trace.TraceInformation("T-Level TMA: Verify as TMA");
            VerifyAsTma(output);

            output.Position = 0;

            trace.TraceInformation("T-Level TMA: Unseal");
            Unseal(output);

            output.Close();
        }
Esempio n. 15
0
        public async Task StartsNotStartedValidations(ValidationStatus startStatus, bool expectStorageUpdate, bool expectCleanup)
        {
            UseDefaultValidatorProvider();
            const string validationName = "validation1";
            var          validator      = AddValidation(validationName, TimeSpan.FromDays(1));
            var          validation     = ValidationSet.PackageValidations.First();

            ValidationStatus actualStatus = ValidationStatus.NotStarted;

            validator
            .Setup(v => v.GetResultAsync(It.IsAny <IValidationRequest>()))
            .ReturnsAsync(new ValidationResult(actualStatus))
            .Callback <IValidationRequest>(r => Assert.Equal(validation.Key, r.ValidationId));

            validator
            .Setup(v => v.StartAsync(It.IsAny <IValidationRequest>()))
            .ReturnsAsync(new ValidationResult(startStatus))
            .Callback <IValidationRequest>(r => {
                Assert.Equal(validation.Key, r.ValidationId);
                actualStatus = startStatus;
            })
            .Verifiable();

            ValidationStorageMock
            .Setup(vs => vs.MarkValidationStartedAsync(validation, It.Is <ValidationResult>(r => r.Status == startStatus)))
            .Returns(Task.FromResult(0))
            .Callback <PackageValidation, IValidationResult>((pv, vr) => pv.ValidationStatus = vr.Status)
            .Verifiable();

            var processor = CreateProcessor();
            await processor.ProcessValidationsAsync(ValidationSet);

            validator.Verify(v => v.StartAsync(It.IsAny <IValidationRequest>()), Times.AtLeastOnce());
            if (expectStorageUpdate)
            {
                ValidationStorageMock.Verify(
                    vs => vs.MarkValidationStartedAsync(validation, It.Is <ValidationResult>(r => r.Status == startStatus)), Times.Once);
                ValidationStorageMock.Verify(
                    vs => vs.MarkValidationStartedAsync(It.IsAny <PackageValidation>(), It.IsAny <ValidationResult>()), Times.Once);
                TelemetryServiceMock.Verify(
                    ts => ts.TrackValidatorStarted(ValidationSet.PackageId, ValidationSet.PackageNormalizedVersion, ValidationSet.ValidationTrackingId, validationName), Times.Once);
                TelemetryServiceMock.Verify(
                    ts => ts.TrackValidatorStarted(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Guid>(), It.IsAny <string>()), Times.Once);
            }
            else
            {
                ValidationStorageMock.Verify(
                    vs => vs.MarkValidationStartedAsync(It.IsAny <PackageValidation>(), It.IsAny <ValidationResult>()), Times.Never);
                TelemetryServiceMock.Verify(
                    ts => ts.TrackValidatorStarted(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Guid>(), It.IsAny <string>()), Times.Never);
            }

            if (expectCleanup)
            {
                validator.Verify(
                    x => x.CleanUpAsync(It.IsAny <IValidationRequest>()),
                    Times.Once);
            }
            else
            {
                validator.Verify(
                    x => x.CleanUpAsync(It.IsAny <IValidationRequest>()),
                    Times.Never);
            }
        }
Esempio n. 16
0
 public override string RadioValidation(ValidationStatus validationStatus) => ToValidationStatus(validationStatus);
 private void Validation_SidebarLoaded(object sender, SidebarDocumentLoadedEvenArgs e)
 {
     status = ValidationStatus.Success;
     validateOptionsAndAdjustControlStates();
     buttonOk.Focus();
 }
Esempio n. 18
0
 public override string TimeEditValidation(ValidationStatus validationStatus) => ToValidationStatus(validationStatus);
 private void Validation_SidebarSourceNotReachable(object sender, EventArgs e)
 {
     status = ValidationStatus.Failure;
     validateOptionsAndAdjustControlStates();
     textServerAddress.Focus();
 }
 public PropertyValidationResult(ValidationStatus validationStatus)
     : this(validationStatus, "")
 {
 }
        public virtual ValidationStatus Validate()
        {
            ValidationStatus loopStatus = MeshValidation.IsEdgeLoop(Mesh, Loop);

            return(loopStatus);
        }
 public ValidationException(string message, ValidationStatus validationStatus)
     : this(message)
 {
     this.ValidationStatus = validationStatus;
 }
Esempio n. 23
0
 public NumberBoxBuilder ValidationStatus(ValidationStatus value)
 {
     base.Options["validationStatus"] = value;
     return(this);
 }
Esempio n. 24
0
 public string NumericEditValidation(ValidationStatus validationStatus) => null;
Esempio n. 25
0
 public string TextValidation(ValidationStatus validationStatus) => null;
Esempio n. 26
0
 public string DatePickerValidation(ValidationStatus validationStatus) => null;
Esempio n. 27
0
 public ValidationsStatusChangedEventArgs(ValidationStatus status, IReadOnlyCollection <string> messages)
 {
     Status   = status;
     Messages = messages;
 }
Esempio n. 28
0
 public override string CheckValidation(ValidationStatus validationStatus) => ToValidationStatus(validationStatus);
Esempio n. 29
0
 public virtual string FileEditValidation(ValidationStatus validationStatus) => null;
Esempio n. 30
0
 /// <summary>
 /// Updates the validation status of the current object.
 /// </summary>
 /// <param name="status">The new validation status.</param>
 protected void UpdateValidationState(IValidationStatus status)
 {
     ValidationStatus = ValidationStatus.UpdateValidationStatus(status);
 }
Esempio n. 31
0
 public string NumericPickerValidation(ValidationStatus validationStatus) => null;
Esempio n. 32
0
        public bool Fill()
        {
            compute_polygon();

            // translate/scale fill loops to unit box. This will improve
            // accuracy in the calcs below...
            Vector2d shiftOrigin = Bounds.Center;
            double   scale       = 1.0 / Bounds.MaxDim;

            SpansPoly.Translate(-shiftOrigin);
            SpansPoly.Scale(scale * Vector2d.One, Vector2d.Zero);

            Dictionary <PlanarComplex.Element, int> ElemToLoopMap = new Dictionary <PlanarComplex.Element, int>();

            // generate planar mesh that we will insert polygons into
            MeshGenerator meshgen;
            float         planeW     = 1.5f;
            int           nDivisions = 0;

            if (FillTargetEdgeLen < double.MaxValue && FillTargetEdgeLen > 0)
            {
                int n = (int)((planeW / (float)scale) / FillTargetEdgeLen) + 1;
                nDivisions = (n <= 1) ? 0 : n;
            }

            if (nDivisions == 0)
            {
                meshgen = new TrivialRectGenerator()
                {
                    IndicesMap = new Index2i(1, 2), Width = planeW, Height = planeW,
                };
            }
            else
            {
                meshgen = new GriddedRectGenerator()
                {
                    IndicesMap   = new Index2i(1, 2), Width = planeW, Height = planeW,
                    EdgeVertices = nDivisions
                };
            }
            DMesh3 FillMesh = meshgen.Generate().MakeDMesh();

            FillMesh.ReverseOrientation();   // why?!?

            int[] polyVertices = null;

            // insert each poly
            MeshInsertUVPolyCurve insert = new MeshInsertUVPolyCurve(FillMesh, SpansPoly);
            ValidationStatus      status = insert.Validate(MathUtil.ZeroTolerancef * scale);
            bool failed = true;

            if (status == ValidationStatus.Ok)
            {
                if (insert.Apply())
                {
                    insert.Simplify();
                    polyVertices = insert.CurveVertices;
                    failed       = false;
                }
            }
            if (failed)
            {
                return(false);
            }

            // remove any triangles not contained in gpoly
            // [TODO] degenerate triangle handling? may be 'on' edge of gpoly...
            List <int> removeT = new List <int>();

            foreach (int tid in FillMesh.TriangleIndices())
            {
                Vector3d v = FillMesh.GetTriCentroid(tid);
                if (SpansPoly.Contains(v.xy) == false)
                {
                    removeT.Add(tid);
                }
            }
            foreach (int tid in removeT)
            {
                FillMesh.RemoveTriangle(tid, true, false);
            }

            //Util.WriteDebugMesh(FillMesh, "c:\\scratch\\CLIPPED_MESH.obj");

            // transform fill mesh back to 3d
            MeshTransforms.PerVertexTransform(FillMesh, (v) => {
                Vector2d v2 = v.xy;
                v2         /= scale;
                v2         += shiftOrigin;
                return(to3D(v2));
            });


            //Util.WriteDebugMesh(FillMesh, "c:\\scratch\\PLANAR_MESH_WITH_LOOPS.obj");
            //Util.WriteDebugMesh(MeshEditor.Combine(FillMesh, Mesh), "c:\\scratch\\FILLED_MESH.obj");

            // figure out map between new mesh and original edge loops
            // [TODO] if # of verts is different, we can still find correspondence, it is just harder
            // [TODO] should check that edges (ie sequential verts) are boundary edges on fill mesh
            //    if not, can try to delete nbr tris to repair
            IndexMap mergeMapV = new IndexMap(true);

            if (MergeFillBoundary && polyVertices != null)
            {
                throw new NotImplementedException("PlanarSpansFiller: merge fill boundary not implemented!");

                //int[] fillLoopVerts = polyVertices;
                //int NV = fillLoopVerts.Length;

                //PlanarComplex.Element sourceElem = (pi == 0) ? gsolid.Outer : gsolid.Holes[pi - 1];
                //int loopi = ElemToLoopMap[sourceElem];
                //EdgeLoop sourceLoop = Loops[loopi].edgeLoop;

                //for (int k = 0; k < NV; ++k) {
                //    Vector3d fillV = FillMesh.GetVertex(fillLoopVerts[k]);
                //    Vector3d sourceV = Mesh.GetVertex(sourceLoop.Vertices[k]);
                //    if (fillV.Distance(sourceV) < MathUtil.ZeroTolerancef)
                //        mergeMapV[fillLoopVerts[k]] = sourceLoop.Vertices[k];
                //}
            }

            // append this fill to input mesh
            MeshEditor editor = new MeshEditor(Mesh);

            int[] mapV;
            editor.AppendMesh(FillMesh, mergeMapV, out mapV, Mesh.AllocateTriangleGroup());

            // [TODO] should verify that we actually merged the loops...

            return(true);
        }
Esempio n. 33
0
 public string InputMaskValidation(ValidationStatus validationStatus) => null;
Esempio n. 34
0
 public override string SwitchValidation(ValidationStatus validationStatus) => ToValidationStatus(validationStatus);
Esempio n. 35
0
 public string CheckValidation(ValidationStatus validationStatus) => null;
Esempio n. 36
0
 public override string NumericEditValidation(ValidationStatus validationStatus) => ToValidationStatus(validationStatus);
Esempio n. 37
0
 public string RadioValidation(ValidationStatus validationStatus) => null;
Esempio n. 38
0
        /// <summary>
        /// Sets validation status (but only under certain conditions), appends error to list
        /// </summary>
        public void SetError(ValidationStatus validationStatus, ArrayList errorList, string error)
        {
            // don't change error to incomplete
            if(validationStatus == ValidationStatus.INCOMPLETE)
            {
                if(MarkupStatus != ValidationStatus.ERROR)
                    MarkupStatus = validationStatus;
            }
            else
            {
                MarkupStatus = validationStatus;
            }

            if( (validationStatus != ValidationStatus.OK) && (errorList != null) && (error != null) && (error.Length > 0) )
                errorList.Add(error);
        }
Esempio n. 39
0
 public string SwitchValidation(ValidationStatus validationStatus) => null;
Esempio n. 40
0
 /// <summary>
 /// Gets the issues for resource.
 /// </summary>
 /// <param name="resourceId">The resource id.</param>
 /// <param name="statType">Type of the stat.</param>
 /// <returns></returns>
 public ICollection<ValidationIssue> GetIssuesForResource(string resourceId, ValidationStatus statType)
 {
     var issues = new List<ValidationIssue>();
     foreach (var issue in GetIssuesForResource(resourceId))
     {
         if (issue.Status == statType)
             issues.Add(issue);
     }
     return issues;
 }
Esempio n. 41
0
 public string SliderValidation(ValidationStatus validationStatus) => null;
Esempio n. 42
0
 public string MemoEditValidation(ValidationStatus validationStatus) => null;
Esempio n. 43
0
 public string FieldValidation(ValidationStatus validationStatus) => null;
 public PeptideFileAnalysisData SetValidationStatus(ValidationStatus value)
 {
     return new PeptideFileAnalysisData(this) {ValidationStatus = value};
 }
Esempio n. 45
0
 public string SelectValidation(ValidationStatus validationStatus) => null;
 public ComboBoxItem(ValidationStatus validationStatus, String display)
 {
     Value = validationStatus;
     Display = display;
 }
Esempio n. 47
0
        public void LT_LevelIn3Steps()
        {
            level = Level.B_Level;
            useTmaInsteadOfTsa = false;
            validationStatus = ValidationStatus.Valid;
            trustStatus = EHealth.Etee.Crypto.Status.TrustStatus.Full;

            trace.TraceInformation("B-Level: seal");
            Stream output = Seal();

            trace.TraceInformation("T-Level: complete");
            level = Level.T_Level;
            output = Complete(output);

            trace.TraceInformation("LT-Level: complete");
            level = Level.LT_Level;
            output = Complete(output);

            trace.TraceInformation("LT-Level: verify");
            Verify(output);

            output.Position = 0;

            trace.TraceInformation("LT-Level: unseal");
            Unseal(output);

            output.Close();
        }