Exemplo n.º 1
0
        private object ConvertArray(string[] items, Type destinationType, BindingContext context)
        {
            var elementType = destinationType.GetElementType();

            if (elementType == null)
            {
                return null;
            }

            var converter = context.TypeConverters.Where(c => c.CanConvertTo(elementType)).FirstOrDefault();

            if (converter == null)
            {
                return null;
            }

            var returnArray = items.Select(s => converter.Convert(s, elementType, context));

            var genericCastMethod = this.enumerableCastMethod.MakeGenericMethod(new[] { elementType });
            var generictoArrayMethod = this.enumerableToArrayMethod.MakeGenericMethod(new[] { elementType });

            var castArray = genericCastMethod.Invoke(null, new object[] { returnArray });

            return generictoArrayMethod.Invoke(null, new[] { castArray });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Deserialize the request body to a model
        /// </summary>
        /// <param name="mediaRange">Content type to deserialize</param>
        /// <param name="bodyStream">Request body stream</param>
        /// <param name="context">Current context</param>
        /// <returns>Model instance</returns>
        public object Deserialize(MediaRange mediaRange, Stream bodyStream, BindingContext context)
        {
            var serializer = new JavaScriptSerializer(
                null,
                false,
                this.configuration.MaxJsonLength,
                this.configuration.MaxRecursions,
                this.configuration.RetainCasing,
                this.configuration.UseISO8601DateFormat,
                this.configuration.Converters,
                this.configuration.PrimitiveConverters);

            serializer.RegisterConverters(this.configuration.Converters, this.configuration.PrimitiveConverters);

            bodyStream.Position = 0;
            string bodyText;
            using (var bodyReader = new StreamReader(bodyStream))
            {
                bodyText = bodyReader.ReadToEnd();
            }

            var genericDeserializeMethod = this.deserializeMethod.MakeGenericMethod(context.DestinationType);

            var deserializedObject = genericDeserializeMethod.Invoke(serializer, new object[] { bodyText });

            return deserializedObject;
        }
        public WindowsStreamSecurityUpgradeProvider(WindowsStreamSecurityBindingElement bindingElement,
            BindingContext context, bool isClient)
            : base(context.Binding)
        {
            this.extractGroupsForWindowsAccounts = TransportDefaults.ExtractGroupsForWindowsAccounts;
            this.protectionLevel = bindingElement.ProtectionLevel;
            this.scheme = context.Binding.Scheme;
            this.isClient = isClient;
            this.listenUri = TransportSecurityHelpers.GetListenUri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);

            SecurityCredentialsManager credentialProvider = context.BindingParameters.Find<SecurityCredentialsManager>();
            if (credentialProvider == null)
            {
                if (isClient)
                {
                    credentialProvider = ClientCredentials.CreateDefaultCredentials();
                }
                else
                {
                    credentialProvider = ServiceCredentials.CreateDefaultCredentials();
                }
            }


            this.securityTokenManager = credentialProvider.CreateSecurityTokenManager();
        }
