/// <summary>
        /// Retrieves the drop target of a drag event.
        /// </summary>
        /// <param name="args">Information about the drag event.</param>
        /// <returns>The drop target of a drag event.</returns>
        protected override ItemsControl GetDropTarget(SW.DragEventArgs args)
        {
            DependencyObject originalSource = (DependencyObject)args.OriginalSource;
            ItemsControl     dropTarget     = GetItemsControlAncestor(originalSource);

            if (dropTarget != null)
            {
                TreeViewItem targetItemContainer = GetItemContainerAncestor(dropTarget, (DependencyObject)args.OriginalSource);
                Orientation? orientation         = GetOrientation(dropTarget);

                if (orientation != null && targetItemContainer != null)
                {
                    Rect   treeViewItemRect = GetTreeViewItemRectExcludingChildren(targetItemContainer);
                    Point  relativePoint    = args.GetPosition(targetItemContainer);
                    double thirdWidth       = treeViewItemRect.Width / 3.0;
                    double thirdHeight      = treeViewItemRect.Height / 3.0;

                    // If dragging into center third of item then the drop target
                    // is the tree view item being hovered over.
                    if
                    ((orientation == Orientation.Horizontal &&
                      relativePoint.X > thirdWidth && relativePoint.X < (treeViewItemRect.Width - thirdWidth)) ||
                     (orientation == Orientation.Vertical &&
                      relativePoint.Y > thirdHeight && relativePoint.Y < (treeViewItemRect.Height - thirdHeight)))
                    {
                        return(targetItemContainer);
                    }
                }
            }

            return(base.GetDropTarget(args));
        }
Esempio n. 2
0
        public static FocusNavigationDirection?FromKey(this Key key, Orientation?orientation = null)
        {
            switch (key)
            {
            case Key.End:
                return(FocusNavigationDirection.Last);

            case Key.Home:
                return(FocusNavigationDirection.First);

            case Key.Left:
                return(orientation == Orientation.Horizontal ? FocusNavigationDirection.Left : FocusNavigationDirection.Previous);

            case Key.Up:
                return(orientation == Orientation.Vertical ? FocusNavigationDirection.Up : FocusNavigationDirection.Previous);

            case Key.Right:
                return(orientation == Orientation.Horizontal ? FocusNavigationDirection.Right : FocusNavigationDirection.Next);

            case Key.Down:
                return(orientation == Orientation.Vertical ? FocusNavigationDirection.Down : FocusNavigationDirection.Next);
            }

            return(null);
        }
Esempio n. 3
0
        /// <summary>
        /// Called when an accelerometer sensor's data is updated.
        /// </summary>
        public void OnDataUpdated(Sensor sensor, SensorDataReport newData)
        {
            if (sensor == _sensor)
            {
                Accelerometer3DReport a3dReport = (Accelerometer3DReport)newData;
                Vector3 vector = Vector3.Zero;
                vector.X = a3dReport.AxisX_G;
                vector.Y = a3dReport.AxisY_G;
                vector.Z = a3dReport.AxisZ_G;

                if (vector != Vector3.Zero)
                {
                    this.Vector = vector;
                    if (VectorChanged != null)
                    {
                        VectorChanged(this, EventArgs.Empty);
                    }

                    CalculateOrientation(vector);
                }
                else
                {
                    // The accelerometer is providing no value so
                    // set Vector to null and reset the orientation
                    this.Vector = null;
                    Orientation?oldOrientation = Orientation;
                    Orientation newOrientation = Orientation.Angle0;
                    Orientation = newOrientation;
                    if (OrientationChanged != null)
                    {
                        OrientationChanged(this, EventArgs.Empty);
                    }
                }
            }
        }
