示例#1
0
 public Streams(IHttpBodyControlFeature bodyControl, IFrameControl frameControl)
 {
     _request             = new FrameRequestStream(bodyControl);
     _emptyRequest        = new FrameRequestStream(bodyControl);
     _response            = new FrameResponseStream(bodyControl, frameControl);
     _upgradeableResponse = new WrappingStream(_response);
     _upgradeStream       = new FrameDuplexStream(_request, _response);
 }
        public override void ResetValue(object component)
        {
            IFrameControl frameControl = (component as IFrameControl);

            if (frameControl == null)
            {
                return;
            }

            FrameType frame = (FrameType)frameControl.SerializationObject;

            this.ClearEvent(frame.Scripts);
        }
        public override object GetValue(object component)
        {
            IFrameControl frameControl = (component as IFrameControl);

            if (frameControl == null)
            {
                return(string.Empty);
            }

            FrameType   frame   = (FrameType)frameControl.SerializationObject;
            ScriptsType scripts = this.FindContainingScripts(frame.Scripts);

            return(((scripts == null) || (!scripts.Events.ContainsKey(this.eventName))) ?
                   string.Empty : scripts.Events[this.eventName]);
        }
示例#4
0
 private void Multimedia_Click(object sender, RibbonControlEventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     try
     {
         IFrameControl myUserControl = new IFrameControl();
         CheckLoginAndPerformAction(myUserControl, "Multimedia");
     }
     catch
     {
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
示例#5
0
        public static PropertyDescriptorCollection GetProperties(ISerializableControl component, Attribute[] attributes)
        {
            PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(null);

            // add only direct properties of LayoutFrame - inherited properties are not added
            PropertyDescriptorCollection originalProperties = TypeDescriptor.GetProperties(component, attributes, true);

            foreach (PropertyDescriptor propertyDescriptor in originalProperties)
            {
                if (typeof(ISerializableControl).IsAssignableFrom(propertyDescriptor.ComponentType))
                {
                    Attribute[] attributeArray = GetAttributes(component.SerializationObject, propertyDescriptor.Name);
                    var         pd             = TypeDescriptor.CreateProperty(component.GetType(), propertyDescriptor, attributeArray);
                    propertyDescriptorCollection.Add(new NotifierTypeDescriptor(component, pd));
                }
            }

            // add properties of the serialization object
            if (component.SerializationObject != null)
            {
                PropertyDescriptorCollection serializationProperties = TypeDescriptor.GetProperties(component.SerializationObject, attributes, true);

                foreach (PropertyDescriptor propertyDescriptor in serializationProperties)
                {
                    Attribute[] attributeArray = GetAttributes(component.SerializationObject, propertyDescriptor.Name);
                    var         pd             = TypeDescriptor.CreateProperty(component.SerializationObject.GetType(), propertyDescriptor, attributeArray);
                    propertyDescriptorCollection.Add(new NotifierTypeDescriptor(component, pd));
                }
            }

            // adding events
            IFrameControl frameControl = component as IFrameControl;

            if (frameControl != null)
            {
                PropertyDescriptor[] eventDescriptors = frameControl.GetEventDescriptors();
                foreach (PropertyDescriptor eventDescriptor in eventDescriptors)
                {
                    propertyDescriptorCollection.Add(new NotifierTypeDescriptor(component, eventDescriptor));
                }
            }

            return(propertyDescriptorCollection);
        }
        public override void SetValue(object component, object value)
        {
            IFrameControl frameControl = (component as IFrameControl);

            if (frameControl == null)
            {
                return;
            }

            FrameType frame = (FrameType)frameControl.SerializationObject;

            string valueAsString = (value as string);

            if (string.IsNullOrEmpty(valueAsString))
            {
                this.ClearEvent(frame.Scripts);
            }
            else
            {
                ScriptsType scripts = this.FindContainingScripts(frame.Scripts);

                if (scripts == null)
                {
                    if (frame.Scripts.Count > 0)
                    {
                        scripts = frame.Scripts[0];
                    }
                    else
                    {
                        scripts = new ScriptsType();
                        frame.Scripts.Add(scripts);
                    }
                }

                scripts.Events[this.eventName] = valueAsString;
            }
        }
示例#7
0
 public Streams(IFrameControl frameControl)
 {
     RequestBody  = new FrameRequestStream();
     ResponseBody = new FrameResponseStream(frameControl);
     DuplexStream = new FrameDuplexStream(RequestBody, ResponseBody);
 }
示例#8
0
 public FrameResponseStream(IFrameControl frameControl)
 {
     _frameControl = frameControl;
     _state        = FrameStreamState.Closed;
 }
示例#9
0
 public FrameResponseStream(IHttpBodyControlFeature bodyControl, IFrameControl frameControl)
 {
     _bodyControl  = bodyControl;
     _frameControl = frameControl;
     _state        = FrameStreamState.Closed;
 }