Exemplo n.º 4
0
        void BindNamed(object commando, PropertyInfo property, List<CommandLineParameter> parameters, NamedArgumentAttribute attribute, BindingContext context)
        {
            var name = attribute.Name;
            var shortHand = attribute.ShortHand;
            var parameter = parameters.Where(p => p is NamedCommandLineParameter)
                .Cast<NamedCommandLineParameter>()
                .SingleOrDefault(p => p.Name == name || p.Name == shortHand);

            var value = parameter != null
                            ? Mutate(parameter, property)
                            : attribute.Default != null
                                  ? Mutate(attribute.Default, property)
                                  : null;

            if (value == null)
            {
                context.Report.PropertiesNotBound.Add(property);

                if (!attribute.Required) return;

                throw Ex("Could not find parameter matching required parameter named {0}", name);
            }

            property.SetValue(commando, value, null);

            context.Report.PropertiesBound.Add(property);
        }
 protected RabbitMQOutputChannelBase(BindingContext context, EndpointAddress address, Uri via)
     : base(context)
 {
     _address = address;
     _via = via;
     _sendMethod = Send;
 }
        public WindowsStreamSecurityUpgradeProvider(WindowsStreamSecurityBindingElement bindingElement,
            BindingContext context, bool isClient)
            : base(context.Binding)
        {
            _extractGroupsForWindowsAccounts = TransportDefaults.ExtractGroupsForWindowsAccounts;
            _protectionLevel = bindingElement.ProtectionLevel;
            _scheme = context.Binding.Scheme;
            _isClient = isClient;
            _listenUri = TransportSecurityHelpers.GetListenUri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);

            SecurityCredentialsManager credentialProvider = context.BindingParameters.Find<SecurityCredentialsManager>();

            if (credentialProvider == null)
            {
                if (isClient)
                {
                    credentialProvider = ClientCredentials.CreateDefaultCredentials();
                }
                else
                {
                    throw ExceptionHelper.PlatformNotSupported("WindowsStreamSecurityUpgradeProvider for server is not supported.");
                }
            }

            _securityTokenManager = credentialProvider.CreateSecurityTokenManager();
        }
Exemplo n.º 7
0
	public static void Main ()
	{
		HttpTransportBindingElement el =
			new HttpTransportBindingElement ();
		BindingContext bc = new BindingContext (
			new CustomBinding (),
			new BindingParameterCollection (),
			new Uri ("http://localhost:37564"),
			String.Empty, ListenUriMode.Explicit);
		IChannelListener<IReplyChannel> listener =
			el.BuildChannelListener<IReplyChannel> (bc);

		listener.Open ();

		IReplyChannel reply = listener.AcceptChannel ();

		reply.Open ();

		if (!reply.WaitForRequest (TimeSpan.FromSeconds (10))) {
			Console.WriteLine ("No request reached here.");
			return;
		}
		Console.WriteLine ("Receiving request ...");
		RequestContext ctx = reply.ReceiveRequest ();
		if (ctx == null)
			return;
		Console.WriteLine ("Starting reply ...");
		ctx.Reply (Message.CreateMessage (MessageVersion.Default, "Ack"));
	}
Exemplo n.º 8
0
        /// <summary>
        /// Convert the string representation to the destination type
        /// </summary>
        /// <param name="input">Input string</param>
        /// <param name="destinationType">Destination type</param>
        /// <param name="context">Current context</param>
        /// <returns>Converted object of the destination type</returns>
        public object Convert(string input, Type destinationType, BindingContext context)
        {
            if (string.IsNullOrEmpty(input))
            {
                return null;
            }

            var items = input.Split(',');

            // Strategy, schmategy ;-)
            if (destinationType.IsCollection())
            {
                return this.ConvertCollection(items, destinationType, context);
            }

            if (destinationType.IsArray())
            {
                return this.ConvertArray(items, destinationType, context);
            }

            if (destinationType.IsEnumerable())
            {
                return this.ConvertEnumerable(items, destinationType, context);
            }

            return null;
        }
Exemplo n.º 9
0
 public static CheckedContext CreateInstance(
     BindingContext parentCtx,
     bool checkedNormal,
     bool checkedConstant)
 {
     return new CheckedContext(parentCtx, checkedNormal, checkedConstant);
 }
Exemplo n.º 10
0
		void FillMessageEncoder (BindingContext ctx)
		{
			var mbe = (MessageEncodingBindingElement) ctx.Binding.Elements.FirstOrDefault (be => be is MessageEncodingBindingElement);
			if (mbe == null)
				mbe = new TextMessageEncodingBindingElement ();
			message_encoder = mbe.CreateMessageEncoderFactory ().Encoder;
		}
