Ejemplo n.º 1
0
 public MyMatrix GetMatrix()
 {
     if (ans == null)
     {
         ans = GetMatrixInternal();
         MatrixChanged?.Invoke(ans);
     }
     return(ans);
 }
Ejemplo n.º 2
0
        void UpdateMatrix()
        {
            Matrix?matrix = null;

            if (_visual != null && _visual.VisualRoot != null)
            {
                matrix = _visual.TransformToVisual(_visual.VisualRoot);
            }
            if (Matrix != matrix)
            {
                Matrix = matrix;
                MatrixChanged?.Invoke();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  Indexer retrieves data from a square matrix at two indices.
        /// </summary>
        /// <param name="i"> Vertical node index. </param>
        /// <param name="j"> Horizontal node index </param>
        /// <returns></returns>
        public T this[int i, int j]
        {
            get
            {
                CheckIndex(i);
                CheckIndex(j);
                return(Data[i * Rank + j]);
            }

            set
            {
                CheckIndex(i);
                CheckIndex(j);
                if (!value.Equals(Data[i * Rank + j]))
                {
                    MatrixChanged?.Invoke(i, j, Data[i * Rank + j], value);
                    Data[i * Rank + j] = value;
                }
            }
        }
Ejemplo n.º 4
0
 protected virtual void OnMatrixChanged(MatrixChangedEventArgs <T> e)
 {
     MatrixChanged?.Invoke(this, e);
 }
Ejemplo n.º 5
0
 protected void OnMatrixChanged()
 {
     MatrixChanged?.Invoke(this, EventArgs.Empty);
     UpdateMatrix();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Method ReceiveEvent is shell for event MatrixChanged.
 /// </summary>
 /// <param name="firstIndex"> First index of node from square matrix. </param>
 /// <param name="secondIndex"> Second index of node from square matrix. </param>
 /// <param name="oldValue"> Value before change. </param>
 /// <param name="newValue"> New value. </param>
 protected virtual void ReceiveEvent(int firstIndex, int secondIndex, T oldValue, T newValue)
 {
     MatrixChanged?.Invoke(firstIndex, secondIndex, oldValue, newValue);
 }
Ejemplo n.º 7
0
 protected void OnMatrixChanged(object sender, MatrixEventArgs e)
 {
     //Console.WriteLine("Changed!");
     MatrixChanged?.Invoke(sender, e);
 }
Ejemplo n.º 8
0
 public void OnMatrixChanged() => MatrixChanged?.Invoke(this, new EventArgs());