private void NotifyHost_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            PropertyInfo    prop   = sender.GetType().GetProperty(e.PropertyName);
            string          val    = string.Empty;
            Action <object> action = null;

            if (ActionDict?.TryGetValue(e.PropertyName, out action) ?? false)
            {
                val = prop.GetValue(sender).ToString();
                action?.Invoke(prop.GetValue(sender));
            }
        }
Beispiel #2
0
 private void InitDict()
 {
     ActionDict.Add("discard");
     ActionDict.Add("chow");
     ActionDict.Add("pong");
     ActionDict.Add("kongExposed");
     ActionDict.Add("kongConcealed");
     ActionDict.Add("triplet2kong");
     ActionDict.Add("richi");
     ActionDict.Add("winchuck");
     ActionDict.Add("skip");
     ActionDict.Add("winselfdraw");
 }
        private void NotifyHost_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (this == null) //OnDestroy is not called for disabled objects so this will make sure it is called if it gets called while destroyed
            {
                OnDestroy();
                return;
            }
            PropertyInfo    prop   = sender.GetType().GetProperty(e.PropertyName);
            Action <object> action = null;

            if (ActionDict.TryGetValue(e.PropertyName, out action))
            {
                action?.Invoke(prop.GetValue(sender));
            }
        }
Beispiel #4
0
        private bool IsActionLine(string s)
        {
            if (ActionDict.Count < 1)
            {
                InitDict();
            }
            var begin = s.IndexOf("[", StringComparison.Ordinal);
            var end   = s.IndexOf("]", StringComparison.Ordinal);

            if (begin < 0 || end <= begin)
            {
                return(false);
            }

            var actionname = s.Substring(begin + 1, end - begin - 1);

            return(ActionDict.Contains(actionname));
        }