public override object GetValue(object component)
            {
                // Have the property bag raise an event to get the current value
                // of the property.

                PropertySpecEventArgs e = new PropertySpecEventArgs(item, null);
                bag.OnGetValue(e);
                return e.Value;
            }
            public override void SetValue(object component, object value)
            {
                // Have the property bag raise an event to set the current value
                // of the property.

                PropertySpecEventArgs e = new PropertySpecEventArgs(item, value);
                bag.OnSetValue(e);
            }
 /// <summary>
 /// This member overrides PropertyBag.OnSetValue.
 /// </summary>
 protected override void OnSetValue(PropertySpecEventArgs e)
 {
     propValues[e.Property.Name] = e.Value;
     base.OnSetValue(e);
 }
 /// <summary>
 /// Raises the SetValue event.
 /// </summary>
 /// <param name="e">A PropertySpecEventArgs that contains the event data.</param>
 protected virtual void OnSetValue(PropertySpecEventArgs e)
 {
     if(SetValue != null)
         SetValue(this, e);
 }
        /// <summary>
        /// Sets the property value for one or more selected boxes
        /// </summary>
        /// <param name="sender">Sender of the event</param>
        /// <param name="e">Event parameters</param>
        void propertyBag_SetValue(object sender, PropertySpecEventArgs e)
        {
            //getting the real name of the property, not the label
            string propertyName = String.Empty;

            if (IsOneBoxSelected)
            {
                propertyName = GetPropertyName(e.Property.Name, SelectedBox);
            }
            else
            {
                propertyName = GetPropertyName(e.Property.Name, SelectedBoxes[0]);
            }

            //parsing the string to get the type name without assembly information
            int firstComma = e.Property.TypeName.IndexOf(',');
            string typeName;

            if (firstComma == -1)
            {
                typeName = e.Property.TypeName;
            }
            else
            {
                typeName = e.Property.TypeName.Substring(0, firstComma);
            }

            FerdaPropertySpec pfs = e.Property as FerdaPropertySpec;
            //this determines, if a socket was changed
            bool changedSocket = false;

            if (pfs.SocketProperty)
            {
                changedSocket = SetSocketProperty(e, propertyName);
            }
            else
            {
                SetNormalProperty(e, propertyName, typeName);
            }

            archiveDisplayer.RefreshBoxNames();
            foreach (IViewDisplayer view in ViewDisplayers)
            {
                view.RefreshBoxNames();
                //for optimalization purposes we redraw the view only if
                //there was a socket changed
                if (changedSocket)
                {
                    view.Adapt();
                }
            }
        }
 /// <summary>
 /// This member overrides PropertyBag.OnGetValue.
 /// </summary>
 protected override void OnGetValue(PropertySpecEventArgs e)
 {
     e.Value = propValues[e.Property.Name];
     base.OnGetValue(e);
 }
        /// <summary>
        /// Sets a socket property of the box (not the normal one)
        /// </summary>
        /// <param name="e">Parameters of the property to set</param>
        /// <param name="propertyName">Name of the property (socket)</param>
        /// <returns>The indication if a socking of the property has been
        /// changed.</returns>
        protected bool SetSocketProperty(PropertySpecEventArgs e, string
            propertyName)
        {
            bool previousValue = SelectedBox.GetPropertySocking(propertyName);
            bool thisValue = (bool)e.Value;

            if (thisValue == previousValue)
            {
                //nothing has changed
                return false;
            }
            else
            {
                //something has changed
                //trying to access the selected box
                if (SelectedBox.TryWriteEnter())
                {
                    SelectedBox.SetPropertySocking(propertyName, (bool)e.Value);
                    SelectedBox.WriteExit();
                }
                else
                {
                    FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                }

                Adapt();
                return true;
            }
        }
        /// <summary>
        /// Gets the property value for one or more selected boxes
        /// </summary>
        /// <param name="sender">Sender of the event</param>
        /// <param name="e">Event parameters</param>
        /// <remarks>
        /// Tady se to musi jeste doplnit o vsechny typy, ktere tam ma definovane Michal
        /// + pridelat neco pro custom typy (zatim nevim jak presne se to bude delat)
        /// </remarks>
        void propertyBag_GetValue(object sender, PropertySpecEventArgs e)
        {
            PropertyTable table = sender as PropertyTable;
            if (table == null)
            {
                throw new ApplicationException("It is not a property bag");
            }

            lock (tempLocker)
            {
                if (table.ClickID != this.ClickID)
                {
                    return;
                }

                //getting the real name of the property, not the label
                string realPropertyName = "";

                if (IsOneBoxSelected)
                {
                    realPropertyName = GetPropertyName(e.Property.Name, SelectedBox);
                }
                else
                {
                    realPropertyName = GetPropertyName(e.Property.Name, SelectedBoxes[0]);
                }

                string typeName = RealTypeName(e.Property.TypeName);

                FerdaPropertySpec pfs = e.Property as FerdaPropertySpec;

                if (pfs.SocketProperty)
                {
                    GetSocketProperty(e, realPropertyName);
                }
                else
                {
                    GetNormalProperty(e, realPropertyName, typeName);
                }
            }
        }
        /// <summary>
        /// Sets a normal property of the box (not the socket one)
        /// </summary>
        /// <param name="e">Parameters of the property to set</param>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="typeName">Type of the property</param>
        protected void SetNormalProperty(PropertySpecEventArgs e,
            string propertyName, string typeName)
        {
            switch (typeName)
            {
                //the string sequence is dealt separatelly in the string combo editor
                //and stringcombo adding editor
                case "System.Int32":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            //then setting it to the box
                            SelectedBox.SetPropertyInt(propertyName, (int)e.Value);
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else //setting the property for all the selected boxes
                    {
                        bool couldWrite = true;
                        foreach (IBoxModule box in SelectedBoxes)
                        {
                            if (box.TryWriteEnter())
                            {
                                box.SetPropertyInt(propertyName, (int)e.Value);
                                box.WriteExit();
                            }
                            else
                            {
                                couldWrite = false;
                            }
                        }
                        if (!couldWrite)
                        {
                            FrontEndCommon.CannotSetPropertyMoreBoxes(ResManager);
                        }
                    }
                    break;

                case "Ferda.FrontEnd.Properties.OtherProperty":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            if (SelectedBox.IsPossibleToSetWithAbout(propertyName))
                            {
                                OtherProperty op = e.Value as OtherProperty;
                                SelectedBox.SetPropertyOtherAbout(propertyName, op.Result);
                            }
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else
                    {
                        //every box in the selected boxes should have this property
                        if (SelectedBoxes[0].IsPossibleToSetWithAbout(propertyName))
                        {
                            foreach (IBoxModule box in SelectedBoxes)
                            {
                                if (box.TryWriteEnter())
                                {
                                    OtherProperty op = e.Value as OtherProperty;
                                    box.SetPropertyOtherAbout(propertyName, op.Result);
                                    box.WriteExit();
                                }
                                else
                                {
                                    FrontEndCommon.CannotWriteToBox(box, ResManager);
                                }
                            }
                        }
                    }

                    break;

                case "System.String":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            //then setting it to the box
                            SelectedBox.SetPropertyString(propertyName, (string)e.Value);
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else //setting the property for all the selected boxes
                    {
                        bool couldWrite = true;
                        foreach (IBoxModule box in SelectedBoxes)
                        {
                            if (box.TryWriteEnter())
                            {
                                box.SetPropertyString(propertyName, (string)e.Value);
                                box.WriteExit();
                            }
                            else
                            {
                                couldWrite = false;
                            }
                        }
                        if (!couldWrite)
                        {
                            FrontEndCommon.CannotSetPropertyMoreBoxes(ResManager);
                        }
                    }
                    break;

                case "System.Boolean":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            //then setting it to the box
                            SelectedBox.SetPropertyBool(propertyName, (bool)e.Value);
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else //setting the property for all the selected boxes
                    {
                        bool couldWrite = true;
                        foreach (IBoxModule box in SelectedBoxes)
                        {
                            if (box.TryWriteEnter())
                            {
                                box.SetPropertyBool(propertyName, (bool)e.Value);
                                box.WriteExit();
                            }
                            else
                            {
                                couldWrite = false;
                            }
                        }
                        if (!couldWrite)
                        {
                            FrontEndCommon.CannotSetPropertyMoreBoxes(ResManager);
                        }
                    }
                    break;

                case "System.Int16":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            //then setting it to the box
                            SelectedBox.SetPropertyShort(propertyName, (short)e.Value);
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else //setting the property for all the selected boxes
                    {
                        bool couldWrite = true;
                        foreach (IBoxModule box in SelectedBoxes)
                        {
                            if (box.TryWriteEnter())
                            {
                                box.SetPropertyShort(propertyName, (Int16)e.Value);
                                box.WriteExit();
                            }
                            else
                            {
                                couldWrite = false;
                            }
                        }
                        if (!couldWrite)
                        {
                            FrontEndCommon.CannotSetPropertyMoreBoxes(ResManager);
                        }
                    }
                    break;

                case "System.Int64":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            //then setting it to the box
                            SelectedBox.SetPropertyLong(propertyName, (long)e.Value);
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else //setting the property for all the selected boxes
                    {
                        bool couldWrite = true;
                        foreach (IBoxModule box in SelectedBoxes)
                        {
                            if (box.TryWriteEnter())
                            {
                                box.SetPropertyLong(propertyName, (Int64)e.Value);
                                box.WriteExit();
                            }
                            else
                            {
                                couldWrite = false;
                            }
                        }
                        if (!couldWrite)
                        {
                            FrontEndCommon.CannotSetPropertyMoreBoxes(ResManager);
                        }
                    }
                    break;

                case "System.Double":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            //then setting it to the box
                            SelectedBox.SetPropertyDouble(propertyName, (double)e.Value);
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else //setting the property for all the selected boxes
                    {
                        bool couldWrite = true;
                        foreach (IBoxModule box in SelectedBoxes)
                        {
                            if (box.TryWriteEnter())
                            {
                                box.SetPropertyDouble(propertyName, (Double)e.Value);
                                box.WriteExit();
                            }
                            else
                            {
                                couldWrite = false;
                            }
                        }
                        if (!couldWrite)
                        {
                            FrontEndCommon.CannotSetPropertyMoreBoxes(ResManager);
                        }
                    }
                    break;

                case "System.Single":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            //then setting it to the box
                            SelectedBox.SetPropertyFloat(propertyName, (float)e.Value);
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else //setting the property for all the selected boxes
                    {
                        bool couldWrite = true;
                        foreach (IBoxModule box in SelectedBoxes)
                        {
                            if (box.TryWriteEnter())
                            {
                                box.SetPropertyFloat(propertyName, (float)e.Value);
                                box.WriteExit();
                            }
                            else
                            {
                                couldWrite = false;
                            }
                        }
                        if (!couldWrite)
                        {
                            FrontEndCommon.CannotSetPropertyMoreBoxes(ResManager);
                        }
                    }
                    break;

                case "System.DateTime":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            //then setting it to the box
                            SetCorrectDateType(e, SelectedBox);
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else //setting the property for all the selected boxes
                    {
                        bool couldWrite = true;
                        foreach (IBoxModule box in SelectedBoxes)
                        {
                            if (box.TryWriteEnter())
                            {
                                SetCorrectDateType(e, box);
                                box.WriteExit();
                            }
                            else
                            {
                                couldWrite = false;
                            }
                        }
                        if (!couldWrite)
                        {
                            FrontEndCommon.CannotSetPropertyMoreBoxes(ResManager);
                        }
                    }
                    break;

                case "System.TimeSpan":
                    if (IsOneBoxSelected)
                    {
                        if (SelectedBox.TryWriteEnter())
                        {
                            //then setting it to the box
                            SelectedBox.SetPropertyTime(propertyName, (TimeSpan)e.Value);
                            SelectedBox.WriteExit();
                        }
                        else
                        {
                            FrontEndCommon.CannotWriteToBox(SelectedBox, ResManager);
                        }
                    }
                    else //setting the property for all the selected boxes
                    {
                        bool couldWrite = true;
                        foreach (IBoxModule box in SelectedBoxes)
                        {
                            if (box.TryWriteEnter())
                            {
                                box.SetPropertyTime(propertyName, (TimeSpan)e.Value);
                                box.WriteExit();
                            }
                            else
                            {
                                couldWrite = false;
                            }
                        }
                        if (!couldWrite)
                        {
                            FrontEndCommon.CannotSetPropertyMoreBoxes(ResManager);
                        }
                    }
                    break;

                default:
                    break;
            }

            //the whole adapt has to be done, because setting some properties
            //can change others
            Adapt();
        }
        /// <summary>
        /// The method sets the correct date (or datetime) property according
        /// to the property name. The DateT and DateTimeT structures of the
        /// ModulesManager are both converted to the DateTime structure. Thus
        /// we must know which function to call (SetPropertyDate or SetPropertyDateTime)
        /// </summary>
        /// <param name="e">Arguments of the propertyBag_GetValue event</param>
        /// <param name="box">Box where to set the property</param>
        protected void SetCorrectDateType(PropertySpecEventArgs e, IBoxModule box)
        {
            string propertyName = GetPropertyName(e.Property.Name, SelectedBox);

            //box.SetPropertyDate(e.Property.Name, (DateTime)e.Value);
            foreach (PropertyInfo pinfo in box.MadeInCreator.Properties)
            {
                if (pinfo.name == propertyName)
                {
                    if (pinfo.typeClassIceId == "::Ferda::Modules::DateTimeT")
                    {
                        box.SetPropertyDateTime(e.Property.Name, (DateTime)e.Value);
                    }
                    if (pinfo.typeClassIceId == "::Ferda::Modules::DateT")
                    {
                        box.SetPropertyDate(e.Property.Name, (DateTime)e.Value);
                    }
                }
            }
        }
 /// <summary>
 /// Gets a socket property of the box (not normal property)
 /// </summary>
 /// <param name="e">Parameters of the property to set</param>
 /// <param name="propertyName">Name of the property (socket)</param>
 protected void GetSocketProperty(PropertySpecEventArgs e, string propertyName)
 {
     e.Value = SelectedBox.GetPropertySocking(propertyName);
 }
        /// <summary>
        /// Gets a normal property of the box (not the socket one)
        /// </summary>
        /// <param name="e">Parameters of the property to set</param>
        /// <param name="realPropertyName">Name of the property(identifier)</param>
        /// <param name="typeName">Type of the property</param>
        protected void GetNormalProperty(PropertySpecEventArgs e, string
            realPropertyName, string typeName)
        {
            lock (tempLocker)
            {
                switch (typeName)
                {
                    case "Ferda.FrontEnd.Properties.OtherProperty":
                        if (IsOneBoxSelected)
                        {
                            e.Value = (OtherProperty)temporaryValues[realPropertyName];
                        }
                        else //setting otherOtherProperty for more boxes does not make sense
                        {
                            throw new ApplicationException("This situation should not happen, other property can be set for one selected box only");
                        }
                        break;

                    case "Ferda.FrontEnd.Properties.StringSequence":
                        e.Value = (StringSequence)temporaryValues[realPropertyName];
                        break;

                    case "System.String":
                        e.Value = (string)temporaryValues[realPropertyName];
                        break;

                    case "System.Int32":
                        e.Value = (Int32)temporaryValues[realPropertyName];
                        break;

                    case "System.Boolean":
                        e.Value = (bool)temporaryValues[realPropertyName];
                        break;

                    case "System.Int16":
                        e.Value = (Int16)temporaryValues[realPropertyName];
                        break;

                    case "System.Int64":
                        e.Value = (Int64)temporaryValues[realPropertyName];
                        break;

                    case "System.Single":
                        e.Value = (Single)temporaryValues[realPropertyName];
                        break;

                    case "System.Double":
                        e.Value = (Double)temporaryValues[realPropertyName];
                        break;

                    case "System.DateTime":
                        e.Value = (DateTime)temporaryValues[realPropertyName];
                        break;

                    case "System.TimeSpan":
                        e.Value = (TimeSpan)temporaryValues[realPropertyName];
                        break;

                    default:
                        //here other types will be treated
                        break;
                }
            }
        }
        /// <summary>
        /// The method gets the correct date (or datetime) property according
        /// to the property name for more boxes. The DateT and DateTimeT structures of the 
        /// ModulesManager are both converted to the DateTime structure. Thus
        /// we must know which function to call (GetPropertyDate or GetPropertyDateTime)
        /// </summary>
        /// <param name="e">Arguments of the propertyBag_GetValue event</param>
        protected void GetCorrectDateTypeMoreBoxes(PropertySpecEventArgs e)
        {
            //value that shows the type of the property
            bool dateT = false;
            //determines if there was a property of that name
            bool cycleCheck = false;
            DateTime tempValue;

            string propertyName = GetPropertyName(e.Property.Name, SelectedBox);

            //determining the type of the property in the first box, if it is
            //a DateTimeT, or a DateT structure
            foreach (PropertyInfo pinfo in SelectedBoxes[0].MadeInCreator.Properties)
            {
                if (pinfo.name == propertyName)
                {
                    if (pinfo.typeClassIceId == "::Ferda::Modules::DateTimeT")
                    {
                        dateT = false;
                        cycleCheck = true;
                    }
                    if (pinfo.typeClassIceId == "::Ferda::Modules::DateT")
                    {
                        dateT = true;
                        cycleCheck = true;
                    }
                    break;
                }
            }

            //veryfying with the cycleCheck
            if (!cycleCheck)
            {
                throw new ApplicationException("Wrong properties");
            }

            //getting the first value
            if (dateT)
            {
                tempValue = SelectedBoxes[0].GetPropertyDate(propertyName);
            }
            else
            {
                tempValue = SelectedBoxes[0].GetPropertyDateTime(propertyName);
            }

            //getting the other values and comparing them
            for (int i = 1; i < SelectedBoxes.Count; i++)
            {
                //it is a DateT value
                if (dateT)
                {
                    if (tempValue == SelectedBoxes[i].GetPropertyDate(propertyName))
                    {
                        continue;
                    }
                    else
                    {
                        return;
                    }
                }
                //it is a DateTimeT value
                else
                {
                    if (tempValue == SelectedBoxes[i].GetPropertyDateTime(propertyName))
                    {
                        continue;
                    }
                    else
                    {
                        return;
                    }
                }
            }

            e.Value = tempValue;
        }