Esempio n. 1
0
        public void ChangeFpErrorCodeOwner(RouteStationFailure failure)
        {
            var currentFpHolder = AllProcessFailures.FirstOrDefault(f => f.IsFpErrorCode);

            if (currentFpHolder == null)
            {
                currentFpHolder = Failures.FirstOrDefault(f => f.IsFpErrorCode);
            }

            if (currentFpHolder != null)
            {
                currentFpHolder.IsFpErrorCode = false;
            }

            failure.IsFpErrorCode = true;
        }
Esempio n. 2
0
        private void Failures_ListChanged(object sender, ListChangedEventArgs e)
        {
            if (e.ListChangedType == ListChangedType.ItemDeleted)
            {
                if (AllProcessFailures.FirstOrDefault(f => f.IsFpErrorCode) == null)
                {
                    ChangeFpErrorCodeOwner(AllProcessFailures.Take(1).ToArray()[0]);
                    return;
                }
            }

            if (e.ListChangedType == ListChangedType.ItemAdded)
            {
                if (AllProcessFailures.Count == 0 && Failures.Count == 1)
                {
                    Failures[0].IsFpErrorCode = true;
                }
            }
        }