/// <summary>
        /// Updates state when view changed visibility.
        /// </summary>
        private void _VisibileStateChanged(object sender, EventArgs e)
        {
            if (this.IsVisible)
            {
                if (null != _schedulePage)
                {
                    _UpdateState();
                    _SubscribeEvents();
                }

                // Update UI locked/unlocked.
                _CheckLocked();
            }
            else
            {
                CancelNewObject();
                SaveEditedItem();

                _UnsubscribeEvents();

                _handler = null;
                _collectionSource.Source = null;
            }
        }
        /// <summary>
        /// Updates state.
        /// </summary>
        private void _UpdateState()
        {
            _handler = null;
            _collectionSource.Source = null;

            if (GridItemsSourceChanging != null)
                GridItemsSourceChanging(this, EventArgs.Empty);

            if (null != _schedulePage.CurrentSchedule)
            {
                _collectionSource.Source =
                    new AppData.SortedDataObjectCollection<Route>(_schedulePage.CurrentSchedule.Routes, new RoutesComparer());
                _handler = new RoutesListViewContextHandler(_schedulePage);

                if (GridItemsSourceChanged != null)
                    GridItemsSourceChanged(this, EventArgs.Empty);
            }

            _ChangeCommandButtonsSet();
        }