Esempio n. 1
0
        public void SetDataBindings(IMainWindowModel bindingSource)
        {
            NowPlaying.DataBindings.Add(AsyncBindingHelper.GetBinding(NowPlaying, "Text", bindingSource, "NowPlaying"));
            UpdateText.DataBindings.Add(AsyncBindingHelper.GetBinding(UpdateText, "Text", bindingSource, "UpdateText"));
            BeatmapsLoaded.DataBindings.Add(AsyncBindingHelper.GetBinding(BeatmapsLoaded, "Text", bindingSource, "BeatmapsLoaded"));

            OnUpdateTextClicked += bindingSource.UpdateTextClicked;
        }
Esempio n. 2
0
        /// <summary>
        /// Get a binding instance that can invoke a property change
        /// on the UI thread, regardless of the originating thread
        /// </summary>
        /// <param name="bindingControl">The UI control this binding is added to</param>
        /// <param name="propertyName">The property on the UI control to bind to</param>
        /// <param name="bindingSource">The source INotifyPropertyChanged to be
        /// observed for changes</param>
        /// <param name="dataMember">The property on the source to watch</param>
        /// <returns></returns>
        public static Binding GetBinding(Control bindingControl,
                                         string propertyName,
                                         INotifyPropertyChanged bindingSource,
                                         string dataMember)
        {
            AsyncBindingHelper helper
                = new AsyncBindingHelper(bindingControl, bindingSource, dataMember);

            return(new Binding(propertyName, helper, "Value"));
        }