Exemplo n.º 11
0
		// channel factory
		public UdpDuplexChannel (UdpChannelFactory factory, BindingContext ctx, EndpointAddress address, Uri via)
			: base (factory)
		{
			binding_element = factory.Source;
			RemoteAddress = address;
			Via = via;
		}
        /// <summary>
        /// Deserialize the request body to a model
        /// </summary>
        /// <param name="mediaRange">Content type to deserialize</param>
        /// <param name="bodyStream">Request body stream</param>
        /// <param name="context">Current context</param>
        /// <returns>Model instance</returns>
        public object Deserialize(MediaRange mediaRange, Stream bodyStream, BindingContext context)
        {
            if (bodyStream.CanSeek)
            {
                bodyStream.Position = 0;
            }

            var deserializedObject = ServiceStack.JsonSerializer.DeserializeFromStream(context.DestinationType, bodyStream);
            if (deserializedObject == null)
            {
                return null;
            }

            IEnumerable<BindingMemberInfo> properties;
            IEnumerable<BindingMemberInfo> fields;

            if (context.DestinationType.IsGenericType)
            {
                var genericType = context.DestinationType.GetGenericArguments().FirstOrDefault();

                properties = genericType.GetProperties(BindingFlags.Public | BindingFlags.Instance).Select(p => new BindingMemberInfo(p));
                fields = genericType.GetFields(BindingFlags.Public | BindingFlags.Instance).Select(p => new BindingMemberInfo(p));
            }
            else
            {
                properties = context.DestinationType.GetProperties(BindingFlags.Public | BindingFlags.Instance).Select(p => new BindingMemberInfo(p));
                fields = context.DestinationType.GetFields(BindingFlags.Public | BindingFlags.Instance) .Select(p => new BindingMemberInfo(p));
            }

            return properties.Concat(fields).Except(context.ValidModelBindingMembers).Any()
                ? CreateObjectWithBlacklistExcluded(context, deserializedObject)
                : deserializedObject;
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            Target = target as BindingContext;

            if (Target == null)
                return;

            ModeSelection();

            switch (Target.ContextMode)
            {
                case BindingContext.BindingContextMode.MonoBinding:
                    MonoSelection();
                    Target.FindModel();
                    break;

                case BindingContext.BindingContextMode.MockBinding:
                    DrawNamespaceDrop();
                    DrawTypeDrop();
                    Target.FindModel();
                    break;

                case BindingContext.BindingContextMode.PropBinding:
                    PropSelection();
                    Target.FindModel();
                    break;

                default:
                    EditorGUILayout.LabelField("Please select a binding mode.");
                    break;
            }
        }
        public RabbitMQTransportOutputChannel(BindingContext context, EndpointAddress address, Uri via)
            : base(context, address, via)
        {
            _bindingElement = context.Binding.Elements.Find<RabbitMQTransportBindingElement>();

            MessageEncodingBindingElement encoderElement;

            if (_bindingElement.MessageFormat == MessageFormat.MTOM)
            {
                encoderElement = context.Binding.Elements.Find<MtomMessageEncodingBindingElement>();
            }
            else if (_bindingElement.MessageFormat == MessageFormat.NetBinary)
            {
                encoderElement = context.Binding.Elements.Find<BinaryMessageEncodingBindingElement>();
            }
            else
            {
                encoderElement = context.Binding.Elements.Find<TextMessageEncodingBindingElement>();
            }

            if (encoderElement != null)
            {
                _encoder = encoderElement.CreateMessageEncoderFactory().Encoder;
            }

            _messageProcessor = context.BindingParameters.Find<IFaultMessageProcessor>();
        }
