コード例 #1
0
ファイル: Form1.cs プロジェクト: TobiHatti/EndevFramework
        public Form1()
        {
            InitializeComponent();

            bm.Bind(textBox1, "Text", "SimpleBind1");
            bm.Bind(listBox1, "Items", "DataBind3");


            bm.LoadFromFile(@"C:\Users\zivi\Desktop\test.ini");

            bm.FillBindings();
        }
コード例 #2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            _viewModel.Refresh();

            _bindings.Bind(
                () => _viewModel.Name,
                value => this.Title = value);

            _bindings.BindItems(
                TableView,
                () => _viewModel.Forecasts,
                (cell, forecast, bindings) =>
            {
                bindings.BindText(
                    cell.TextLabel,
                    () => forecast.Text);
                if (cell.DetailTextLabel != null)
                {
                    bindings.BindText(
                        cell.DetailTextLabel,
                        () => forecast.Description);
                }
            });
        }
コード例 #3
0
 void ResolveUsingAssemblyReferences()
 {
     foreach (Boo.Lang.Ast.Module module in CompileUnit.Modules)
     {
         UsingCollection usingCollection = module.Using;
         Using[]         usingArray      = usingCollection.ToArray();
         for (int i = 0; i < usingArray.Length; ++i)
         {
             Using u = usingArray[i];
             ReferenceExpression reference = u.AssemblyReference;
             if (null != reference)
             {
                 try
                 {
                     Assembly asm = Assembly.LoadWithPartialName(reference.Name);
                     CompilerParameters.References.Add(asm);
                     BindingManager.Bind(reference, new Bindings.AssemblyBinding(asm));
                 }
                 catch (Exception x)
                 {
                     Errors.UnableToLoadAssembly(reference, reference.Name, x);
                     usingCollection.RemoveAt(i);
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: AstAttributesStep.cs プロジェクト: codehaus/boo
        public override void OnAttribute(Boo.Lang.Ast.Attribute attribute, ref Boo.Lang.Ast.Attribute resultingNode)
        {
            // Neste primeiro passo tentamos apenas
            // resolver ast attributes.
            // Um passo posterior (resoluo de nomes e tipos) ir
            // assegurar que todos os nomes tenham sido resolvidos e colocar
            // mensagens de erro de acordo
            IBinding binding = ResolveQualifiedName(attribute, attribute.Name);

            if (null == binding)
            {
                binding = ResolveQualifiedName(attribute, BuildAttributeName(attribute.Name));
            }

            if (null != binding)
            {
                if (BindingType.Ambiguous == binding.BindingType)
                {
                    Errors.AmbiguousName(attribute, attribute.Name, ((AmbiguousBinding)binding).Bindings);
                }
                else
                {
                    if (BindingType.TypeReference != binding.BindingType)
                    {
                        Errors.NameNotType(attribute, attribute.Name);
                    }
                    else
                    {
                        ITypeBinding attributeType = ((ITypedBinding)binding).BoundType;
                        if (IsAstAttribute(attributeType))
                        {
                            ExternalTypeBinding externalType = attributeType as ExternalTypeBinding;
                            if (null == externalType)
                            {
                                Errors.AstAttributeMustBeExternal(attribute, attributeType);
                            }
                            else
                            {
                                ScheduleAttributeApplication(attribute, externalType.Type);

                                // remove it from parent
                                resultingNode = null;
                            }
                        }
                        else
                        {
                            if (!IsSystemAttribute(attributeType))
                            {
                                Errors.TypeNotAttribute(attribute, attributeType.FullName);
                            }
                            else
                            {
                                // remember the attribute's type
                                BindingManager.Bind(attribute, attributeType);
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
        public override void BindViewModel(StocktakeNewViewModel viewModel)
        {
            base.BindViewModel(viewModel);

            BindingManager.Bind(this).To(viewModel);

            BindingManager.For(this).BindCommand(btnContinue).To(viewModel, _ => _.ContinueCommand);
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: hu13779472390/MvvmFx
        private static void AddSimpleTypedBindingFluent(Customer customer1, Customer customer2, BindingManager bindingManager)
        {
            #region Simple Fluent TypedBinding

            bindingManager.Bind(customer1, c => c.Gender)
            .To(customer2, c => c.Gender)
            .Activate();

            #endregion
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: hu13779472390/MvvmFx
        private static void AddSimpleBindingFluent(Customer customer1, Customer customer2, BindingManager bindingManager)
        {
            #region Simple Fluent Binding

            bindingManager.Bind(customer1, "Name")
            .To(customer2, "Name")
            .Activate();

            #endregion
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: hu13779472390/MvvmFx
        private static void AddComplexTypedBindingFluent(Customer customer1, Customer customer2, BindingManager bindingManager)
        {
            #region Complex Fluent TypedBinding

            bindingManager.Bind(customer1, c => c.Address.Line2)
            .To(customer2, c => c.Address.Line2)
            .OneWayToTarget()
            .WithConverter(new FormerAddressLineConverter())
            .Activate();

            #endregion
        }
コード例 #9
0
ファイル: Form1.cs プロジェクト: stefanbalan/WinFormsMVVM
        public Form1()
        {
            InitializeComponent();

            _bindingManager
            .Bind(vm => vm.GetItems, btnNonBlocking)
            .Bind(vm => vm.FinishedGettingItems, v => { chkFinished.Checked = v; })
            .Bind(vm => vm.Items, v =>
            {
                //cmbTest.DataSource = null;
                //cmbTest.Items.Clear();
                cmbTest.DataSource = v;
            });
        }
コード例 #10
0
        void ResolveNamespaces()
        {
            ResolveUsingAssemblyReferences();
            OrganizeNamespaces();

            foreach (Boo.Lang.Ast.Module module in CompileUnit.Modules)
            {
                foreach (Using using_ in module.Using)
                {
                    IBinding binding = ResolveQualifiedName(using_.Namespace);
                    if (null == binding)
                    {
                        binding = ErrorBinding.Default;
                        Errors.InvalidNamespace(using_);
                    }
                    else
                    {
                        if (null != using_.AssemblyReference)
                        {
                            NamespaceBinding nsBinding = binding as NamespaceBinding;
                            if (null == nsBinding)
                            {
                                Errors.NotImplemented(using_, "assembly qualified type references");
                            }
                            else
                            {
                                binding = new AssemblyQualifiedNamespaceBinding(GetBoundAssembly(using_.AssemblyReference), nsBinding);
                            }
                        }
                        if (null != using_.Alias)
                        {
                            binding = new AliasedNamespaceBinding(using_.Alias.Name, binding);
                            BindingManager.Bind(using_.Alias, binding);
                        }
                    }

                    _context.TraceInfo("{1}: using reference '{0}' bound to {2}.", using_, using_.LexicalInfo, binding.Name);
                    BindingManager.Bind(using_, binding);
                }
            }
        }
コード例 #11
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            _viewModel.SelectedCityHeader = null;

            _bindings.BindItems(
                TableView,
                () => _viewModel.CityHeaders,
                () => _viewModel.SelectedCityHeader,
                value => _viewModel.SelectedCityHeader = value,
                (cell, city, bindings) =>
            {
                bindings.BindText(
                    cell.TextLabel,
                    () => city.Name);
            });

            _bindings.Bind(
                () => _viewModel.SelectedCityHeader,
                cityHeader => OnSelected(cityHeader));
        }
コード例 #12
0
        public void InitializeUIBindings(IPersonViewModel viewModel)
        {
            ViewModel = viewModel;
            _BM.Connect(ViewModel, this);
            _BM.Bind(eFirstname, t => t.Text, vm => vm.FirstName, false, DataSourceUpdateMode.OnPropertyChanged);
            _BM.Bind(eLastname, t => t.Text, vm => vm.LastName, false, DataSourceUpdateMode.OnPropertyChanged);
            _BM.Bind(eEmail, t => t.Text, vm => vm.Email, false, DataSourceUpdateMode.OnPropertyChanged);
            _BM.Bind(eBirthdate, t => t.Value, vm => vm.BirthDate, false, DataSourceUpdateMode.OnPropertyChanged);
            _BM.Bind(lCombined, t => t.Text, vm => vm.FullName, false, DataSourceUpdateMode.OnPropertyChanged);
            _BM.Bind(bSave, t => t.Enabled, vm => vm.ValidationOk, false, DataSourceUpdateMode.OnPropertyChanged);

            /*
             * _BM.Bind(eFirstname, t => t.Enabled, vm => vm.Enabled, false, DataSourceUpdateMode.OnPropertyChanged);
             * _BM.Bind(eLastname, t => t.Enabled, vm => vm.Enabled, false, DataSourceUpdateMode.OnPropertyChanged);
             */

            eLastname.DataBindings.Add("Enabled", ViewModel, "Enabled");
        }
コード例 #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Master);

            _bindings.Initialize(this);
            ViewModelLocator.Initialize(
                Resources.GetString(Resource.String.MashapeKey),
                new AndroidStorageService());

            _viewModel = ViewModelLocator.Instance.Main;

            _viewModel.SelectedCityHeader = null;

            _bindings.BindCommand(
                FindViewById <Button>(Resource.Id.buttonAdd),
                () => StartActivity(typeof(NewCityActivity)));

            _bindings.BindItems(
                FindViewById <ListView>(Resource.Id.listCities),
                () => _viewModel.CityHeaders,
                global::Android.Resource.Layout.SimpleListItem1,
                () => _viewModel.SelectedCityHeader,
                value => _viewModel.SelectedCityHeader = value,
                (cell, city, bindings) =>
            {
                bindings.BindText(
                    cell.FindViewById <TextView>(global::Android.Resource.Id.Text1),
                    () => city.Name);
            });

            _bindings.Bind(
                () => _viewModel.SelectedCityHeader,
                cityHeader => OnSelected(cityHeader));
        }
コード例 #14
0
        public void it_must_have_a_target_object()
        {
            var ex = Assert.Throws <ArgumentNullException>(() => _bindingManager.Bind(null, "Name"));

            Assert.Equal("targetObject", ex.ParamName);
        }
コード例 #15
0
        public void it_must_have_a_binding_manager()
        {
            BindingManager bindingManager = null;
            var            ex             = Assert.Throws <ArgumentNullException>(() => bindingManager.Bind(_targetObject, "Name"));

            Assert.Equal("bindingManager", ex.ParamName);
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: tfreitasleal/MvvmFx
        private static void AddSimpleTypedBindingFluent(Customer customer1, Customer customer2, BindingManager bindingManager)
        {
            #region Simple Fluent TypedBinding

            bindingManager.Bind(customer1, c => c.Gender)
                .To(customer2, c => c.Gender)
                .Activate();

            #endregion
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: tfreitasleal/MvvmFx
        private static void AddComplexTypedBindingFluent(Customer customer1, Customer customer2, BindingManager bindingManager)
        {
            #region Complex Fluent TypedBinding

            bindingManager.Bind(customer1, c => c.Address.Line2)
                .To(customer2, c => c.Address.Line2)
                .OneWayToTarget()
                .WithConverter(new FormerAddressLineConverter())
                .Activate();

            #endregion
        }
コード例 #18
0
ファイル: Program.cs プロジェクト: tfreitasleal/MvvmFx
        private static void AddSimpleBindingFluent(Customer customer1, Customer customer2, BindingManager bindingManager)
        {
            #region Simple Fluent Binding

            bindingManager.Bind(customer1, "Name")
                .To(customer2, "Name")
                .Activate();

            #endregion
        }