Esempio n. 4
0
        public static object AddPainel(this UserControl userControl, object painel, object parent = null,
                                       Orientation?orientation = null, Dock?dock = null)
        {
            var content = parent ?? userControl.Content;

            if (content == null || content is Grid)
            {
                return(userControl.AddContent(painel as UIElement));
            }

            else if (content is ScrollViewer)
            {
                return(userControl.AddScrollViewer(painel as UIElement, content as ScrollViewer));
            }
            else if (content is StackPanel)
            {
                return(userControl.AddStackPanel(painel as UIElement, content as StackPanel, orientation));
            }
            else if (content is DockPanel)
            {
                return(userControl.AddDockPanel(painel as UIElement, content as DockPanel, dock));
            }

            return(painel);
        }
        Size _dialogSize(BuildContext context)
        {
            Orientation?orientation = MediaQuery.of(context).orientation;

            switch (_entryMode)
            {
            case DatePickerEntryMode.calendar:
                switch (orientation)
                {
                case Orientation.portrait:
                    return(material_._calendarPortraitDialogSize);

                case Orientation.landscape:
                    return(material_._calendarLandscapeDialogSize);
                }

                break;

            case DatePickerEntryMode.input:
                switch (orientation)
                {
                case Orientation.portrait:
                    return(material_._inputPortraitDialogSize);

                case Orientation.landscape:
                    return(material_._inputLandscapeDialogSize);
                }

                break;
            }

            return(null);
        }
Esempio n. 6
0
        /// <summary>
        /// Move and rotate the display text when the screen orientation changes.
        /// The text is positioned 10 pixels from the top left corner based on the
        /// orientation of the screen.
        /// </summary>
        /// <param name="oldOrientation">The previous orientation.</param>
        /// <param name="newOrientation">The new orientation.</param>
        void OnOrientationChanged(object sender, EventArgs e)
        {
            Orientation?orientation = _orientationSourceProvider.Orientation;

            int viewportWidth  = _graphics.GraphicsDevice.Viewport.Width;
            int viewportHeight = _graphics.GraphicsDevice.Viewport.Height;

            switch (orientation)
            {
            case Orientation.Angle0:
                _fontRotationInRadians = 0;
                _fontPosition          = new Vector2(TextMarginX, TextMarginY);
                break;

            case Orientation.Angle90:
                _fontRotationInRadians = Math.PI / 2;
                _fontPosition          = new Vector2(viewportWidth - TextMarginX, TextMarginY);
                break;

            case Orientation.Angle180:
                _fontRotationInRadians = Math.PI;
                _fontPosition          = new Vector2(viewportWidth - TextMarginX, viewportHeight - TextMarginY);
                break;

            case Orientation.Angle270:
                _fontRotationInRadians = -Math.PI / 2;
                _fontPosition          = new Vector2(TextMarginX, viewportHeight - TextMarginY);
                break;
            }
        }
Esempio n. 7
0
 public GetRandomPhotosRequest(uint count,
                               Orientation?orientation = null,
                               string[]?collections    = null,
                               bool?featured           = null,
                               string?username         = null,
                               string?query            = null)
     : base(orientation, collections, featured, username, query) =>
        public static Orientation OrientationTo(this ZonePoint x, ZonePoint y)
        {
            Orientation?orientation = null;

            if (x.X < y.X)
            {
                orientation = Orientation.East;
            }
            if (x.X > y.X)
            {
                orientation = orientation ^ Orientation.West ?? Orientation.West;
            }
            if (x.Y > y.Y)
            {
                orientation = orientation ^ Orientation.North ?? Orientation.North;
            }
            if (x.Y < y.Y)
            {
                orientation = orientation ^ Orientation.South ?? Orientation.South;
            }

            if (orientation.HasValue)
            {
                return(orientation.Value);
            }

            throw new InvalidOperationException();
        }
Esempio n. 9
0
 internal override void OnMeasureIterationStarts()
 {
     base.OnMeasureIterationStarts();
     this._actualLength          = new double?();
     this._actualIsScaleReversed = new bool?();
     this._actualOrientation     = new Orientation?();
 }
Esempio n. 10
0
        static int GetAngleByOrientation(Orientation?orientation)
        {
            var angle = 0;

            switch (orientation)
            {
            case Orientation.NotSpecified:
            case Orientation.Straight:
                break;

            case Orientation.Reverse:
                angle = 180;
                break;

            case Orientation.Left:
                angle = 90;
                break;

            case Orientation.Right:
                angle = 270;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(orientation), orientation, null);
            }

            return(angle);
        }
