public void changes_to_the_source_should_be_marshalled_via_a_call_to_send(Mock<SynchronizationContext> synchronizationContext, BindingManager bindingManager, IPerson targetObject, IAddress sourceObject) { synchronizationContext.Setup(x => x.Send(It.IsAny<SendOrPostCallback>(), It.IsAny<object>())); sourceObject.Line1 = "Line 1, mighty fine"; synchronizationContext.VerifyAll(); }
public void it_must_have_a_converter(BindingManager bindingManager, MultiSourceBinding binding, IPerson targetObject, IAddress sourceObject) { bindingManager.Bindings.Remove(binding); binding.Converter = null; var ex = Assert.Throws<InvalidOperationException>(() => bindingManager.Bindings.Add(binding)); Assert.Equal("All MultiSourceBindings require a converter.", ex.Message); }
public void the_converted_value_is_used_when_the_target_is_changed(BindingManager bindingManager, SingleSourceBinding binding, Mock<IValueConverter> converter, IPerson targetObject, IPerson sourceObject) { converter.Setup(x => x.ConvertBack("Value", typeof(string), "parameter", null)).Returns("Converted Value"); targetObject.Address.Line2 = "Value"; Assert.Equal("Converted Value", sourceObject.Address.Line1); converter.VerifyAll(); }
private void AddBindings() { _customer = new Customer(); _bindingManager = new BindingManager(); _bindingManager.BindOnValidation = true; _bindingManager.Bindings.Add(new Binding(CustomerNameUI, "Text", _customer, "Name")); _bindingManager.Bindings.Add(new Binding(CustomerNameBO, "Text", _customer, "Name")); var address = _customer.Address; _bindingManager.Bindings.Add(new Binding(CustomerAddressCountryUI, "Text", address, "Country")); _bindingManager.Bindings.Add(new Binding(CustomerAddressCountryBO, "Text", address, "Country")); _bindingManager.Bindings.Add(new Binding(CustomerAddressZipCodeUI, "Text", _customer, "Address.ZipCode")); _bindingManager.Bindings.Add(new Binding(CustomerAddressZipCodeBO, "Text", _customer, "Address.ZipCode")); var invoice = _customer.Invoice; _bindingManager.Bindings.Add(new Binding(CustomerInvoiceInvoiceNumberUI, "Text", invoice, "InvoiceNumber")); _bindingManager.Bindings.Add(new Binding(CustomerInvoiceInvoiceNumberBO, "Text", invoice, "InvoiceNumber")); var invoicedateBinding = new Binding(CustomerInvoiceInvoiceDateUI, "Text", _customer, "Invoice.InvoiceDate"); invoicedateBinding.Converter = new DateTimeToDateConverter(); invoicedateBinding.ConverterCulture = CultureInfo.CurrentCulture; _bindingManager.Bindings.Add(invoicedateBinding); _bindingManager.Bindings.Add(new Binding { TargetObject = CustomerInvoiceInvoiceDateBO, TargetPath = "Text", SourceObject = _customer, SourcePath = "Invoice.InvoiceDate", Converter = new DateTimeToDateConverter(), ConverterCulture = CultureInfo.CurrentCulture }); }
public void conversions_from_target_to_source_are_ignored_when_there_is_no_converter(BindingManager bindingManager, SingleSourceBinding binding, IPerson targetObject, IPerson sourceObject) { targetObject.Name = "Kent"; Assert.Null(sourceObject.Gender); targetObject.Name = "Male"; Assert.Null(sourceObject.Gender); }
public void properties_and_events_exposed_by_the_class_are_successfully_resolved_and_bound(BindingManager bindingManager, CustomEntity targetObject, CustomEntity sourceObject) { SetName(sourceObject, "A new name"); Assert.Equal("A new name", GetName(targetObject)); SetName(targetObject, "Another name"); Assert.Equal("Another name", GetName(sourceObject)); }
public void it_becomes_active(BindingManager bindingManager, SingleSourceBinding binding, IPerson targetObject, IPerson sourceObject) { sourceObject.Name = "New Name"; Assert.Equal("New Name", targetObject.Name); targetObject.Name = "Another Name"; Assert.Equal("Another Name", sourceObject.Name); }
public void conversions_from_target_to_source_are_automatically_converted_where_possible(BindingManager bindingManager, SingleSourceBinding binding, IPerson targetObject, IPerson sourceObject) { targetObject.Name = "69"; Assert.Equal(69, sourceObject.Age); targetObject.Name = "13a"; Assert.Equal(69, sourceObject.Age); }
public void updating_the_target_does_not_update_the_source(BindingManager bindingManager, IPerson targetObject, IAddress sourceObject) { targetObject.Name = "A new address"; Assert.Null(sourceObject.Line1); targetObject.Name = "Another new address"; Assert.Null(sourceObject.Line1); }
public void it_becomes_inactive(BindingManager bindingManager, BindingBase binding, IPerson targetObject, IAddress sourceObject) { sourceObject.Line1 = "New Name"; Assert.Null(targetObject.Name); targetObject.Name = "Another Name"; Assert.Equal("New Name", sourceObject.Line1); }
public When_a_binding_manager_is_disposed() { _bindingManager = new BindingManager(); _targetObject = new Person(); _sourceObject = new Person(); _bindingManager.Bindings.Add(new Binding(_targetObject, "Name", _sourceObject, "Name")); _bindingManager.Bindings.Add(new Binding(_targetObject, "Age", _sourceObject, "Age")); _bindingManager.Dispose(); }
public void ClearOnDispose() { using(var form = new Form()) { using(BindingManager manager = new BindingManager()) { manager.SetValue(form, TextProperty, "test"); } Assert.That(form.GetValue(TextProperty), Is.Null); } }
private static void AddSimpleBinding(Customer customer1, Customer customer2, BindingManager bindingManager) { #region Simple Binding var binding = new Binding(customer1, "Name", customer2, "Name"); bindingManager.Bindings.Add(binding); #endregion }
public void it_becomes_active(BindingManager bindingManager, MultiSourceBinding binding, IPerson targetObject, IAddress sourceObject) { sourceObject.Line1 = "Line 1, mighty fine"; Assert.Equal("Line 1, mighty fine~", targetObject.Name); targetObject.Name = "Foo~Bar"; Assert.Equal("Foo", sourceObject.Line1); Assert.Equal("Bar", sourceObject.Line2); }
private static void AddSimpleBindingFluent(Customer customer1, Customer customer2, BindingManager bindingManager) { #region Simple Fluent Binding bindingManager.Bind(customer1, "Name") .To(customer2, "Name") .Activate(); #endregion }
public void updating_the_source_updates_the_target(BindingManager bindingManager, IPerson targetObject, IAddress sourceObject) { sourceObject.Line1 = "A new address"; Assert.Equal("A new address", targetObject.Name); sourceObject.Line1 = "Another new address"; Assert.Equal("Another new address", targetObject.Name); sourceObject.Line1 = null; Assert.Null(targetObject.Name); }
public void NullParameters() { using(var form = new Form()) { BindingManager manager = new BindingManager(); Assert.Throws<ArgumentNullException>( () => manager.SetBinding(null, "Text", new Binding()) ); Assert.Throws<ArgumentOutOfRangeException>( () => manager.SetBinding(form, (string)null, new Binding()) ); Assert.Throws<ArgumentOutOfRangeException>( () => manager.SetBinding(form, string.Empty, new Binding()) ); Assert.Throws<ArgumentNullException>( () => manager.SetBinding(form, "Text", null) ); Assert.Throws<ArgumentNullException>( () => manager.SetBinding(form, (AttachedPropertyBase)null, new Binding()) ); Assert.Throws<ArgumentException>( () => manager.ClearBinding(null, "Text") ); Assert.Throws<ArgumentNullException>( () => manager.ClearBinding(form, (string)null) ); Assert.Throws<ArgumentNullException>( () => manager.ClearBinding(form, (AttachedPropertyBase)null) ); Assert.Throws<ArgumentException>( () => manager.ClearBinding(form, string.Empty) ); Assert.Throws<ArgumentNullException>( () => manager.ClearAllBindings(null) ); Assert.Throws<ArgumentNullException>( () => manager.SetValue(null, TextProperty, string.Empty) ); Assert.Throws<ArgumentNullException>( () => manager.SetValue(form, (AttachedPropertyBase)null, string.Empty) ); Assert.Throws<ArgumentNullException>( () => manager.ClearValue(null, TextProperty) ); Assert.Throws<ArgumentNullException>( () => manager.ClearValue(form, (AttachedPropertyBase)null) ); } }
static void Main(string[] args) { var customer1 = new Customer(); var customer2 = new Customer(); var customer1OutputSink = new OutputSink(); var customer2OutputSink = new OutputSink(); using (var bindingManager = new BindingManager()) { var useFluentInterface = false; if (!useFluentInterface) { //add various bindings to the binding manager AddSimpleBinding(customer1, customer2, bindingManager); AddSimpleTypedBinding(customer1, customer2, bindingManager); AddComplexBinding(customer1, customer2, bindingManager); AddComplexTypedBinding(customer1, customer2, bindingManager); AddSimpleMultiBinding(customer1, customer1OutputSink, bindingManager); AddSimpleTypedMultiBinding(customer2, customer2OutputSink, bindingManager); } else { //add various bindings to the binding manager using the fluent interface AddSimpleBindingFluent(customer1, customer2, bindingManager); AddSimpleTypedBindingFluent(customer1, customer2, bindingManager); AddComplexBindingFluent(customer1, customer2, bindingManager); AddComplexTypedBindingFluent(customer1, customer2, bindingManager); AddSimpleMultiBindingFluent(customer1, customer1OutputSink, bindingManager); AddSimpleTypedMultiBindingFluent(customer2, customer2OutputSink, bindingManager); } //make some property changes customer1.Name = "Kent"; customer2.Gender = Gender.Male; customer2.Address.Line1 = "12 Somewhere Lodge"; customer2.Address.Line2 = "Northwich"; } //output the details of each Customer object OutputCustomer("Customer 1", customer1); OutputCustomer("Customer 2", customer2); //output the details of each output sink Console.WriteLine("Customer 1 Output Sink: {0}", customer1OutputSink.Output); Console.WriteLine("Customer 2 Output Sink: {0}", customer2OutputSink.Output); Console.WriteLine("Any key to exit"); Console.ReadKey(); }
public void changes_to_the_target_are_reflected_in_the_sources(BindingManager bindingManager, IPerson targetObject, IAddress sourceObject) { targetObject.Details = "Kent~0~~,,"; Assert.Equal("Kent", targetObject.Name); targetObject.Details = "Kent~0~~Line 1,,"; Assert.Equal("Line 1", sourceObject.Line1); targetObject.Details = "Kent~0~~Line 1,Line 2,"; Assert.Equal("Line 2", sourceObject.Line2); targetObject.Details = "Kent~0~~Line 1,Line 2,Line 3"; Assert.Equal("Line 3", sourceObject.Line3); targetObject.Details = "Kent~29~~Line 1,Line 2,Line 3"; Assert.Equal(29, targetObject.Age); targetObject.Details = "Kent~29~Male~Line 1,Line 2,Line 3"; Assert.Same(Gender.Male, targetObject.Gender); }
public void changes_to_the_sources_are_reflected_in_the_target(BindingManager bindingManager, IPerson targetObject, IAddress sourceObject) { sourceObject.Line1 = "Line 1"; Assert.Equal("~0~~Line 1,,", targetObject.Details); sourceObject.Line2 = "Line 2"; Assert.Equal("~0~~Line 1,Line 2,", targetObject.Details); sourceObject.Line3 = "Line 3"; Assert.Equal("~0~~Line 1,Line 2,Line 3", targetObject.Details); targetObject.Name = "Kent"; Assert.Equal("Kent~0~~Line 1,Line 2,Line 3", targetObject.Details); targetObject.Age = 21; Assert.Equal("Kent~21~~Line 1,Line 2,Line 3", targetObject.Details); targetObject.Gender = Gender.Male; Assert.Equal("Kent~21~Male~Line 1,Line 2,Line 3", targetObject.Details); }
internal MvvmFxTester(INumberName subjectUnderTest) { _subjectUnderTest = subjectUnderTest; var guineaPig = new TargetObject(); // bind using (var bindingManager = new BindingManager()) { var numberBinding = new TypedBinding<INumberName, INumberName> (guineaPig, t => t.Number, _subjectUnderTest, s => s.Number); var nameBinding = new TypedBinding<INumberName, INumberName> (guineaPig, t => t.FullName, _subjectUnderTest, s => s.FullName); bindingManager.Bindings.Add(numberBinding); bindingManager.Bindings.Add(nameBinding); var testDuration = new Stopwatch(); testDuration.Start(); Run(); testDuration.Stop(); Console.WriteLine( string.Format("Bind to source {0}: {1} msec.", subjectUnderTest.GetType().Name, testDuration.ElapsedMilliseconds.ToString("#,###"))); // unbind bindingManager.Bindings.Remove(numberBinding); bindingManager.Bindings.Remove(nameBinding); //bind back numberBinding = new TypedBinding<INumberName, INumberName> (_subjectUnderTest, t => t.Number, guineaPig, s => s.Number); nameBinding = new TypedBinding<INumberName, INumberName> (_subjectUnderTest, t => t.FullName, guineaPig, s => s.FullName); bindingManager.Bindings.Add(numberBinding); bindingManager.Bindings.Add(nameBinding); testDuration.Restart(); Run(); testDuration.Stop(); Console.WriteLine( string.Format("Bind to target {0}: {1} msec.", guineaPig.GetType().Name, testDuration.ElapsedMilliseconds.ToString("#,###"))); Console.WriteLine(); } }
private CommandParser() { m_infoTextManager = InfoTextManager.Instance; m_bindingManager = BindingManager.Instance; m_varManager = VarManager.Instance; foreach (Xim.Button button in Enum.GetValues(typeof(Xim.Button))) { String name = Enum.GetName(typeof(Xim.Button), button); m_buttonMap.Add(name.ToLower(), button); } foreach (Xim.Analog button in Enum.GetValues(typeof(Xim.Analog))) { String name = Enum.GetName(typeof(Xim.Analog), button); m_ximAnalogMap.Add(name.ToLower(), button); } }
public void it_uses_the_current_synchronization_context() { Assert.Same(SynchronizationContext.Current, _bindingManager.SynchronizationContext); var currentSynchronizationContext = SynchronizationContext.Current; try { var synchronizationContext = new Mock<SynchronizationContext>(); SynchronizationContext.SetSynchronizationContext(synchronizationContext.Object); _bindingManager = new BindingManager(); Assert.Same(SynchronizationContext.Current, _bindingManager.SynchronizationContext); } finally { SynchronizationContext.SetSynchronizationContext(currentSynchronizationContext); } }
internal static void Tests() { var person = new Person(); Console.WriteLine("Name: " + person.Name + "..."); Console.WriteLine("Age: " + person.Age); Console.WriteLine("Gender: " + person.Gender); var person1 = new Person { Name = "John", Age = 1 }; var person2 = new Person { Name = "Jack", Age = 2 }; var manager1 = new BindingManager(); var binding1 = new TypedBinding<Person, Person>(); binding1.SourceObject = person1; binding1.SourceExpression = s => s.Age; binding1.TargetObject = person2; binding1.TargetExpression = t => t.Age; manager1.Bindings.Add(binding1); person1.Age = 69; Console.WriteLine("Person1: " + person1.Age); Console.WriteLine("Person2: " + person2.Age + " (Expect 69)"); person2.Age = 18; Console.WriteLine("Person2: " + person2.Age); Console.WriteLine("Person1: " + person1.Age + " (Expect 18)"); var manager2 = new BindingManager(); manager2.Bindings.Add(new TypedBinding<Person, Person>(person2, t => t.Name, person1, s => s.Name)); person1.Name = "Mary"; Console.WriteLine("Person1: " + person1.Name); Console.WriteLine("Person2: " + person2.Name + " (Expect Mary)"); person2.Name = "Lucene"; Console.WriteLine("Person2: " + person2.Name); Console.WriteLine("Person1: " + person1.Name + " (Expect Lucene)"); person1.Name = null; Console.WriteLine("Person1: " + (person1.Name == null ? "null" : person1.Name)); Console.WriteLine("Person2: " + (person2.Name == null ? "null" : person2.Name)); person2.Name = null; Console.WriteLine("Person2: " + (person2.Name == null ? "null" : person2.Name)); Console.WriteLine("Person1: " + (person1.Name == null ? "null" : person1.Name)); }
public async override void ViewDidLoad() { base.ViewDidLoad(); if (Initialized) return; Initialized = true; this.View = new MainView(); // create binding manager Bindings = new BindingManager(this.View); ((MainView)this.View).btnSave.TouchUpInside += SaveButton_Click; ((MainView)this.View).btnCancel.TouchUpInside += CancelButton_Click; ((MainView)this.View).btnMarkForDelete.TouchUpInside += DeleteButton_Click; ((MainView)this.View).txtName.ShouldReturn += (textField) => { textField.ResignFirstResponder(); return true; }; var waitingOverlay = new WaitingOverlay(UIScreen.MainScreen.Bounds, "Loading..."); View.Add(waitingOverlay); try { this.Model = await CustomerEdit.GetCustomerEditAsync(1); InitializeBindings(this.Model); } catch (Exception ex) { var alert = new UIAlertView(); alert.Message = string.Format("the following error has occurred: {0}", ex.Message); alert.AddButton("Close"); alert.DismissWithClickedButtonIndex(0, false); alert.Show(); } finally { waitingOverlay.Hide(); } }
private void AddBindings() { _customer = new Customer(); _bindingManager = new BindingManager(); _bindingManager.BindOnValidation = true; _bindingManager.Bindings.Add( new TypedBinding<TextBox, Customer>(CustomerNameUI, t => t.Text, _customer, s => s.Name)); _bindingManager.Bindings.Add( new TypedBinding<Label, Customer>(CustomerNameBO, t => t.Text, _customer, s => s.Name)); var address = _customer.Address; _bindingManager.Bindings.Add( new TypedBinding<TextBox, Address>(CustomerAddressCountryUI, t => t.Text, address, s => s.Country)); _bindingManager.Bindings.Add( new TypedBinding<Label, Address>(CustomerAddressCountryBO, t => t.Text, address, s => s.Country)); _bindingManager.Bindings.Add( new TypedBinding<TextBox, Customer>(CustomerAddressZipCodeUI, t => t.Text, _customer, s => s.Address.ZipCode)); _bindingManager.Bindings.Add( new TypedBinding<Label, Customer>(CustomerAddressZipCodeBO, t => t.Text, _customer, s => s.Address.ZipCode)); var invoice = _customer.Invoice; _bindingManager.Bindings.Add( new TypedBinding<TextBox, Invoice>(CustomerInvoiceInvoiceNumberUI, t => t.Text, invoice, s => s.InvoiceNumber)); _bindingManager.Bindings.Add( new TypedBinding<Label, Invoice>(CustomerInvoiceInvoiceNumberBO, t => t.Text, invoice, s => s.InvoiceNumber)); var invoicedateBinding = new TypedBinding<TextBox, Customer>(CustomerInvoiceInvoiceDateUI, t => t.Text, _customer, s => s.Invoice.InvoiceDate); invoicedateBinding.Converter = new DateTimeToDateConverter(); invoicedateBinding.ConverterCulture = CultureInfo.CurrentCulture; _bindingManager.Bindings.Add(invoicedateBinding); _bindingManager.Bindings.Add(new TypedBinding<Label, Customer> { TargetObject = CustomerInvoiceInvoiceDateBO, TargetExpression = t => t.Text, SourceObject = _customer, SourceExpression = s => s.Invoice.InvoiceDate, Converter = new DateTimeToDateConverter(), ConverterCulture = CultureInfo.CurrentCulture }); }
private async Task Initialize() { if (Initialized) return; Initialized = true; // create binding manager Bindings = new BindingManager(this); //ErrorText = FindViewById<TextView>(Resource.Id.ErrorText); var saveButton = FindViewById<Button>(Resource.Id.SaveButton); saveButton.Click += SaveButton_Click; var cancelButton = FindViewById<Button>(Resource.Id.CancelButton); cancelButton.Click += CancelButton_Click; var deleteButton = FindViewById<Button>(Resource.Id.DeleteButton); deleteButton.Click += DeleteButton_Click; var dialog = new ProgressDialog(this); dialog.SetMessage(Resources.GetString(Resource.String.Loading)); dialog.SetCancelable(false); dialog.Show(); try { var customerEdit = await Library.CustomerEdit.GetCustomerEditAsync(1); InitializeBindings(customerEdit); } catch (Exception ex) { var alert = new AlertDialog.Builder(this); alert.SetMessage(string.Format(Resources.GetString(Resource.String.Error), ex.Message)); alert.Show(); } finally { dialog.Hide(); } }
static void InitializeDefault() { #if(NETMF) var typeDiscoverer = new TypeDiscoverer(); var typeSystem = new TypeSystem(); #else var assemblyLocator = new AssemblyLocator(); var typeDiscoverer = new TypeDiscoverer(assemblyLocator); var typeSystem = new TypeSystem(typeDiscoverer); #endif _current = new Container(typeSystem); var bindingManager = new BindingManager(typeSystem); var strategyActivator = new StrategyActivator(_current); var activationManager = new ActivationManager(typeDiscoverer, strategyActivator); var bindingDiscoverer = new BindingDiscoverer(_current, activationManager, typeSystem, typeDiscoverer); _current.Initialize(bindingManager, bindingDiscoverer, activationManager); }
private void OnLoad(object sender, EventArgs eventArgs) { try { var commandBindingManager = new CommandBindingManager(); var commandBinding = new CommandBinding(); _saveCommandButton = new BoundCommand(SaveMessage, CanSave, "Button"); commandBinding.SourceObject = Save; commandBinding.SourceEvent = ControlEvent.Click.ToString(); commandBinding.Command = _saveCommandButton; commandBindingManager.CommandBindings.Add(commandBinding); _saveCommandToolStrip = new BoundCommand(SaveMessage, CanSave, "ToolStrip"); commandBindingManager.CommandBindings.Add(new CommandBinding(_saveCommandToolStrip, Tool, ToolStripItemEvent.Click.ToString())); _closeComamand = new BoundCommand(Close, CanClose, null); commandBindingManager.CommandBindings.Add(new CommandBinding(_closeComamand, CloseForm, ControlEvent.Click.ToString())); var bindingManager = new BindingManager(); bindingManager.Bindings.Add(new TypedBinding<MainForm, TextBox>(this, t => t.FullNameText, FullName, s => s.Text)); } catch (Exception e) { MessageBox.Show(e.Message); } }
private string getKeyText(int i) { return(BindingManager.NiceName(cBindAlternateKeys.Checked ? stage.Columns[i].AlternateKey : stage.Columns[i].Key)); }
/// <summary> /// Tank data binding. /// </summary> protected override void Bind() { BindingManager.BindTanque(this); }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="context"></param> public BindableEditText(Context context) : base(context) { manager = new BindingManager <BindableEditText>(this); }
/// <summary> /// Devices binding. /// </summary> protected override void Bind() { BindingManager.BindDispositivos(this); }
/// <summary> /// Delivery points data binding. /// </summary> protected override void Bind() { BindingManager.BindPuntoDeEntrega(this); }
public void changes_to_the_source_should_be_marshalled_via_a_call_to_send(Mock <SynchronizationContext> synchronizationContext, BindingManager bindingManager, IPerson targetObject, IAddress sourceObject) { synchronizationContext.Setup(x => x.Send(It.IsAny <SendOrPostCallback>(), It.IsAny <object>())); sourceObject.Line1 = "Line 1, mighty fine"; synchronizationContext.VerifyAll(); }
protected override void Bind() { BindingManager.BindTipoGeocerca(this); }
protected override void Bind() { BindingManager.BindPeriodo(this); }
protected override void Bind() { BindingManager.BindTransportista(this); }
protected override void Bind() { BindingManager.BindSubEntidades(this); }
public override void OnCleanup(BindingManager bindingManager) { Debug.Log($"finish @ {DateTime.Now}"); }
public virtual void OnUnitsInitialized() { this.BindingManager = new MapBindingManager(Game, Bindings); BindingManager.Initialize(); }
protected override void Bind() { BindingManager.BindPuertas(this); }
protected override void Bind() { BindingManager.BindRecorrido(this); }
/// <summary> /// User types binding. /// </summary> protected override void Bind() { BindingManager.BindTipoValidacion(this); }
public Task ImportToSql(IDatabaseAdapter adapter, MainWindow.UpdateProgressFunc UpdateProgress, string IdKey, string bindingName) { return(Task.Run(() => { var binding = BindingManager.GetInstance().FindBinding(bindingName); adapter.Execute(string.Format(adapter.GetTableCreateString(binding), binding.Name)); uint currentRecord = 0; uint count = Header.RecordCount; uint updateRate = count < 100 ? 100 : count / 100; uint index = 0; StringBuilder q = null; foreach (var recordMap in Body.RecordMaps) { // This might be needed? Disabled unless bugs are reported around this //if (r.record.ID == 0) // continue; if (index == 0 || index % 250 == 0) { if (q != null) { q.Remove(q.Length - 2, 2); adapter.Execute(q.ToString()); } q = new StringBuilder(); q.Append(string.Format("INSERT INTO `{0}` VALUES ", bindingName)); } if (++index % updateRate == 0) { // Visual studio says these casts are redundant but it does not work without them double percent = (double)index / (double)count; UpdateProgress(percent); } currentRecord = recordMap.ContainsKey(IdKey) ? (uint)recordMap[IdKey] : 0; q.Append("("); foreach (var field in binding.Fields) { switch (field.Type) { case BindingType.INT: case BindingType.UINT: case BindingType.UINT8: { q.Append(string.Format("'{0}', ", recordMap[field.Name])); break; } case BindingType.FLOAT: case BindingType.DOUBLE: { q.Append(string.Format("REPLACE('{0}', ',', '.'), ", recordMap[field.Name])); break; } case BindingType.STRING_OFFSET: { var strOffset = (uint)recordMap[field.Name]; var lookupResult = Reader.LookupStringOffset(strOffset); q.Append(string.Format("'{0}', ", adapter.EscapeString(lookupResult))); break; } case BindingType.UNKNOWN: break; default: throw new Exception($"ERROR: Record[{currentRecord}] Unhandled type: {field.Type} on field: {field.Name}"); } } q.Remove(q.Length - 2, 2); q.Append("), "); } if (q.Length > 0) { q.Remove(q.Length - 2, 2); adapter.Execute(q.ToString()); } // We have attempted to import the Spell.dbc so clean up unneeded data // This will be recreated if the import process is started again Reader.CleanStringsMap(); })); }
public void conversions_from_source_to_target_are_ignored_when_there_is_no_converter(BindingManager bindingManager, SingleSourceBinding binding, IPerson targetObject, IPerson sourceObject) { sourceObject.Gender = Gender.Male; Assert.Null(targetObject.Name); }
protected override void Bind() { BindingManager.BindCategoriaAcceso(this); }
protected override void InitializeDataBindings() { BindingManager.AddBinding("taskNameCtrl.Text", "GetTaskName()", BindingDirection.TargetToSource); BindingManager.AddBinding("transactionIdCtrl.Text", "GetTransactionId()", BindingDirection.TargetToSource); BindingManager.AddBinding("transactionCreatedByCtrl.Text", "GetUsername()", BindingDirection.TargetToSource); }
protected override void Bind() { BindingManager.BindTipoZonaAcceso(this); }
protected override void InitializeDataBindings() { BindingManager.AddBinding("outboundFlight.Value", "outboundFlightIndex"); BindingManager.AddBinding("returnFlight.Value", "returnFlightIndex"); }
/// <summary> /// Bind Locaciones. /// </summary> protected override void Bind() { BindingManager.BindPlanta(this); }
protected override void Bind() { BindingManager.BindLocacion(this); }
protected override void Bind() { BindingManager.BindPrecinto(this); }
public void it_is_not_present_in_the_bindings_collection(BindingManager bindingManager, BindingBase binding, IPerson targetObject, IAddress sourceObject) { Assert.DoesNotContain(binding, bindingManager.Bindings); }
public When_binding_to_multiple_sources_with_path_using_the_fluent_interface() { _bindingManager = new BindingManager(); _targetObject = new Person(); _sourceObject = new Address(); }
//notice: notes' drawDepth is 0.8F internal override void InitializeSprites() { base.InitializeSprites(); HpBar = hitObjectManager.ManiaStage.HPBar; if (!Configuration.ConfigManager.GetTipStatus(Tips.ManiaSpeedChange)) { NotificationManager.ShowMessageMassive(string.Format(LocalisationManager.GetString(OsuString.Tips_ManiaSpeedChange), BindingManager.NiceName(Bindings.IncreaseSpeed), BindingManager.NiceName(Bindings.DecreaseSpeed)), 2500); Configuration.ConfigManager.SetTipStatus(Tips.ManiaSpeedChange, true); } }
/// <summary> /// Updates a text component with the ValueDisplay of the relevant binding. /// </summary> /// <param name="_binding">The binding we want to use the display for.</param> /// <param name="_text">The text object we are updating.</param> public static void UpdateTextWithBinding(string _binding, TextMeshProUGUI _text) { _text.text = BindingManager.GetBinding(_binding).ValueDisplay; }
public void it_does_not_prevent_the_target_object_from_being_garbage_collected(BindingManager bindingManager, WeakReference targetObject, WeakReference sourceObject) { GC.Collect(); GC.WaitForPendingFinalizers(); Assert.False(targetObject.IsAlive); }
protected override void Bind() { BindingManager.BindProfiles(this); }