Esempio n. 1
0
        private void CheckForTypeDublicatesAndName(object value)
        {
            if (!this.IsCorrectType(value))
            {
                throw new NotSupportedException(Utils.SRGetStr("ExceptionInvalidObjectType", this.GetCollectionName(), this.elementType.Name));
            }
            if (value is int && base.List.IndexOf(value) != -1)
            {
                throw new NotSupportedException(Utils.SRGetStr("ExceptionDuplicateObjectFailed", this.GetCollectionName()));
            }
            NamedElement namedElement = (NamedElement)value;

            if (namedElement.Name != null && !(namedElement.Name == string.Empty))
            {
                if (this.IsUniqueName(namedElement.Name))
                {
                    return;
                }
                throw new ArgumentException(Utils.SRGetStr("ExceptionDuplicateNameFailed"));
            }
            if (base.Count == 0)
            {
                namedElement.Name = this.GetDefaultElementName(namedElement);
            }
            else
            {
                namedElement.Name = this.GenerateUniqueName(namedElement);
            }
        }
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList arrayList = new ArrayList();

            if (context != null && context.Instance != null)
            {
                NamedElement namedElement = null;
                if (context.Instance is CalculatedValue)
                {
                    namedElement = (CalculatedValue)context.Instance;
                }
                if (namedElement == null && context.Instance is Array)
                {
                    Array array = (Array)context.Instance;
                    if (array.Length > 0 && array.GetValue(0) is CalculatedValue)
                    {
                        namedElement = (CalculatedValue)array.GetValue(0);
                    }
                }
                if (namedElement != null && namedElement.Collection != null)
                {
                    arrayList.Add(namedElement.Collection.parent.Name);
                    foreach (NamedElement item in namedElement.Collection)
                    {
                        if (item.Name != namedElement.Name)
                        {
                            arrayList.Add(item.Name);
                        }
                    }
                }
            }
            return(new StandardValuesCollection(arrayList));
        }
