Exemplo n.º 1
0
        public virtual bool Equals(IXObject other)
        {
            if (object.ReferenceEquals(this, other))
            {
                return(true);
            }

            if (other is ISwObject)
            {
                if (this is IXTransaction && !((IXTransaction)this).IsCommitted)
                {
                    return(false);
                }

                if (other is IXTransaction && !((IXTransaction)other).IsCommitted)
                {
                    return(false);
                }

                return(Dispatch == (other as ISwObject).Dispatch);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 public IXObject Reload(IXObject pict, LocationData location, SourceData data, IXDrawing drw)
 {
     using (var freeze = new ViewFreeze(drw))
     {
         DeletePicture(pict, drw);
         return(CalculateLocationAndInsert(drw, location, data));
     }
 }
Exemplo n.º 3
0
        private void Process(object obj)
        {
            IXObject extObj = obj as IXObject;

            if (extObj != null && extObj.ConfigOptionsExtraction == ConfigOptionsExtraction.List)
            {
                ConfigOptionsCollection configOptions = extObj.ConfigOptions;

                foreach (KeyValuePair <int, ConfigOption> configOption in configOptions.PriorityProperties)
                {
                    try
                    {
                        this.ToExtConfig(obj, configOption.Value);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Error during ClientConfig initialization. "
                                            + configOption.Value.PropertyName.ToTitleCase()
                                            + " - "
                                            + ex.Message, ex);
                    }
                }

                foreach (KeyValuePair <string, ConfigOption> configOption in configOptions)
                {
                    try
                    {
                        this.ToExtConfig(obj, configOption.Value);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Error during ClientConfig initialization. "
                                            + configOption.Value.PropertyName.ToTitleCase()
                                            + " - "
                                            + ex.Message, ex);
                    }
                }
            }
            else
            {
                foreach (ConfigObject property in GetProperties(obj))
                {
                    try
                    {
                        this.ToExtConfig(obj, new ConfigOption(property.PropertyInfo.Name, this.ConfigOptionAttr2SerializationOptions(property.Attribute), property.DefaultValue, property.PropertyInfo.GetValue(obj, null)));
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Error during ClientConfig initialization. "
                                            + property.PropertyInfo.Name
                                            + " - "
                                            + ex.Message, ex);
                    }
                }
            }
        }
Exemplo n.º 4
0
    protected override void OnTriggerEnter2D(Collider2D other)
    {
        var prop = other.gameObject.GetComponent <IXObject>();

        if (prop != null && objectInFocus == null) // objectInFocus == null prevents multiple objects from being targeted at the same time
        {
            objectInFocus = prop;
            objectInFocus.OnEnterScope();
        }
    }
Exemplo n.º 5
0
 public virtual bool Equals(IXObject other)
 {
     if (other is ISwDmObject)
     {
         return((other as ISwDmObject).Dispatch == Dispatch);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 6
0
 public virtual bool IsSame(IXObject other)
 {
     if (other is SwObject)
     {
         return(Dispatch == (other as SwObject).Dispatch);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 7
0
        private void DeletePicture(IXObject pict, IXDocument doc)
        {
            var skPict = (ISketchPicture)((ISwObject)pict).Dispatch;

            if (skPict.GetFeature().Select2(false, -1))
            {
                if (!((ISwDocument)doc).Model.Extension.DeleteSelection2((int)swDeleteSelectionOptions_e.swDelete_Absorbed))
                {
                    throw new UserException("Failed to update QR code", new Exception("Failed to remove sketch picture"));
                }
            }
            else
            {
                throw new UserException("Failed to update QR code", new Exception("Failed to select sketch picture"));
            }
        }
Exemplo n.º 8
0
        public virtual bool IsSame(IXObject other)
        {
            if (object.ReferenceEquals(this, other))
            {
                return(true);
            }

            if (other is ISwObject)
            {
                return(Dispatch == (other as ISwObject).Dispatch);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 9
0
        public IXObject UpdateInPlace(IXObject pict, SourceData data, IXDrawing drw)
        {
            var skPict = (ISketchPicture)((ISwObject)pict).Dispatch;

            double width  = -1;
            double height = -1;
            double x      = -1;
            double y      = -1;

            skPict.GetSize(ref width, ref height);
            skPict.GetOrigin(ref x, ref y);

            using (var freeze = new ViewFreeze(drw))
            {
                DeletePicture(pict, drw);

                return(InsertAt(drw, data, width, height, x, y));
            }
        }
Exemplo n.º 10
0
 protected override void OnTriggerExit2D(Collider2D other)
 {
     objectInFocus?.OnLeaveScope();
     objectInFocus = null;
 }