Esempio n. 11
0
        public Clef(XmlReader r)
        {
            // https://w3c.github.io/mnx/specification/common/#the-clef-element
            M.Assert(r.Name == "clef");

            int count = r.AttributeCount;

            for (int i = 0; i < count; i++)
            {
                r.MoveToAttribute(i);
                switch (r.Name)
                {
                case "line":
                    int.TryParse(r.Value, out Line);
                    M.Assert(Line > 0);
                    break;

                case "sign":
                    Sign = GetMNXClefSign(r.Value);
                    break;

                case "octave":
                    int.TryParse(r.Value, out Octave);
                    break;

                // Instruction attributes
                case "location":
                    Location = new PositionInMeasure(r.Value);
                    break;

                case "staff-index":
                    int staffIndex;
                    int.TryParse(r.Value, out staffIndex);
                    StaffIndex = staffIndex;
                    break;

                case "orient":
                    switch (r.Value)
                    {
                    case "up":
                        Orient = Orientation.up;
                        break;

                    case "down":
                        Orient = Orientation.down;
                        break;
                    }
                    break;

                default:
                    M.ThrowError("Unknown clef attribute.");
                    break;
                }
            }

            M.Assert(Sign != null && Line > 0);

            // r.Name is now the name of the last clef attribute that has been read.
        }
 /// <summary>
 ///     Get a random photo
 /// </summary>
 /// <remarks>
 ///     Retrieve a single random photo, given optional filters.
 ///     You can’t use the collections and query parameters in the same request
 ///     When supplying a count parameter - and only then - the response will be an
 ///     array of photos, even if the value of count is 1.
 /// </remarks>
 /// <param name='operations'>
 ///     The operations group for this extension method.
 /// </param>
 /// <param name='collections'>
 ///     Public collection ID(‘s) to filter selection. If multiple, comma-separated
 /// </param>
 /// <param name='featured'>
 ///     Limit selection to featured photos.
 /// </param>
 /// <param name='username'>
 ///     Limit selection to a single user.
 /// </param>
 /// <param name='query'>
 ///     Limit selection to photos matching a search term.
 /// </param>
 /// <param name='orientation'>
 ///     Filter by photo orientation. (Valid values: landscape, portrait, squarish)
 ///     . Possible values include: 'landscape', 'portrait', 'squarish'
 /// </param>
 /// <param name='contentFilter'>
 ///     Limit results by content safety. Default: low. Valid values are low and
 ///     high.
 ///     . Possible values include: 'low', 'high'
 /// </param>
 /// <param name='count'>
 ///     The number of photos to return. (Default: 1; max: 30)
 /// </param>
 public static Photo GetSingleRandomPhoto(this IUnsplashClient operations, string collections = default,
                                          bool?featured           = default, string username = default, string query = default,
                                          Orientation?orientation = default, ContentFilter?contentFilter = default)
 {
     return(operations
            .GetSingleRandomPhotoAsync(collections, featured, username, query, orientation, contentFilter)
            .GetAwaiter().GetResult());
 }
 /// <summary>
 ///     Get random photos
 /// </summary>
 /// <remarks>
 ///     Retrieve a single random photo, given optional filters.
 ///     You can’t use the collections and query parameters in the same request
 ///     When supplying a count parameter - and only then - the response will be an
 ///     array of photos, even if the value of count is 1.
 /// </remarks>
 /// <param name='operations'>
 ///     The operations group for this extension method.
 /// </param>
 /// <param name='collections'>
 ///     Public collection ID(‘s) to filter selection. If multiple, comma-separated
 /// </param>
 /// <param name='featured'>
 ///     Limit selection to featured photos.
 /// </param>
 /// <param name='username'>
 ///     Limit selection to a single user.
 /// </param>
 /// <param name='query'>
 ///     Limit selection to photos matching a search term.
 /// </param>
 /// <param name='orientation'>
 ///     Filter by photo orientation. (Valid values: landscape, portrait, squarish)
 ///     . Possible values include: 'landscape', 'portrait', 'squarish'
 /// </param>
 /// <param name='contentFilter'>
 ///     Limit results by content safety. Default: low. Valid values are low and
 ///     high.
 ///     . Possible values include: 'low', 'high'
 /// </param>
 /// <param name='count'>
 ///     The number of photos to return. (Default: 1; max: 30)
 /// </param>
 public static IList <Photo> GetRandomPhotos(this IUnsplashClient operations, string collections = default,
                                             bool?featured           = default, string username = default, string query = default,
                                             Orientation?orientation = default, ContentFilter?contentFilter = default, int?count = default)
 {
     return(operations
            .GetRandomPhotosAsync(collections, featured, username, query, orientation, contentFilter, count)
            .GetAwaiter().GetResult());
 }