Exemplo n.º 15
0
        /// <summary>
        /// Convert the string representation to the destination type
        /// </summary>
        /// <param name="input">Input string</param>
        /// <param name="destinationType">Destination type</param>
        /// <param name="context">Current context</param>
        /// <returns>Converted object of the destination type</returns>
        public object Convert(string input, Type destinationType, BindingContext context)
        {
            // TODO - Lots of reflection in here, should probably cache the methodinfos
            if (string.IsNullOrEmpty(input))
            {
                return null;
            }

            var items = input.Split(',');

            // Strategy, schmategy ;-)
            if (this.IsCollection(destinationType))
            {
                return this.ConvertCollection(items, destinationType, context);
            }

            if (this.IsArray(destinationType))
            {
                return this.ConvertArray(items, destinationType, context);
            }

            if (this.IsEnumerable(destinationType))
            {
                return this.ConvertEnumerable(items, destinationType, context);
            }

            return null;
        }
 internal MsmqIntegrationChannelListener(MsmqBindingElementBase bindingElement, BindingContext context, MsmqReceiveParameters receiveParameters)
     : base(bindingElement, context, receiveParameters, null)
 {
     SetSecurityTokenAuthenticator(MsmqUri.FormatNameAddressTranslator.Scheme, context);
     MsmqIntegrationReceiveParameters parameters = receiveParameters as MsmqIntegrationReceiveParameters;
     xmlSerializerList = XmlSerializer.FromTypes(parameters.TargetSerializationTypes);
 }
 protected RabbitMQInputChannelBase(BindingContext context, EndpointAddress localAddress)
 :base(context)
 {
     m_localAddress = localAddress;
     m_receiveMethod = new CommunicationOperation<Message>(Receive);
     m_tryReceiveMethod = new CommunicationOperation<bool, Message>(TryReceive);
     m_waitForMessage = new CommunicationOperation<bool>(WaitForMessage);
 }
 public Task<IValueProvider> BindAsync(BindingContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     return BindAccountAsync(_account, context.ValueContext);
 }
 protected SspiSecurityTokenParameters(SspiSecurityTokenParameters other) : base(other)
 {
     this.requireCancellation = other.requireCancellation;
     if (other.issuerBindingContext != null)
     {
         this.issuerBindingContext = other.issuerBindingContext.Clone();
     }
 }
 public Task<IValueProvider> BindAsync(BindingContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     return BindAsync(context.FunctionCancellationToken, context.ValueContext);
 }
Exemplo n.º 21
0
 protected ZMQReceivingChannelBase(ChannelManagerBase channelManager, BindingContext bindingContext, Context context, Socket socket, SocketMode socketMode)
     : base(channelManager, bindingContext, socket, socketMode)
 {
     _onReceiveHandler = Receive;
     _onTryReceiveHandler = TryReceive;
     _onWaitForMessageHandler = WaitForMessage;
     _context = context;
 }
 protected RabbitMQInputChannelBase(BindingContext context, EndpointAddress localAddress)
     : base(context)
 {
     _localAddress = localAddress;
     _receiveMethod = Receive;
     _tryReceiveMethod = TryReceive;
     _waitForMessage = WaitForMessage;
 }
 protected MsmqChannelListenerBase(MsmqBindingElementBase bindingElement,
                                   BindingContext context,
                                   MsmqReceiveParameters receiveParameters,
                                   MessageEncoderFactory messageEncoderFactory)
     : base(bindingElement, context, messageEncoderFactory)
 {
     this.receiveParameters = receiveParameters;
 }
        /// <summary>
        /// Deserialize the request body to a model
        /// </summary>
        /// <param name="mediaRange">Content type to deserialize</param>
        /// <param name="bodyStream">Request body stream</param>
        /// <param name="context">Current context</param>
        /// <returns>Model instance</returns>
        public object Deserialize(MediaRange mediaRange, Stream bodyStream, BindingContext context)
        {
            if (bodyStream.CanSeek)
            {
                bodyStream.Position = 0;
            }

            return RuntimeTypeModel.Default.Deserialize(bodyStream, null, context.DestinationType);
        }
 public override void ApplyHostedContext(TransportChannelListener listener, BindingContext context)
 {
     VirtualPathExtension extension = context.BindingParameters.Find<VirtualPathExtension>();
     if (extension != null)
     {
         HostedMetadataBindingParameter parameter = context.BindingParameters.Find<HostedMetadataBindingParameter>();
         listener.ApplyHostedContext(extension.VirtualPath, parameter != null);
     }
 }