Esempio n. 3
0
        public bool IsParentElementValid(IRenderable r, object startObject, bool raiseException)
        {
            string parentRenderableName = r.GetParentRenderableName();

            if (parentRenderableName != string.Empty && parentRenderableName != "(none)")
            {
                NamedElement element = this.GetElement(parentRenderableName);
                if (element != null)
                {
                    if (element == startObject)
                    {
                        if (raiseException)
                        {
                            throw new ApplicationException(Utils.SRGetStr("ExceptionCircularReference"));
                        }
                        return(false);
                    }
                    if (!(element is IRenderable))
                    {
                        if (raiseException)
                        {
                            throw new ApplicationException(Utils.SRGetStr("ExceptionParentNotRenderable", parentRenderableName));
                        }
                        return(false);
                    }
                    return(this.IsParentElementValid((IRenderable)element, startObject, raiseException));
                }
                if (raiseException)
                {
                    throw new ApplicationException(Utils.SRGetStr("ExceptionInvalidParent", parentRenderableName));
                }
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
 public virtual void Notify(MessageType msg, NamedElement element, object param)
 {
     foreach (NamedElement item in this)
     {
         item.Notify(msg, element, param);
     }
 }
Esempio n. 5
0
 public override void Notify(MessageType msg, NamedElement element, object param)
 {
     base.Notify(msg, element, param);
     this.Scales.Notify(msg, element, param);
     this.Ranges.Notify(msg, element, param);
     this.Pointers.Notify(msg, element, param);
 }
        public override void Notify(MessageType msg, NamedElement element, object param)
        {
            base.Notify(msg, element, param);
            switch (msg)
            {
            case MessageType.NamedElementRemove:
                if (element is ScaleBase)
                {
                    ScaleBase scaleBase2 = (ScaleBase)element;
                    if (scaleBase2.Name == this.scaleName && scaleBase2.ParentElement == this.ParentElement && this.scaleName != "Default")
                    {
                        this.scaleName = string.Empty;
                    }
                }
                break;

            case MessageType.NamedElementRename:
                if (element is ScaleBase)
                {
                    ScaleBase scaleBase = (ScaleBase)element;
                    if (scaleBase.Name == this.scaleName && scaleBase.ParentElement == this.ParentElement)
                    {
                        this.scaleName = (string)param;
                    }
                }
                break;
            }
        }
 void ISelectable.DrawSelection(GaugeGraphics g, bool designTimeSelection)
 {
     if (this.GetGauge() != null && this.GetScale() != null)
     {
         Stack stack = new Stack();
         for (NamedElement namedElement = this.GetGauge().ParentObject; namedElement != null; namedElement = (NamedElement)((IRenderable)namedElement).GetParentRenderable())
         {
             stack.Push(namedElement);
         }
         foreach (IRenderable item in stack)
         {
             g.CreateDrawRegion(item.GetBoundRect(g));
         }
         g.CreateDrawRegion(((IRenderable)this.GetGauge()).GetBoundRect(g));
         using (GraphicsPath graphicsPath = this.GetPath(g, false))
         {
             if (graphicsPath != null)
             {
                 RectangleF bounds = graphicsPath.GetBounds();
                 g.DrawSelection(bounds, designTimeSelection, this.Common.GaugeCore.SelectionBorderColor, this.Common.GaugeCore.SelectionMarkerColor);
             }
         }
         g.RestoreDrawRegion();
         foreach (IRenderable item2 in stack)
         {
             IRenderable renderable = item2;
             g.RestoreDrawRegion();
         }
     }
 }
Esempio n. 8
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList arrayList = new ArrayList();

            if (context != null && context.Instance != null)
            {
                NamedElement namedElement = null;
                if (context.Instance is NamedElement)
                {
                    namedElement = (NamedElement)context.Instance;
                }
                if (context.Instance is IList && ((IList)context.Instance).Count > 0)
                {
                    namedElement = (NamedElement)((IList)context.Instance)[0];
                }
                if (namedElement != null && namedElement.Common != null)
                {
                    foreach (InputValue value in namedElement.Common.GaugeCore.Values)
                    {
                        arrayList.Add(value.Name);
                        foreach (CalculatedValue calculatedValue in value.CalculatedValues)
                        {
                            arrayList.Add(string.Format(CultureInfo.InvariantCulture, "{0}.{1}", calculatedValue.InputValueObj.Name, calculatedValue.Name));
                        }
                    }
                }
            }
            arrayList.Add("(none)");
            return(new StandardValuesCollection(arrayList));
        }
Esempio n. 9
0
 public void SetByNameCheck(string name, NamedElement element)
 {
     if (this.SetByName(name, element))
     {
         return;
     }
     throw new ArgumentException(Utils.SRGetStr("ExceptionElementNotFound", this.elementType.Name, name, base.GetType().Name));
 }
 public override void Notify(MessageType msg, NamedElement element, object param)
 {
     base.Notify(msg, element, param);
     if (msg == MessageType.DataInvalidated)
     {
         ((IValueConsumer)this).Refresh();
     }
 }
Esempio n. 11
0
        public void StartHotRegion(NamedElement obj)
        {
            IImageMapProvider imageMapProvider = obj as IImageMapProvider;

            if (imageMapProvider != null)
            {
                this.RenderingObject.BeginSelection(imageMapProvider.GetHref(), imageMapProvider.GetToolTip());
            }
        }
Esempio n. 12
0
        public virtual string GetElementNameFormat(NamedElement el)
        {
            string text = el.DefaultName;

            if (text == string.Empty)
            {
                text = el.GetType().Name;
            }
            return(text + "{0}");
        }
Esempio n. 13
0
        public NamedElement GetByNameCheck(string name)
        {
            NamedElement byName = this.GetByName(name);

            if (byName == null)
            {
                throw new ArgumentException(Utils.SRGetStr("ExceptionElementNotFound", this.elementType.Name, name, base.GetType().Name));
            }
            return(byName);
        }
Esempio n. 14
0
        public bool SetByName(string name, NamedElement element)
        {
            int index = this.GetIndex(name);

            if (index != -1)
            {
                base.List[index] = element;
                return(true);
            }
            return(false);
        }
Esempio n. 15
0
 public override void IsValidNameCheck(string name, NamedElement element)
 {
     base.IsValidNameCheck(name, element);
     if (!(base.parent is ValueBase))
     {
         return;
     }
     if (!((ValueBase)base.parent).Name.Equals(name, StringComparison.Ordinal))
     {
         return;
     }
     throw new NotSupportedException(Utils.SRGetStr("ExceptionListUniqueName", base.GetType().Name));
 }
Esempio n. 16
0
        public string GenerateUniqueName(NamedElement element)
        {
            string elementNameFormat = this.GetElementNameFormat(element);

            for (int i = base.Count + 1; i < 2147483647; i++)
            {
                string text = string.Format(CultureInfo.InvariantCulture, elementNameFormat, i);
                if (this.IsUniqueName(text))
                {
                    return(text);
                }
            }
            throw new ApplicationException(Utils.SRGetStr("ExceptionGenerateNameFailed"));
        }
Esempio n. 17
0
 private void ConnectToParent(bool exact)
 {
     if (this.Common != null && !this.Common.GaugeCore.isInitializing)
     {
         if (this.parent == string.Empty)
         {
             this.parentSystem = null;
         }
         else
         {
             this.Common.ObjectLinker.IsParentElementValid(this, this, exact);
             this.parentSystem = this.Common.ObjectLinker.GetElement(this.parent);
         }
     }
 }
Esempio n. 18
0
 public virtual void IsValidNameCheck(string name, NamedElement element)
 {
     if (name != null && !(name == string.Empty))
     {
         NamedElement byName = this.GetByName(name);
         if (byName == null)
         {
             return;
         }
         if (byName == element)
         {
             return;
         }
         throw new NotSupportedException(Utils.SRGetStr("ExceptionDuplicateNameFailed"));
     }
     throw new ArgumentException(Utils.SRGetStr("ExceptionEmptyNameFailed", this.elementType.Name));
 }
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList arrayList = new ArrayList();

            if (context != null && context.Instance != null)
            {
                NamedElement namedElement = null;
                if (context.Instance is NamedElement)
                {
                    namedElement = (NamedElement)context.Instance;
                }
                if (namedElement != null && namedElement.Common != null)
                {
                    arrayList = namedElement.Common.ObjectLinker.GetObjectNames(namedElement);
                }
            }
            arrayList.Add("(none)");
            return(new StandardValuesCollection(arrayList));
        }