Esempio n. 14
0
 public SearchPhotosRequest(string query,
                            uint?page               = null,
                            uint?perPage            = null,
                            Sort?sort               = null,
                            string[]?collections    = null,
                            ColorFilter?color       = null,
                            Orientation?orientation = null) =>
 (Query, Page, PerPage, Sort, Collections, Color, Orientation) =
Esempio n. 15
0
 public void Place(Position position, Orientation orientation)
 {
     if (_table.IsValidPosition(position) && Enum.IsDefined(typeof(Orientation), orientation))
     {
         _position    = position;
         _orientation = orientation;
         IsPlaced     = true;
     }
 }
Esempio n. 16
0
        private void OnDragStarted(object sender, DragStartedGestureEventArgs e)
        {
            if (!IsEnabled)
            {
                return;
            }

            _direction = e.Direction;
        }
Esempio n. 17
0
        public override Widget build(BuildContext context)
        {
            List <Widget> children = new List <Widget> {
                new Flexible(child: new ClipRRect(
                                 borderRadius: BorderRadius.circular(12.0f),
                                 child: new BackdropFilter(
                                     filter: ImageFilter.blur(
                                         sigmaX: CupertinoActionSheetUtils._kBlurAmount,
                                         sigmaY: CupertinoActionSheetUtils._kBlurAmount),
                                     child: new _CupertinoAlertRenderWidget(
                                         contentSection: new Builder(builder: _buildContent),
                                         actionsSection: _buildActions()
                                         )
                                     )
                                 )
                             ),
            };

            if (cancelButton != null)
            {
                children.Add(_buildCancelButton()
                             );
            }

            Orientation?orientation = MediaQuery.of(context).orientation;

            float actionSheetWidth;

            if (orientation == Orientation.portrait)
            {
                actionSheetWidth = MediaQuery.of(context).size.width -
                                   (CupertinoActionSheetUtils._kEdgeHorizontalPadding * 2);
            }
            else
            {
                actionSheetWidth = MediaQuery.of(context).size.height -
                                   (CupertinoActionSheetUtils._kEdgeHorizontalPadding * 2);
            }

            return(new SafeArea(
                       child:  new CupertinoUserInterfaceLevel(
                           data: CupertinoUserInterfaceLevelData.elevatedlayer,
                           child: new Container(
                               width: actionSheetWidth,
                               margin: EdgeInsets.symmetric(
                                   horizontal: CupertinoActionSheetUtils._kEdgeHorizontalPadding,
                                   vertical: CupertinoActionSheetUtils._kEdgeVerticalPadding
                                   ),
                               child: new Column(
                                   children: children,
                                   mainAxisSize: MainAxisSize.min,
                                   crossAxisAlignment: CrossAxisAlignment.stretch
                                   ))
                           )

                       ));
        }
Esempio n. 18
0
        private void navalBattlePanelPlayer1_OnSelectedCell(object sender, CellSelectedEventArgs e)
        {
            int         x          = e.Coordinates.X;
            int         y          = e.Coordinates.Y;
            Orientation?orientacao = null;

            try
            {
                orientacao = GetOrientation();
            }
            catch (ApplicationException ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }


            List <Point> coordinates = new List <Point>();

            for (int i = 0; i < _shipId; i++)
            {
                Point nextPosition;
                if (orientacao.Value == Orientation.Horizontal)
                {
                    nextPosition = new Point(x, y++);
                }
                else
                {
                    nextPosition = new Point(x++, y);
                }

                coordinates.Add(nextPosition);
            }

            try
            {
                Proxy.PutShip(_playerName, _shipId, coordinates.ToArray());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }



            this.navalBattlePanelPlayer1.PutShip(_shipId, e.Coordinates, orientacao.Value, _shipId);

            if (_shipId < 7)
            {
                _shipId++;
            }
            else
            {
                FinishPutShips();
            }
        }