Exemplo n.º 26
0
		private void Startup ()
		{
			using (var pool = new NSAutoreleasePool ()) {
				InvokeOnMainThread (delegate {
					var binding = new BindingContext (new MovieListView (), "Movie List View");
					navigation.ViewControllers = new UIViewController[] { new DialogViewController (binding.Root, true) };
				});
			}
		}
        /// <summary>
        /// Convert the string representation to the destination type
        /// </summary>
        /// <param name="input">Input string</param>
        /// <param name="destinationType">Destination type</param>
        /// <param name="context">Current context</param>
        /// <returns>Converted object of the destination type</returns>
        public object Convert(string input, Type destinationType, BindingContext context)
        {
            if (string.IsNullOrEmpty(input))
            {
                return null;
            }

            return System.Convert.ChangeType(input, destinationType, context.Context.Culture);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Deserialize the request body to a model
        /// </summary>
        /// <param name="mediaRange">Content type to deserialize</param>
        /// <param name="bodyStream">Request body stream</param>
        /// <param name="context">Current <see cref="BindingContext"/>.</param>
        /// <returns>Model instance</returns>
        public object Deserialize(MediaRange mediaRange, Stream bodyStream, BindingContext context)
        {
            if (bodyStream.CanSeek)
            {
                bodyStream.Position = 0;
            }

            var ser = new XmlSerializer(context.DestinationType);
            return ser.Deserialize(bodyStream);
        }
		public void BuildChannelFactory ()
		{
			CustomBinding cb = new CustomBinding (
				new HttpTransportBindingElement ());
			BindingContext ctx = new BindingContext (
				cb, new BindingParameterCollection ());
			Element el = new Element ();
			IChannelFactory<IRequestChannel> cf =
				el.BuildChannelFactory<IRequestChannel> (ctx);
		}
 public RabbitMQOutputChannel(BindingContext context, IModel model, EndpointAddress address)
     : base(context, address)
 {
     m_bindingElement = context.Binding.Elements.Find<RabbitMQTransportBindingElement>();
     MessageEncodingBindingElement encoderElement = context.Binding.Elements.Find<MessageEncodingBindingElement>();
     if (encoderElement != null) {
         m_encoder = encoderElement.CreateMessageEncoderFactory().Encoder;
     }
     m_model = model;
 }
Exemplo n.º 31
0
 protected override void InitializeFields()
 {
     base.InitializeFields();
     BindingContext bindingContext = this.BindingContext;
 }
Exemplo n.º 32
0
 public QuickJSSources(BindingContext context, IEnumerable <TranslationUnit> units)
     : base(context, units)
 {
     CTypePrinter.PushContext(TypePrinterContextKind.Managed);
 }
 public BindableToolStripMenuItem(string text) :
     base(text)
 {
     m_Ctx          = new BindingContext();
     m_DataBindings = new ControlBindingsCollection(this);
 }
Exemplo n.º 34
0
 public CppGenerator(BindingContext context) : base(context)
 {
     typePrinter = new CppTypePrinter(Context);
 }
Exemplo n.º 35
0
 private void AnnounceBindingContext()
 {
     System.Diagnostics.Debug.WriteLine(GetType().Name);
     System.Diagnostics.Debug.WriteLine($"BindingContext: {BindingContext?.GetType()?.Name}");
 }
Exemplo n.º 36
0
        public void DemoReflectionApi()
        {
            if (settings == null)
            {
                var image = UIImage.FromFile("monodevelop-32.png");

                settings = new Settings()
                {
                    AccountEnabled = true,
                    Login          = "******",
                    TimeSamples    = new TimeSettings()
                    {
                        Appointment = DateTime.Now,
                        Birthday    = new DateTime(1980, 6, 24),
                        Alarm       = new DateTime(2000, 1, 1, 7, 30, 0, 0)
                    },
                    FavoriteType = TypeCode.Int32,
                    Top          = image,
                    Middle       = image,
                    Bottom       = image,
                    ListOfString = new List <string> ()
                    {
                        "One", "Two", "Three"
                    }
                };
            }

            var cb = new Callbacks();
            var bc = new BindingContext(cb, settings, "Settings");

            cb.Initalize(bc);

            var dv = new DialogViewController(bc.Root, true);

            // When the view goes out of screen, we fetch the data.
            dv.ViewDisappearing += delegate {
                // This reflects the data back to the object instance
                bc.Fetch();

                // Manly way of dumping the data.
                Console.WriteLine("Current status:");
                Console.WriteLine(
                    "AccountEnabled:   {0}\n" +
                    "Login:            {1}\n" +
                    "Password:         {2}\n" +
                    "Name:      	   {3}\n"+
                    "Appointment:      {4}\n" +
                    "Birthday:         {5}\n" +
                    "Alarm:            {6}\n" +
                    "Favorite Type:    {7}\n" +
                    "IEnumerable idx:  {8}\n" +
                    "I like ice cream: {9}\n" +
                    "I like veggies:   {10}\n" +
                    "Animal kinds:     {11}\n" +
                    "Animal sizes:     {12}",
                    settings.AccountEnabled, settings.Login, settings.Password, settings.Name,
                    settings.TimeSamples.Appointment, settings.TimeSamples.Birthday,
                    settings.TimeSamples.Alarm, settings.FavoriteType,
                    settings.selected,
                    settings.LikeIceCream, settings.LikeVegetables,
                    settings.Kinds, settings.Sizes);
            };
            navigation.PushViewController(dv, true);
        }
Exemplo n.º 37
0
        public void BindingContext_Add_NullListManager_ThrowsArgumentNullException()
        {
            var context = new BindingContext();

            Assert.Throws <ArgumentNullException>("listManager", () => context.Add(1, null));
        }
Exemplo n.º 38
0
        public override IChannelListener <TChannel> BuildChannelListener <TChannel>(BindingContext context)
        {
            IChannelListener <TChannel> listener = (IChannelListener <TChannel>)base.BuildChannelListener <TChannel>(context);

            return(listener);
        }
 protected override void OnBindingContextChanged()
 {
     base.OnBindingContextChanged();
     UpdateBackgroundColor(BindingContext.Equals(_previouslySelectedBindingContext));
 }
Exemplo n.º 40
0
 protected override void OnBindingContextChanged()
 {
     base.OnBindingContextChanged();
     System.Diagnostics.Debug.WriteLine(BindingContext.ToString());
 }
Exemplo n.º 41
0
        protected override void OnShown()
        {
            base.OnShown();

            BindingContext = new BindingContext();

            customers = new List <Customer>()
            {
                new Customer()
                {
                    CompanyID = 1, CompanyName = "Acme Workshop"
                },
                new Customer()
                {
                    CompanyID = 2, CompanyName = "Sirius Tech"
                }
            };
            formscombobox1.DataSource    = customers;
            formscombobox1.DisplayMember = "CompanyName";
            formscombobox1.ValueMember   = "CompanyID";

            formslabel1.DataBindings.Add("Text", customers, "CompanyId");

            customers2 = new NotifiedBindingList <Customer>()
            {
                new Customer()
                {
                    CompanyID = 1, CompanyName = "Acme Workshop"
                },
                new Customer()
                {
                    CompanyID = 2, CompanyName = "Sirius Tech"
                }
            };
            bsrcCustomers = new BindingSource()
            {
                DataSource = customers2
            };

            formscombobox2.DataSource    = bsrcCustomers;
            formscombobox2.DisplayMember = "CompanyName";
            formscombobox2.ValueMember   = "CompanyID";

            formslabel2.DataBindings.Add("Text", bsrcCustomers, "CompanyId");

            customers3 = new NotifiedBindingList <Customer>()
            {
                new Customer()
                {
                    CompanyID = 1, CompanyName = "Acme Workshop"
                },
                new Customer()
                {
                    CompanyID = 2, CompanyName = "Sirius Tech"
                }
            };

            formscomboboxentry1.DataSource    = customers3;
            formscomboboxentry1.DisplayMember = "CompanyName";
            formscomboboxentry1.ValueMember   = "CompanyID";
            formscomboboxentry1.DataBindings.Add("Text", customers3, "CompanyName", true, DataSourceUpdateMode.OnPropertyChanged);

            formslabel3.DataBindings.Add("Text", customers3, "CompanyId");
            formslabel4.DataBindings.Add("Text", customers3, "CompanyName");

            var bsrcCities = new BindingSource()
            {
                DataSource = new NotifiedBindingList <string> {
                    "Warszawa", "Krakow"
                }
            };
            //formscombobox3.DataSource = bsrcCities;

            City city = new City();

            //city.CityName = "Krakow";
            formscombobox3.DataSource = bsrcCities;
            formscombobox3.DataBindings.Add("SelectedItem", city, "CityName", false, DataSourceUpdateMode.OnPropertyChanged);
            formscombobox3.DataBindings[0].WriteValue();
            labelCityName.DataBindings.Add("Text", city, "CityName");

//			formscombobox3.DataSource = bsrcCities;

            city.CityType           = CityTypes.City;
            comboboxEnum.DataSource = Enum.GetValues(typeof(CityTypes));
            comboboxEnum.DataBindings.Add("SelectedItem", city, "CityType", false, DataSourceUpdateMode.OnPropertyChanged);
//			comboboxEnum.DataSource = Enum.GetValues (typeof(CityTypes));

            labelEnum.DataBindings.Add("Text", city, "CityType");

            City city2 = new City();

            comboboxEnum2.DataSource = Enum.GetValues(typeof(CityTypes));
            comboboxEnum2.DataBindings.Add("SelectedItem", city2, "CityType", false, DataSourceUpdateMode.OnPropertyChanged);
            comboboxEnum2.DataBindings [0].WriteValue();
            labelEnum2.DataBindings.Add("Text", city2, "CityType");
        }
Exemplo n.º 42
0
 public AmqpChannelFactory(AmqpTransportBindingElement transportBindingElement, BindingContext context) : base(transportBindingElement, context)
 {
     this.transportBindingElement = transportBindingElement;
     this.sharedAmqpConnections   = new ConcurrentDictionary <string, AmqpChannelFactory.SharedAmqpConnection>();
     this.sharedAmqpLinks         = new ConcurrentDictionary <string, AmqpChannelFactory.SharedAmqpLink>();
     this.amqpChannelEvents       = new AmqpChannelFactory.AmqpChannelEvents(this);
 }
Exemplo n.º 43
0
 public MyChannelFactory(BindingContext context)
 {
     this.InnerChannelFactory = context.BuildInnerChannelFactory <TChannel>();
 }
Exemplo n.º 44
0
 public Task <IValueProvider> BindAsync(BindingContext context)
 {
     return(BindAsync(context, null));
 }
Exemplo n.º 45
0
 public CHeaders(BindingContext context, TranslationUnit unit)
     : base(context, unit)
 {
 }
 public override bool CanBuildChannelFactory <TChannel>(BindingContext context)
 {
     return(false);
 }
Exemplo n.º 47
0
 public void BindingContext_UpdateBinding_NullBinding_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>("binding", () => BindingContext.UpdateBinding(new BindingContext(), null));
 }
