public ReferenceField() { refMode = ReferenceMode.Normal; extensions = new Dictionary <Type, ReferenceFieldExtension>(); readOnlyExtensions = new ReadOnlyDictionary <Type, ReferenceFieldExtension>(extensions); builder = ReferenceTypeBuilder.Default; }
public static void Synchronize(FileSystem SourceFileSystem, String SourcePath, FileSystem DestinationFileSystem, String DestinationPath, SynchronizationMode _SynchronizationMode, ReferenceMode _ReferenceMode) { lock (SourceFileSystem) { lock (DestinationFileSystem) { var Synchronizer = new Synchronizer(SourceFileSystem, SourcePath, DestinationFileSystem, DestinationPath, _SynchronizationMode, _ReferenceMode); Synchronizer.SynchronizeFolder("/"); } } }
/// <summary> /// Translates from the reference mode object in the drop down list to the corresponding /// formatted string /// </summary> /// <param name="initialObject"></param> /// <param name="contentList"></param> /// <returns></returns> protected sealed override object TranslateToDisplayObject(object initialObject, IList contentList) { ReferenceMode mode = initialObject as ReferenceMode; if (mode != null) { int index = myModes.IndexOf(initialObject); if (index >= 0) { return(contentList[index]); } } return(initialObject); }
public ReferenceType(IdContainer Container, Identifier Child, ReferenceMode Mode, bool Calc = true) : base(Container, new CodeString()) { Setup(); this.Children = new Identifier[] { Child }; this.Mode = Mode; if (Child != null) { Access = Child.Access; } if (Calc) { Update(); } }
public ReferenceType(IdContainer Container, CodeString Name, Identifier Child, ReferenceMode Mode, bool DoUpdate = true) : base(Container, Name) { Setup(); this.Children = new Identifier[] { Child }; this.Mode = Mode; if (Child != null) { Access = Child.Access; } if (DoUpdate) { Update(); } }
public Synchronizer(FileSystem SourceFileSystem, String SourcePath, FileSystem DestinationFileSystem, String DestinationPath, SynchronizationMode _SynchronizationMode, ReferenceMode _ReferenceMode) { this.SourceFileSystem = SourceFileSystem; this.DestinationFileSystem = DestinationFileSystem; this.SourcePath = SourcePath; this.DestinationPath = DestinationPath; this._SynchronizationMode = _SynchronizationMode; this._ReferenceMode = _ReferenceMode; OnStep += delegate(double Value, String Details) { //Console.WriteLine("OnStep: " + Value + "; " + Details); }; OnError += delegate(Exception Exception) { Console.Error.WriteLine(Exception); }; }
/// <summary>See <see cref="TypeConverter.ConvertFrom(ITypeDescriptorContext,CultureInfo,Object)"/>.</summary> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (context != null) { string refMode = value as string; if (refMode != null) { object instance = EditorUtility.ResolveContextInstance(context.Instance, true); FactType factType; ObjectType objectType; if (null != (objectType = instance as ObjectType) || (null != (factType = instance as FactType) && null != (objectType = factType.NestingType))) { ReferenceMode singleMode = ReferenceMode.GetReferenceModeForDecoratedName(refMode, objectType.ResolvedModel, false); return((object)singleMode ?? refMode); } } } return(base.ConvertFrom(context, culture, value)); }
/// <summary> /// Returns a list of available reference mode kinds. /// </summary> /// <param name="context">ITypeDescriptorContext. Used to retrieve the selected instance</param> /// <param name="value">The current value</param> /// <returns>A list of candidates</returns> protected sealed override IList GetContentList(ITypeDescriptorContext context, object value) { ReferenceMode instance = (ReferenceMode)EditorUtility.ResolveContextInstance(context.Instance, true); ReadOnlyCollection <ReferenceModeKind> candidates = instance.Store.ElementDirectory.FindElements <ReferenceModeKind>(); int candidatesCount = candidates.Count; if (candidatesCount > 1) { // Make sure we're sorted ReferenceModeKind[] kinds = new ReferenceModeKind[candidatesCount]; string[] localizedNames = Utility.GetLocalizedEnumNames(typeof(ReferenceModeType), true); candidates.CopyTo(kinds, 0); Array.Sort <ReferenceModeKind>( kinds, delegate(ReferenceModeKind leftKind, ReferenceModeKind rightKind) { return(string.Compare(localizedNames[(int)leftKind.ReferenceModeType], localizedNames[(int)rightKind.ReferenceModeType], true, CultureInfo.CurrentCulture)); }); return(kinds); } return(candidates); }
/// <summary> Increment or Decrement a given Keys Reference count. </summary> public static void AdjustReferenceCountFor(ScrollableControl inControl, ReferenceMode inMode = ReferenceMode.Increment, bool inOrientHorz = true) { int UpdateReferenceCountFor(int key, ReferenceMode inRefMode = ReferenceMode.Increment) => Controller[key].Count += (int)inRefMode; //ContainsKey() is called before this. int hash = inControl.GetHashCode(); if ((inMode == ReferenceMode.Increment) && !Controller.ContainsKey(hash)) { Controller.Add(hash, new ControllerNode() { Count = 1 }); } else { if (UpdateReferenceCountFor(hash, inMode) < 1) { Controller.Remove(hash); } } }
/// <summary> /// Returns a list of role player candidates for a fact type. /// The nesting type is filtered out of the list. /// </summary> /// <param name="context">ITypeDescriptorContext. Used to retrieve the selected instance</param> /// <param name="value">The current value</param> /// <returns>A list of candidates</returns> protected sealed override IList GetContentList(ITypeDescriptorContext context, object value) { ObjectType instance = (ObjectType)EditorUtility.ResolveContextInstance(context.Instance, true); IList candidates = instance.ResolvedModel.ReferenceModeCollection; int candidateCount = candidates.Count; if (candidateCount == 0) { // If it's empty, we don't need to do anything else return(candidates); } else { // Make sure we're sorted, and only display the fully defined reference modes ReferenceMode[] modes = new ReferenceMode[candidateCount]; if (candidateCount > 1) { candidates.CopyTo(modes, 0); Array.Sort <ReferenceMode>( modes, delegate(ReferenceMode leftMode, ReferenceMode rightMode) { // Sort by decorated name return(string.Compare(leftMode.DecoratedName, rightMode.DecoratedName, true, CultureInfo.CurrentCulture)); }); } myModes = modes; string[] prettyStrings = new string[candidateCount]; for (int i = 0; i < prettyStrings.Length; ++i) { ReferenceMode refMode = modes[i]; prettyStrings[i] = string.Format(CultureInfo.InvariantCulture, ResourceStrings.ModelReferenceModePickerFormatString, refMode.DecoratedName, refMode.GenerateValueTypeName(instance.Name)); } candidates = prettyStrings; } return(candidates); }
/// <summary> /// Replaces the {0} and {1} with entityTypeName and referenceModeName /// </summary> /// <param name="mode">The <see cref="ReferenceMode"/> to format</param> /// <param name="forEditing">True to replace the reference mode name with the editable form of the name. /// Otherwise, use the reference mode name</param> private static string PrettyFormatString(ReferenceMode mode, bool forEditing) { return string.Format(mode.FormatString, ResourceStrings.ModelReferenceModeEditorEntityTypeName, forEditing ? ResourceStrings.ModelReferenceModeEditorReferenceModeName : mode.Name); }
/// <summary> /// Replaces the {0} and {1} with entityTypeName and referenceModeName /// </summary> /// <param name="mode">The <see cref="ReferenceMode"/> to format</param> /// <param name="forEditing">True to replace the reference mode name with the editable form of the name. /// Otherwise, use the reference mode name</param> private static string PrettyFormatString(ReferenceMode mode, bool forEditing) { return(string.Format(mode.FormatString, ResourceStrings.ModelReferenceModeEditorEntityTypeName, forEditing ? ResourceStrings.ModelReferenceModeEditorReferenceModeName : mode.Name)); }
/// <summary> /// Implements <see cref="IModelErrorActivation.ActivateModelError"/> for /// the <see cref="ValueComparisonConstraintOperatorNotSpecifiedError"/> /// </summary> protected new bool ActivateModelError(ModelError error) { ValueComparisonConstraintOperatorNotSpecifiedError operatorError; ValueComparisonRolesNotComparableError comparabilityError; ValueComparisonConstraint constraint; Store store; bool retVal = true; if (null != (operatorError = error as ValueComparisonConstraintOperatorNotSpecifiedError)) { store = Store; constraint = operatorError.ValueComparisonConstraint; EditorUtility.ActivatePropertyEditor( (store as IORMToolServices).ServiceProvider, DomainTypeDescriptor.CreatePropertyDescriptor(constraint, ValueComparisonConstraint.OperatorDomainPropertyId), true); } else if (null != (comparabilityError = error as ValueComparisonRolesNotComparableError)) { constraint = comparabilityError.ValueComparisonConstraint; LinkedElementCollection <Role> constraintRoles = constraint.RoleCollection; Role role1; Role role2; ObjectTypePlaysRole rolePlayerLink1; ObjectTypePlaysRole rolePlayerLink2; ObjectType rolePlayer1 = null; ObjectType rolePlayer2 = null; Role[] valueRoles1 = null; Role[] valueRoles2 = null; // The default behavior is to activate the role sequence // for editing. However, if the problem is with a single // resolved value type, and the units are correct, then // we need to select the first directly detached object. if (constraintRoles.Count == 2 && null != (rolePlayerLink1 = ObjectTypePlaysRole.GetLinkToRolePlayer(role1 = constraintRoles[0])) && null != (rolePlayerLink2 = ObjectTypePlaysRole.GetLinkToRolePlayer(role2 = constraintRoles[1])) && (rolePlayerLink1.RolePlayer == rolePlayerLink2.RolePlayer || (null != (valueRoles1 = role1.GetValueRoles()) && null != (valueRoles2 = role2.GetValueRoles()) && DataType.IsComparableValueType(rolePlayer1 = valueRoles1[0].RolePlayer, rolePlayer2 = valueRoles2[0].RolePlayer, !constraint.IsDirectional)))) { bool verifiedReferenceMode = true; if (valueRoles1 != null) { ORMModel model = null; ReferenceMode referenceMode1 = (valueRoles1.Length > 1) ? ReferenceMode.FindReferenceModeFromEntityNameAndValueName(rolePlayer1.Name, valueRoles1[1].RolePlayer.Name, model = constraint.ResolvedModel) : null; ReferenceMode referenceMode2 = (valueRoles2.Length > 1) ? ReferenceMode.FindReferenceModeFromEntityNameAndValueName(rolePlayer2.Name, valueRoles2[1].RolePlayer.Name, model ?? constraint.ResolvedModel) : null; bool referenceMode1IsUnit = referenceMode1 != null && referenceMode1.Kind.ReferenceModeType == ReferenceModeType.UnitBased; bool referenceMode2IsUnit = referenceMode2 != null && referenceMode2.Kind.ReferenceModeType == ReferenceModeType.UnitBased; verifiedReferenceMode = referenceMode1IsUnit ? (referenceMode2IsUnit && referenceMode1 == referenceMode2) : !referenceMode2IsUnit; } if (verifiedReferenceMode) { // Find a connected role player foreach (ExternalConstraintLink constraintLink in MultiShapeUtility.GetEffectiveAttachedLinkShapes <ExternalConstraintLink>(this)) { FactTypeShape factTypeShape; if (constraintLink.AssociatedConstraintRole.Role == role1 && null != (factTypeShape = constraintLink.FromShape as FactTypeShape)) { foreach (RolePlayerLink rolePlayerLinkShape in MultiShapeUtility.GetEffectiveAttachedLinkShapes <RolePlayerLink>(factTypeShape)) { if (rolePlayerLinkShape.AssociatedRolePlayerLink == rolePlayerLink1) { Diagram.ActiveDiagramView.Selection.Set(new DiagramItem(rolePlayerLinkShape.ToShape)); return(true); } } } } } } ActivateNewRoleSequenceConnectAction(null); } else { retVal = base.ActivateModelError(error); } return(retVal); }
public static extern int imaqBuildCoordinateSystem(ref Point points, ReferenceMode mode, AxisOrientation orientation, ref CoordinateSystem system);
private bool External(ReferenceMode x) { return((x >= ReferenceMode.Externalx1) && (x <= ReferenceMode.Externalx2)); }
public ReferenceField(XmlTextReader r, string version) : this() { string refTypeName; string refTypeNameSpace; if (r.Name != "ChildEntry") { throw new Exception(string.Format("Cannot load, expected ChildEntry, found '{0}'.", r.Name)); } r.MoveToAttribute("PropertyName"); this.Name = r.Value; r.MoveToContent(); r.Read(); CustomPrivateName = string.Empty; r.ReadElementString("CustomPrivateName"); CustomColumnName = string.Empty; r.ReadElementString("CustomColumnName"); refTypeName = r.ReadElementString("DataType"); if (r.Name == "Builder") { ReferenceTypeBuilder.Builders.TryGetValue(r.ReadElementString("Builder"), out builder); } refTypeNameSpace = r.ReadElementString("DataTypeNameSpace"); if (r.LocalName == "AllowNull") { allowNull = bool.Parse(r.ReadElementString("AllowNull")); } Caption = r.ReadElementString("Caption"); Description = r.ReadElementString("Description"); isTableCoded = bool.Parse(r.ReadElementString("IsTableCoded")); tableName = r.ReadElementString("TableName"); isUnique = bool.Parse(r.ReadElementString("IsUnique")); refMode = ParseChildEntryType(r.ReadElementString("ChildEntryType")); if (r.LocalName == "Group") { group = r.ReadElementString("Group"); } if (r.LocalName == "CascadeSaveEnabled") { cascadeSaveEnabled = bool.Parse(r.ReadElementString("CascadeSaveEnabled")); } else { cascadeSaveEnabled = true; } if (r.LocalName == "EnableCache") { enableCache = bool.Parse(r.ReadElementString("EnableCache")); } else { enableCache = false; } if (r.LocalName == "IsClientGridEnabled") { isClientGridEnabled = bool.Parse(r.ReadElementString("IsClientGridEnabled")); } if (r.LocalName == "IsClientEditEnabled") { isClientEditEnabled = bool.Parse(r.ReadElementString("IsClientEditEnabled")); } if (r.LocalName == "IsClientViewEnabled") { isClientViewEnabled = bool.Parse(r.ReadElementString("IsClientViewEnabled")); } if (r.LocalName == "IsClientCollectionAddEnabled") { isClientCollectionAddEnabled = bool.Parse(r.ReadElementString("IsClientCollectionAddEnabled")); } if (r.LocalName == "IsClientCollectionDeleteEnabled") { isClientCollectionDeleteEnabled = bool.Parse(r.ReadElementString("IsClientCollectionDeleteEnabled")); } if (r.LocalName == "IsClientCollectionEditEnabled") { isClientCollectionEditEnabled = bool.Parse(r.ReadElementString("IsClientCollectionEditEnabled")); } if (r.Name == "MetaAttributes") { if (!r.IsEmptyElement) { r.Read(); while (r.LocalName == "MetaAttribute") { attributes.Add(new MetaAttribute(r)); } r.ReadEndElement(); } else { r.Read(); } } if (r.Name == "Extensions") { if (!r.IsEmptyElement) { r.Read(); while (r.Name == "Extension") { ReferenceFieldExtension newExtension = (ReferenceFieldExtension) ObjectExtension.Build(r, version); extensions.Add(newExtension.GetType(), newExtension); } r.ReadEndElement(); } else { r.Read(); } } r.ReadEndElement(); // Create datatype refType = new ReferenceType(refTypeName, refTypeNameSpace); }
/// <summary> /// Initializes a new instance of the <see cref="ReferenceModeDeclaration"/> class. /// </summary> /// <param name="referenceMode">The object type.</param> public ReferenceModeDeclaration(ReferenceMode referenceMode) { myReferenceMode = referenceMode; }
public static extern int imaqCoordinateReference(ref Point points, ReferenceMode mode, ref Point origin, ref float angle);