Esempio n. 20
0
        public override void Notify(MessageType msg, NamedElement element, object param)
        {
            base.Notify(msg, element, param);
            switch (msg)
            {
            case MessageType.NamedElementRemove:
                if (this.parentSystem == element)
                {
                    this.Parent = string.Empty;
                }
                break;

            case MessageType.NamedElementRename:
                if (this.parentSystem == element)
                {
                    this.parent = element.GetNameAsParent((string)param);
                }
                break;
            }
        }
Esempio n. 21
0
 public override void Notify(MessageType msg, NamedElement element, object param)
 {
     base.Notify(msg, element, param);
     if (msg == MessageType.NamedElementRemove)
     {
         ArrayList arrayList = new ArrayList();
         foreach (DataAttributes key in this.inRangeTable.Keys)
         {
             if (key.Parent == element)
             {
                 arrayList.Add(key);
             }
         }
         for (int i = 0; i < arrayList.Count; i++)
         {
             this.inRangeTable.Remove(arrayList[i]);
         }
         arrayList.Clear();
     }
 }
Esempio n. 22
0
        public virtual object Clone()
        {
            ConstructorInfo[] constructors    = base.GetType().GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic);
            NamedCollection   namedCollection = (NamedCollection)constructors[0].Invoke(new object[2]
            {
                this.parent,
                this.common
            });

            namedCollection.parent      = this.parent;
            namedCollection.common      = this.common;
            namedCollection.elementType = this.elementType;
            foreach (ICloneable item in this)
            {
                NamedElement namedElement = (NamedElement)item.Clone();
                namedCollection.InnerList.Add(namedElement);
                namedElement.collection = namedCollection;
            }
            return(namedCollection);
        }
Esempio n. 23
0
        public virtual void PointerValueChanged(DataAttributes data)
        {
            double num  = Math.Min(this.startValue, this.endValue);
            double num2 = Math.Max(this.startValue, this.endValue);

            if (this.Common != null)
            {
                bool playbackMode = false;
                if (((IValueConsumer)data).GetProvider() != null)
                {
                    playbackMode = ((IValueConsumer)data).GetProvider().GetPlayBackMode();
                }
                NamedElement   pointer   = (NamedElement)data.Parent;
                RangeDataState dataState = this.GetDataState(data);
                double         num3      = data.Value;
                if (data.IsPercentBased)
                {
                    num3 = data.GetValueInPercents();
                }
                if (!dataState.IsInRange && num3 >= num && num3 <= num2)
                {
                    dataState.IsInRange = true;
                    this.OnValueRangeEnter(this, new ValueRangeEventArgs(num3, data.DateValueStamp, this.Name, playbackMode, pointer));
                    if (!(this.inRangeTimeout > 0.0))
                    {
                        dataState.IsTimerExceed = true;
                    }
                }
                if (dataState.IsInRange)
                {
                    if (!double.IsNaN(num3) && !(num3 < num) && !(num3 > num2))
                    {
                        return;
                    }
                    dataState.IsInRange     = false;
                    dataState.IsTimerExceed = false;
                    this.OnValueRangeLeave(this, new ValueRangeEventArgs(num3, data.DateValueStamp, this.Name, playbackMode, pointer));
                    double inRangeTimeout2 = this.inRangeTimeout;
                }
            }
        }