Esempio n. 19
0
        public static SplitOrientation ToSplitOrientation(this Orientation?orientation)
        {
            if (!orientation.HasValue)
            {
                return(SplitOrientation.Auto);
            }

            return(orientation == Orientation.Horizontal ? SplitOrientation.Horizontal : SplitOrientation.Vertical);
        }
Esempio n. 20
0
        private static UIElement GetClosest(ItemsControl itemsControl, List <DependencyObject> items,
                                            Point position, Orientation searchDirection)
        {
            //Console.WriteLine("GetClosest - {0}", itemsControl.ToString());

            UIElement closest         = null;
            var       closestDistance = double.MaxValue;
            var       info            = FindItemsControlInformation(itemsControl);

            Orientation?effectiveSearchDirection = searchDirection;

            if (null != info && null != info.GetOrientation)
            {
                effectiveSearchDirection = info.GetOrientation(itemsControl);
            }

            foreach (var i in items)
            {
                var uiElement = i as UIElement;

                if (uiElement != null)
                {
                    var p        = uiElement.TransformToAncestor(itemsControl).Transform(new Point(0, 0));
                    var distance = double.MaxValue;

                    if (null == effectiveSearchDirection)
                    {
                        var xDiff = position.X - p.X;
                        var yDiff = position.Y - p.Y;
                        var hyp   = Math.Sqrt(Math.Pow(xDiff, 2d) + Math.Pow(yDiff, 2d));
                        distance = Math.Abs(hyp);
                    }
                    else
                    {
                        switch (effectiveSearchDirection.Value)
                        {
                        case Orientation.Horizontal:
                            distance = Math.Abs(position.X - p.X);
                            break;

                        case Orientation.Vertical:
                            distance = Math.Abs(position.Y - p.Y);
                            break;
                        }
                    }

                    if (distance < closestDistance)
                    {
                        closest         = uiElement;
                        closestDistance = distance;
                    }
                }
            }

            return(closest);
        }
Esempio n. 21
0
 public void Rotate(SpinDirection rotationDirection)
 {
     if (IsPlaced)//I.e.if the robot has been placed on a table
     {
         //Futures: If any more orientations are added e.g. North-East,
         //"Enum.GetValues(typeof(Orientation)).Length" will give the number of options.
         int numOrientations = 4;
         _orientation = (Orientation)(((int)_orientation.Value + (int)rotationDirection + numOrientations) % numOrientations);
     }
 }
