Ejemplo n.º 1
0
        /// <summary>
        /// Update the loc state
        /// </summary>
        private void OnUpdateTimerTick(object sender, EventArgs e)
        {
            var routeDurationExceededDetected = false;

            foreach (LocItem item in lvLocs.Items)
            {
                bool tmp;
                item.UpdateFromState(out tmp);
                routeDurationExceededDetected |= tmp;
            }
            if (routeDurationExceededDetected)
            {
                RouteDurationExceeded.Fire(this);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Actual state of a loc has changed.
        /// </summary>
        private void OnLocActualStateChanged(object sender, EventArgs e)
        {
            var locState = (ILocState)sender;
            var item     = lvLocs.Items.Cast <LocItem>().FirstOrDefault(x => x.LocState == locState);
            var routeDurationExceededDetected = false;

            if (item != null)
            {
                lvLocs.BeginUpdate();
                var sortNeeded = item.IsSortNeeded();
                item.UpdateFromState(out routeDurationExceededDetected);
                if (sortNeeded)
                {
                    lvLocs.Sort();
                    //lvLocs.Refresh();
                }
                lvLocs.EndUpdate();
            }
            LocActualStateChanged.Fire(this);
            if (routeDurationExceededDetected)
            {
                RouteDurationExceeded.Fire(this);
            }
        }