Exemplo n.º 48
0
 public CSharpTypePrinter(BindingContext context)
 {
     Context = context;
 }
            public void Bind(BindingContext <object> ctx)
            {
                ctx.ObjectValue = arg;

                next(ctx);
            }
 public SimpleSessionChannelFactory(BindingContext context)
     : base(context)
 {
     this.Print("SimpleSessionChannelFactory()");
 }
Exemplo n.º 51
0
 public ChoToolStripBindableButton()
 {
     DataBindings   = new ControlBindingsCollection(this);
     BindingContext = new BindingContext();
 }
Exemplo n.º 52
0
        private static async Task ProcessOutputBindingsAsync(Collection <FunctionBinding> outputBindings, object input, Binder binder,
                                                             Dictionary <string, object> bindingData, Dictionary <string, object> scriptExecutionContext, object functionResult)
        {
            if (outputBindings == null)
            {
                return;
            }

            var bindings           = (Dictionary <string, object>)scriptExecutionContext["bindings"];
            var returnValueBinding = outputBindings.SingleOrDefault(p => p.Metadata.IsReturn);

            if (returnValueBinding != null)
            {
                // if there is a $return binding, bind the entire function return to it
                // if additional output bindings need to be bound, they'll have to use the explicit
                // context.bindings mechanism to set values, not return value.
                bindings[ScriptConstants.SystemReturnParameterBindingName] = functionResult;
            }
            else
            {
                // if the function returned binding values via the function result,
                // apply them to context.bindings
                IDictionary <string, object> functionOutputs = functionResult as IDictionary <string, object>;
                if (functionOutputs != null)
                {
                    foreach (var output in functionOutputs)
                    {
                        bindings[output.Key] = output.Value;
                    }
                }
            }

            foreach (FunctionBinding binding in outputBindings)
            {
                // get the output value from the script
                object value     = null;
                bool   haveValue = bindings.TryGetValue(binding.Metadata.Name, out value);
                if (!haveValue && binding.Metadata.Type == "http")
                {
                    // http bindings support a special context.req/context.res programming
                    // model, so we must map that back to the actual binding name if a value
                    // wasn't provided using the binding name itself
                    haveValue = bindings.TryGetValue("res", out value);
                }

                // apply the value to the binding
                if (haveValue && value != null)
                {
                    value = ConvertBindingValue(value);

                    BindingContext bindingContext = new BindingContext
                    {
                        TriggerValue = input,
                        Binder       = binder,
                        BindingData  = bindingData,
                        Value        = value
                    };
                    await binding.BindAsync(bindingContext);
                }
            }
        }
 public override bool CanBuildChannelListener <TChannel>(BindingContext context)
 {
     return(typeof(TChannel) == typeof(IReplyChannel));
 }
 public BindableToolStripMenuItem(System.Drawing.Image image) :
     base(image)
 {
     m_Ctx          = new BindingContext();
     m_DataBindings = new ControlBindingsCollection(this);
 }
 public BindableToolStripMenuItem(string text, System.Drawing.Image image, EventHandler onClick, string name) :
     base(text, image, onClick, name)
 {
     m_Ctx          = new BindingContext();
     m_DataBindings = new ControlBindingsCollection(this);
 }
Exemplo n.º 56
0
 protected BaseModuleControl(Func <object> viewModelnjector)
 {
     BindingContext = new BindingContext();
     viewModelCore  = viewModelnjector();
     InitServices();
 }
 public BindableToolStripMenuItem(string text, System.Drawing.Image image, params ToolStripItem[] dropDownItems) :
     base(text, image, dropDownItems)
 {
     m_Ctx          = new BindingContext();
     m_DataBindings = new ControlBindingsCollection(this);
 }
 public void Bind(BindingContext <string> ctx)
 {
 }
 public override IChannelListener <TChannel> BuildChannelListener <TChannel>(BindingContext context)
 {
     context.BindingParameters.Add(this);
     return(context.BuildInnerChannelListener <TChannel>());
 }
 public override bool CanBuildChannelListener <TChannel>(BindingContext context)
 {
     return(context.CanBuildInnerChannelListener <TChannel>());
 }