Esempio n. 24
0
        void ISelectable.DrawSelection(GaugeGraphics g, bool designTimeSelection)
        {
            Stack stack = new Stack();

            for (NamedElement namedElement = this.ParentObject; namedElement != null; namedElement = (NamedElement)((IRenderable)namedElement).GetParentRenderable())
            {
                stack.Push(namedElement);
            }
            foreach (IRenderable item in stack)
            {
                g.CreateDrawRegion(item.GetBoundRect(g));
            }
            g.CreateDrawRegion(((IRenderable)this).GetBoundRect(g));
            g.DrawSelection(g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f)), designTimeSelection, this.Common.GaugeCore.SelectionBorderColor, this.Common.GaugeCore.SelectionMarkerColor);
            g.RestoreDrawRegion();
            foreach (IRenderable item2 in stack)
            {
                IRenderable renderable = item2;
                g.RestoreDrawRegion();
            }
        }
Esempio n. 25
0
        void ISelectable.DrawSelection(GaugeGraphics g, bool designTimeSelection)
        {
            Stack stack = new Stack();

            for (NamedElement namedElement = base.ParentObject; namedElement != null; namedElement = (NamedElement)((IRenderable)namedElement).GetParentRenderable())
            {
                stack.Push(namedElement);
            }
            foreach (IRenderable item in stack)
            {
                g.CreateDrawRegion(item.GetBoundRect(g));
            }
            g.CreateDrawRegion(((IRenderable)this).GetBoundRect(g));
            RectangleF frameRectangle = base.Frame.GetFrameRectangle(g);

            g.DrawSelection(frameRectangle, (float)(-3.0 / g.Graphics.PageScale), designTimeSelection, this.Common.GaugeCore.SelectionBorderColor, this.Common.GaugeCore.SelectionMarkerColor);
            g.RestoreDrawRegion();
            foreach (IRenderable item2 in stack)
            {
                IRenderable renderable = item2;
                g.RestoreDrawRegion();
            }
        }
Esempio n. 26
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList arrayList = new ArrayList();

            if (context != null && context.Instance != null)
            {
                NamedElement    namedElement    = null;
                NamedCollection namedCollection = null;
                if (context.Instance is NamedElement)
                {
                    namedElement = (NamedElement)context.Instance;
                }
                if (context.Instance is IList && ((IList)context.Instance).Count > 0)
                {
                    namedElement = (NamedElement)((IList)context.Instance)[0];
                }
                if (namedElement != null && namedElement.Common != null && namedElement.ParentElement != null)
                {
                    if (namedElement.ParentElement is CircularGauge)
                    {
                        namedCollection = ((CircularGauge)namedElement.ParentElement).Scales;
                    }
                    if (namedElement.ParentElement is LinearGauge)
                    {
                        namedCollection = ((LinearGauge)namedElement.ParentElement).Scales;
                    }
                }
                if (namedCollection != null)
                {
                    foreach (NamedElement item in namedCollection)
                    {
                        arrayList.Add(item.Name);
                    }
                }
            }
            return(new StandardValuesCollection(arrayList));
        }
 public LinearRangeCollection(NamedElement parent, CommonElements common)
     : base(parent, common)
 {
     base.elementType = typeof(LinearRange);
 }
 public override string GetElementNameFormat(NamedElement el)
 {
     return("Range{0}");
 }
 public NumericIndicatorCollection(NamedElement parent, CommonElements common)
     : base(parent, common)
 {
     base.elementType = typeof(NumericIndicator);
 }
 public override string GetElementNameFormat(NamedElement el)
 {
     return("NumericIndicator{0}");
 }