コード例 #1
0
        /// <summary>
        /// Sets the location to a new location. This triggers the
        /// LocationChanged event.
        /// </summary>
        /// <param name="location">The new location to set to.</param>
        /// <param name="source">Who made the change.</param>
        public void SetLocation(T location, object source, LocationChangeType type)
        {
            LocationChangedEventArgs <T> e = new LocationChangedEventArgs <T>();

            e.OldLocation = this.location;
            e.NewLocation = location;
            e.Source      = source;
            e.Type        = type;

            this.location = location;
            if (LocationChanged != null)
            {
                LocationChanged(this, e);
            }
        }
コード例 #2
0
        private void navigator_LocationChanged(object sender, LocationChangedEventArgs <Pointer> e)
        {
            if (e.Source != this)
            {
                if (e.Type == LocationChangeType.Major || navHistory.IsEmpty)
                {
                    navHistory.Add(e.NewLocation);
                }
                else
                {
                    navHistory.Current = e.NewLocation;
                }
            }

            btnNavigateBackward.Enabled     = navHistory.CanMove(-1);
            mnuViewNavigateBackward.Enabled = navHistory.CanMove(-1);

            btnNavigateForward.Enabled     = navHistory.CanMove(1);
            mnuViewNavigateForward.Enabled = navHistory.CanMove(1);
        }