<commit_before>﻿// NotifyChange.cs
// (c) Copyright Cirrious Ltd. http://www.cirrious.com
// MvvmCross is licensed using Microsoft Public License (Ms-PL)
// Contributions and inspirations noted in readme.md and license.txt
//
// Project Lead - Stuart Lodge, @slodge, <EMAIL>

using System;
using System.Collections.Generic;
using MvvmCross.Platform.Core;

namespace MvvmCross.FieldBinding
{
    public class NotifyChange
        : MvxMainThreadDispatchingObject
          , INotifyChange
    {
        private bool _shouldAlwaysRaiseChangedOnUserInterfaceThread;

        public NotifyChange()
        {
            _shouldAlwaysRaiseChangedOnUserInterfaceThread = true;
        }

        protected NotifyChange(object value)
        {
            _value = value;
        }

        protected NotifyChange(object value, Action<object> valueChanged)
        {
            _value = value;
            Changed += (s, e) => { valueChanged?.Invoke(Value); };
        }

        public bool ShouldAlwaysRaiseChangedOnUserInterfaceThread()
        {
            return _shouldAlwaysRaiseChangedOnUserInterfaceThread;
        }
<commit_msg>fixed bug on fieldbinding: _shouldAlwaysRaiseChangedOnUserInterfaceThread does not be invoked sometime;<commit_after>﻿// NotifyChange.cs
// (c) Copyright Cirrious Ltd. http://www.cirrious.com
// MvvmCross is licensed using Microsoft Public License (Ms-PL)
// Contributions and inspirations noted in readme.md and license.txt
//
// Project Lead - <NAME>, @slodge, <EMAIL>

using System;
using System.Collections.Generic;
using MvvmCross.Platform.Core;

namespace MvvmCross.FieldBinding
{
    public class NotifyChange
        : MvxMainThreadDispatchingObject
          , INotifyChange
    {
        private bool _shouldAlwaysRaiseChangedOnUserInterfaceThread;

        public NotifyChange()
        {
            _shouldAlwaysRaiseChangedOnUserInterfaceThread = true;
        }

        protected NotifyChange(object value) : this()
        {
            _value = value;
        }

        protected NotifyChange(object value, Action<object> valueChanged) : this(value)
        {
            Changed += (s, e) => { valueChanged?.Invoke(Value); };
        }

        public bool ShouldAlwaysRaiseChangedOnUserInterfaceThread()
        {
            return _shouldAlwaysRaiseChangedOnUserInterfaceThread;
        }

{'fraction_non_alphanumeric': 0.08017057569296375, 'fraction_numerical': 0.0, 'mean_word_length': 2.688679245283019, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4933864', 'n_tokens_mistral': 643, 'n_tokens_neox': 617, 'n_words': 148}