public override void ViewDidLoad() { base.ViewDidLoad(); Title = "_VIEWNAME_"; View.Frame = UIScreen.MainScreen.Bounds; View.BackgroundColor = UIColor.White; #region Bind to example property and command var button = UIButton.FromType(UIButtonType.System); float buttonWidth = 200, buttonHeight = 30; button.Frame = new RectangleF(View.Frame.Width / 2 - buttonWidth / 2, View.Frame.Height / 2 - buttonHeight / 2, buttonWidth, buttonHeight); button.SetTitle("Click me", UIControlState.Normal); View.AddSubview(button); var label = new UILabel(new RectangleF(button.Frame.Left, button.Frame.Bottom + 2, button.Frame.Width, button.Frame.Height)); label.TextAlignment = UITextAlignment.Center; View.AddSubview(label); var bindingsParameters = new BindingParameters[] { new BindingParameters { View = button, ViewModelPropertyName = _VIEWNAME_ViewModel.COMMANDNAME_IncreaseCountCommand, Mode = BindingMode.Command }, new BindingParameters { View = label, ViewModelPropertyName = _VIEWNAME_ViewModel.PROPERTYNAME_Count } }; #endregion Bind to example property and command InitializeBindings(View, _APPNAME_Application.Instance._VIEWNAME_ViewModel, bindingsParameters); }
/// <summary> /// Initializes a new instance of the <see cref="BindingSourceAccessorBase" /> class. /// </summary> protected BindingSourceAccessorBase([NotNull] IDataContext context, bool isTarget) { Should.NotBeNull(context, "context"); _isTarget = isTarget; bool hasValue = false; Func <IDataContext, IBindingValueConverter> converterDelegate; Func <IDataContext, CultureInfo> converterCultureDelegate = null; Func <IDataContext, object> converterParameterDelegate = null; object targetNullValue; if (context.TryGetData(BindingBuilderConstants.Converter, out converterDelegate)) { converterCultureDelegate = context.GetData(BindingBuilderConstants.ConverterCulture); converterParameterDelegate = context.GetData(BindingBuilderConstants.ConverterParameter); hasValue = true; } if (context.TryGetData(BindingBuilderConstants.TargetNullValue, out targetNullValue)) { hasValue = true; } Func <IDataContext, object> fallbackDelegate = null; if (!isTarget && context.TryGetData(BindingBuilderConstants.Fallback, out fallbackDelegate)) { hasValue = true; } if (hasValue) { _parameters = new BindingParameters(converterDelegate, converterCultureDelegate, converterParameterDelegate, fallbackDelegate, targetNullValue); } AutoConvertValue = AutoConvertValueDefault; }
public virtual void Dispose() { if (IsDebuggable) { DebugInfo($"{(IsTarget ? "Target" : "Source")} accessor disposed"); } _parameters = null; }
private void ExportBindings() { // not supported, only export bindings at application level // -GroupLevel Optional. If specified, all bindings in the current group are exported. // -GlobalParties Optional. If specified, the global party information for the group is exported. // -AssemblyName Optional. The full name of the BizTalk assembly. if (this.BindingFile == null) { // -Destination Required. Path and file name of the XML binding file to write. this.Log.LogError("BindingFile is required"); return; } // use default app if no app name is provided if (string.IsNullOrEmpty(this.Application)) { // -ApplicationName Optional. The name of the BizTalk application. this.Application = this.explorer.DefaultApplication.Name; this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Using default application {0}", this.Application)); } // create dir if it doesn't exist string dir = Path.GetDirectoryName(Path.GetFullPath(this.BindingFile.ItemSpec)); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Created directory {0}", dir)); } using (SqlConnection sqlConnection = new SqlConnection(this.explorer.ConnectionString)) { using (BindingInfo info = new BindingInfo()) { BindingParameters bindingParameters = new BindingParameters(new Version(info.Version)) { BindingItems = BindingParameters.BindingItemTypes.All, BindingScope = BindingParameters.BindingScopeType.Application }; info.AddApplicationRef(sqlConnection, this.Application); info.Select(sqlConnection, bindingParameters); info.SaveXml(this.BindingFile.ItemSpec); this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Exported {0} bindings to {1}", this.Application, this.BindingFile.ItemSpec)); } } }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public virtual void Dispose() { _parameters = null; }
/// <summary> /// Initializes a new instance of the <see cref="BindingSourceAccessorBase" /> class. /// </summary> protected BindingSourceAccessorBase([NotNull] IDataContext context, bool isTarget) { Should.NotBeNull(context, "context"); _isTarget = isTarget; bool hasValue = false; Func<IDataContext, IBindingValueConverter> converterDelegate; Func<IDataContext, CultureInfo> converterCultureDelegate = null; Func<IDataContext, object> converterParameterDelegate = null; object targetNullValue; if (context.TryGetData(BindingBuilderConstants.Converter, out converterDelegate)) { converterCultureDelegate = context.GetData(BindingBuilderConstants.ConverterCulture); converterParameterDelegate = context.GetData(BindingBuilderConstants.ConverterParameter); hasValue = true; } if (context.TryGetData(BindingBuilderConstants.TargetNullValue, out targetNullValue)) hasValue = true; Func<IDataContext, object> fallbackDelegate = null; if (!isTarget && context.TryGetData(BindingBuilderConstants.Fallback, out fallbackDelegate)) hasValue = true; if (hasValue) _parameters = new BindingParameters(converterDelegate, converterCultureDelegate, converterParameterDelegate, fallbackDelegate, targetNullValue); }
public virtual void Dispose() { _parameters = null; }
private void ExportBindings() { // not supported, only export bindings at application level // -GroupLevel Optional. If specified, all bindings in the current group are exported. // -GlobalParties Optional. If specified, the global party information for the group is exported. // -AssemblyName Optional. The full name of the BizTalk assembly. if (this.BindingFile == null) { // -Destination Required. Path and file name of the XML binding file to write. this.Log.LogError("BindingFile is required"); return; } // use default app if no app name is provided if (string.IsNullOrEmpty(this.Application)) { // -ApplicationName Optional. The name of the BizTalk application. this.Application = this.explorer.DefaultApplication.Name; this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Using default application {0}", this.Application)); } // create dir if it doesn't exist string dir = Path.GetDirectoryName(Path.GetFullPath(this.BindingFile.ItemSpec)); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Created directory {0}", dir)); } using (SqlConnection sqlConnection = new SqlConnection(this.explorer.ConnectionString)) { using (BindingInfo info = new BindingInfo()) { BindingParameters bindingParameters = new BindingParameters(new Version(info.Version)) { BindingItems = BindingParameters.BindingItemTypes.All, BindingScope = BindingParameters.BindingScopeType.Application }; info.AddApplicationRef(sqlConnection, this.Application); info.Select(sqlConnection, bindingParameters); info.SaveXml(this.BindingFile.ItemSpec); this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Exported {0} bindings to {1}", this.Application, this.BindingFile.ItemSpec)); } } }