Esempio n. 22
0
 /// <summary>
 /// Initializes a new IOComponent with the specified parameters.
 /// </summary>
 /// <param name="location">The position of the component within the document.</param>
 /// <param name="size">The size of the component.</param>
 /// <param name="isFlipped">Whether the component is flipped.</param>
 /// <param name="orientation">The orientation of the component.</param>
 /// <param name="type">The type of component.</param>
 /// <param name="properties">Additional properties for the component.</param>
 /// <param name="connections">Connections for the component.</param>
 public IOComponent(string id, Point?location, double?size, bool?isFlipped, Orientation?orientation, IOComponentType type, IEnumerable <IOComponentProperty> properties, IDictionary <string, string> connections)
 {
     ID          = id;
     Location    = location;
     Size        = size;
     IsFlipped   = isFlipped;
     Orientation = orientation;
     Type        = type;
     Properties  = new List <IOComponentProperty>(properties);
     Connections = new Dictionary <string, string>(connections);
 }
 /// <summary>
 ///     Get random photos
 /// </summary>
 /// <remarks>
 ///     Retrieve a single random photo, given optional filters.
 ///     You can’t use the collections and query parameters in the same request
 ///     When supplying a count parameter - and only then - the response will be an
 ///     array of photos, even if the value of count is 1.
 /// </remarks>
 /// <param name='operations'>
 ///     The operations group for this extension method.
 /// </param>
 /// <param name='collections'>
 ///     Public collection ID(‘s) to filter selection. If multiple, comma-separated
 /// </param>
 /// <param name='featured'>
 ///     Limit selection to featured photos.
 /// </param>
 /// <param name='username'>
 ///     Limit selection to a single user.
 /// </param>
 /// <param name='query'>
 ///     Limit selection to photos matching a search term.
 /// </param>
 /// <param name='orientation'>
 ///     Filter by photo orientation. (Valid values: landscape, portrait, squarish)
 ///     . Possible values include: 'landscape', 'portrait', 'squarish'
 /// </param>
 /// <param name='contentFilter'>
 ///     Limit results by content safety. Default: low. Valid values are low and
 ///     high.
 ///     . Possible values include: 'low', 'high'
 /// </param>
 /// <param name='count'>
 ///     The number of photos to return. (Default: 1; max: 30)
 /// </param>
 /// <param name='cancellationToken'>
 ///     The cancellation token.
 /// </param>
 public static async Task <IList <Photo> > GetRandomPhotosAsync(this IUnsplashClient operations,
                                                                string collections                  = default, bool?featured = default, string username = default, string query = default,
                                                                Orientation?orientation             = default, ContentFilter?contentFilter = default, int?count = default,
                                                                CancellationToken cancellationToken = default)
 {
     using (var _result = await operations.GetRandomPhotosWithHttpMessagesAsync(collections, featured, username,
                                                                                query, orientation, contentFilter, count, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        private void Window_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            if (AssociatedObject.Parent != null)
            {
                var newOrientation = Window.Width >= Window.Height ? Orientation.Horizontal : Orientation.Vertical;

                if (!CurrentOrientation.HasValue || CurrentOrientation.Value != newOrientation)
                {
                    CurrentOrientation = newOrientation;
                    ApplyPanelOrientation();
                }
            }
        }
Esempio n. 25
0
        public void UpdateSprites()
        {
            if (LastCamera == null || LastCamera != CameraController.Controller.Orientation.CurrentOrientation || LastLocal != LocalOrientation)
            {
                LastCamera = CameraController.Controller.Orientation.CurrentOrientation;
                LastLocal  = LocalOrientation;

                foreach (var sprite in Sprites)
                {
                    sprite.UpdateOrientation(LocalOrientation, LastCamera.Value);
                }
            }
        }
Esempio n. 26
0
        private void ChangeLayout(Rect bounds)
        {
            var orientation = bounds.Height >= bounds.Width ? Orientation.Vertical : Orientation.Horizontal;

            if (_orientation == orientation)
            {
                return;
            }

            _orientation = orientation;

            ViewModel?.ChangeLayout(orientation);
        }
Esempio n. 27
0
 public _ContextMenuSheet(
     Key key = null,
     List <Widget> actions = null,
     _ContextMenuLocation?contextMenuLocation = null,
     Orientation?orientation = null
     ) : base(key: key)
 {
     D.assert(actions != null && actions.isNotEmpty());
     D.assert(contextMenuLocation != null);
     D.assert(orientation != null);
     _contextMenuLocation = contextMenuLocation.Value;
     _orientation         = orientation.Value;
     this.actions         = actions;
 }
Esempio n. 28
0
        Orientation?_getOrientation(BuildContext context)
        {
            Orientation?result = MediaQuery.of(context, nullOk: true)?.orientation;

            if (result == null)
            {
                // If there's no MediaQuery, then use the window aspect to determine
                // orientation.
                Size size = Window.instance.physicalSize;
                result = size.width > size.height ? Orientation.landscape : Orientation.portrait;
            }

            return(result);
        }
Esempio n. 29
0
        /*
         * Set next position, health, score, etc. Makes it ready to be updated next
         * time Unity calls Update() above.
         */
        public void SetNextState(PlayerDTO playerDTO)
        {
            nextState = playerDTO;

            // Keep track of current position and note the next one.
            currPosition = gameObject.transform.localPosition;
            nextPosition = new Vector3(nextState.location.x, 0, nextState.location.y);

            jumpNeeded = IsJumpNeeded();
            // Update the health, score & orientation.
            health          = nextState.health;
            score           = nextState.score;
            nextOrientation = CalculateOrientation();
        }
Esempio n. 30
0
        internal bool ProcessKey(Key key)
        {
            int index = -1;

            switch (key)
            {
            case Key.Left:
            case Key.Right:
                if (this.CurrentSelection != null)
                {
                    Orientation?orientation = this.GetPanelOrientation();
                    if (orientation.HasValue && orientation.Value == Orientation.Vertical)
                    {
                        this.CurrentSelection.OpenSubmenuWithKeyboard();
                    }
                    else
                    {
                        int direction = key == Key.Left ? -1 : 1;
                        index = this.ItemContainerGenerator.IndexFromContainer(this.CurrentSelection);
                        this.MenuNavigate(index + direction, direction, this.CurrentSelection.IsSubmenuOpen);
                    }

                    return(true);
                }
                break;

            case Key.Up:
            case Key.Down:
                if (this.CurrentSelection != null)
                {
                    Orientation?orientation = this.GetPanelOrientation();
                    if (orientation.HasValue && orientation == Orientation.Vertical)
                    {
                        int direction = key == Key.Up ? -1 : 1;
                        index = this.ItemContainerGenerator.IndexFromContainer(this.CurrentSelection);
                        this.MenuNavigate(index + direction, direction, this.CurrentSelection.IsSubmenuOpen);
                    }
                    else
                    {
                        this.CurrentSelection.OpenSubmenuWithKeyboard();
                    }

                    return(true);
                }
                break;
            }

            return(false);
        }
Esempio n. 31
0
        private void OnStackPanelItemsPanelLoaded(object sender, RoutedEventArgs e)
        {
            if (StackPanelLayout == null)
            {
                StackPanelLayout = (StackPanel)sender;
            }

            if (_onLoadOrientationChange.HasValue)
            {
                StackPanelLayout.Orientation = _onLoadOrientationChange.Value;
                _onLoadOrientationChange = null;
            }
        }
Esempio n. 32
0
 internal override void OnMeasureIterationStarts()
 {
     base.OnMeasureIterationStarts();
     this._actualLength = new double?();
     this._actualIsScaleReversed = new bool?();
     this._actualOrientation = new Orientation?();
 }
Esempio n. 33
0
 protected override void OnAxisPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.OnAxisPropertyChanged(sender, e);
     switch (e.PropertyName)
     {
         case "IsReversed":
         case "Orientation":
             this._actualOrientation = new Orientation?();
             this._actualIsScaleReversed = new bool?();
             if (this.Axis.Scale == null)
                 break;
             this.Axis.Scale.InvalidateView();
             this.Axis.Scale.Invalidate();
             break;
     }
 }
Esempio n. 34
0
 protected override void OnChartAreaPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.OnChartAreaPropertyChanged(sender, e);
     switch (e.PropertyName)
     {
         case "Orientation":
             this._actualOrientation = new Orientation?();
             this.ResetAxisLabels();
             if (this.Axis.Scale == null)
                 break;
             this.Axis.Scale.InvalidateView();
             this.Axis.Scale.Invalidate();
             break;
     }
 }
Esempio n. 35
0
 public Line(Point start, Point end)
 {
     Start = start;
     End = end;
     Length = GetLength(start, end);
     this.MinX = Math.Min(start.X, end.X);
     this.MaxX = Math.Max(start.X, end.X);
     this.MinY = Math.Min(start.Y, end.Y);
     this.MaxY = Math.Max(start.Y, end.Y);
     if (start.X == end.X && start.Y == end.Y)
     {
         this.Kind = new Orientation?();
     }
     else
     {
         this.Kind = start.X == end.X
             ? Orientation.Vertical
             : Orientation.Horizontal;
     }
 }