Пример #1
0
 protected Binder(IChangable source, IChangable target, BindingMode mode)
 {
     _source       = source;
     _target       = target;
     _sourceIsUsed = mode == BindingMode.OneWay || mode == BindingMode.TwoWay;
     _targetIsUsed = mode == BindingMode.OneWayToSource || mode == BindingMode.TwoWay;
 }
Пример #2
0
 protected Binder(IChangable source, IChangable target, BindingMode mode)
 {
     _source = source;
     _target = target;
     _sourceIsUsed = mode == BindingMode.OneWay || mode == BindingMode.TwoWay;
     _targetIsUsed = mode == BindingMode.OneWayToSource || mode == BindingMode.TwoWay;
 }
Пример #3
0
        public void ShouldChangeStructstate()
        {
            var p = new ChangeablePoint(1, 1);

            p.Change(2, 2);
            IChangable o = p;

            o.Change(3, 3);

            Assert.AreNotEqual(o, p);
        }
Пример #4
0
 public static void AddCustomChangable(Type targetType, IChangable changable)
 {
     CustomChangableMap.Add(targetType, changable);
 }
Пример #5
0
		public bool IsModified(IChangable latest)
		{
			return latest.LastModified > LastModified;
		}
Пример #6
0
 /// <summary>
 /// Stops changable from receiving notifications about state changes
 /// </summary>
 /// <param name="chnagable">Changable to register</param>
 /// <returns>Current game state</returns>
 public void Unsubscribe(IChangable chnagable)
 {
     Changables.Remove(chnagable);
 }
Пример #7
0
 /// <summary>
 /// Registers new changable to notify about state changes
 /// </summary>
 /// <param name="changable">Changable to register</param>
 /// <returns>Current game state</returns>
 public GameState Subscribe(IChangable changable)
 {
     Changables.Add(changable);
     return(State);
 }
Пример #8
0
 public static void AddCustomChangable(Type targetType, IChangable changable)
 {
     CustomChangableMap.Add(targetType, changable);
 }