Esempio n. 1
0
        public ManeuverCard GetManeuverCard(double size)
        {
            double       height       = size * maneuvers.Count;
            double       width        = size * maneuvers.First().Value.Count;
            ManeuverCard maneuverCard = new ManeuverCard();

            maneuverCard.Source            = CombineImages();
            maneuverCard.Height            = height;
            maneuverCard.Width             = width;
            maneuverCard.UseLayoutRounding = true;
            RenderOptions.SetBitmapScalingMode(maneuverCard, BitmapScalingMode.HighQuality);

            return(maneuverCard);
        }
Esempio n. 2
0
        private void MouseHoverLeave(object sender, MouseEventArgs e)
        {
            if (isHidingIdentifiers)
            {
                return;
            }
            addButton.Visibility    = Visibility.Hidden;
            removeButton.Visibility = Visibility.Hidden;
            infoButton.Visibility   = Visibility.Hidden;
            deleteButton.Visibility = Visibility.Hidden;

            if (isUpgrade == false)
            {
                Children.Remove(maneuverCard);
                maneuverCard = null;
            }
        }
Esempio n. 3
0
        private void MouseHover(object sender, MouseEventArgs e)
        {
            if (isHidingIdentifiers)
            {
                return;
            }
            if (haveButtonsBeenInitialized == false)
            {
                if (isUpgrade)
                {
                    addButton    = new ImageButton("add", 0.9);
                    removeButton = new ImageButton("remove", 0.9);
                    deleteButton = new ImageButton("close", 0.9);
                    infoButton   = new ImageButton("info", 0.9);
                }
                else
                {
                    addButton    = new ImageButton("add", 1);
                    removeButton = new ImageButton("remove", 1);
                    deleteButton = new ImageButton("close", 1);
                    infoButton   = new ImageButton("info", 1);
                }

                addButton.MouseDown  += new MouseButtonEventHandler(AddButtonClicked);
                addButton.MouseEnter += new MouseEventHandler(MouseHover);
                addButton.MouseLeave += new MouseEventHandler(MouseHoverLeave);
                if (currentPage != null)
                {
                    addButton.MouseWheel += new MouseWheelEventHandler(currentPage.ContentScroll);
                }
                addButton.Visibility = Visibility.Hidden;
                SetLeft(addButton, addButtonLeft);
                SetTop(addButton, addButtonTop);
                Children.Add(addButton);

                removeButton.MouseDown  += new MouseButtonEventHandler(RemoveButtonClicked);
                removeButton.MouseEnter += new MouseEventHandler(MouseHover);
                removeButton.MouseLeave += new MouseEventHandler(MouseHoverLeave);
                if (currentPage != null)
                {
                    removeButton.MouseWheel += new MouseWheelEventHandler(currentPage.ContentScroll);
                }
                removeButton.Visibility = Visibility.Hidden;
                SetLeft(removeButton, removeButtonLeft);
                SetTop(removeButton, removeButtonTop);
                Children.Add(removeButton);

                infoButton.MouseDown  += new MouseButtonEventHandler(InfoButtonClicked);
                infoButton.MouseEnter += new MouseEventHandler(MouseHover);
                infoButton.MouseLeave += new MouseEventHandler(MouseHoverLeave);
                if (currentPage != null)
                {
                    infoButton.MouseWheel += new MouseWheelEventHandler(currentPage.ContentScroll);
                }
                infoButton.Visibility = Visibility.Hidden;
                SetLeft(infoButton, infoButtonLeft);
                SetTop(infoButton, infoButtonTop);
                Children.Add(infoButton);

                if (hasDeleteButton)
                {
                    deleteButton.MouseDown  += new MouseButtonEventHandler(DeleteButtonClicked);
                    deleteButton.MouseEnter += new MouseEventHandler(MouseHover);
                    deleteButton.MouseLeave += new MouseEventHandler(MouseHoverLeave);
                    deleteButton.MouseWheel += new MouseWheelEventHandler(currentPage.ContentScroll);
                    deleteButton.Visibility  = Visibility.Hidden;
                    SetRight(deleteButton, 0);
                    SetTop(deleteButton, 0);
                    Children.Add(deleteButton);
                }

                haveButtonsBeenInitialized = true;
            }

            addButton.Visibility    = Visibility.Visible;
            removeButton.Visibility = Visibility.Visible;
            if (isHidingInfoButton == false)
            {
                infoButton.Visibility = Visibility.Visible;
            }
            deleteButton.Visibility = Visibility.Visible;

            if (isUpgrade == false)
            {
                maneuverCard             = pilot.ship.GetManeuverCard(Math.Round(cardImage.Width / 11));
                maneuverCard.MouseEnter += new MouseEventHandler(MouseHover);
                maneuverCard.MouseLeave += new MouseEventHandler(MouseHoverLeave);
                if (currentPage != null)
                {
                    maneuverCard.MouseWheel += new MouseWheelEventHandler(currentPage.ContentScroll);
                }
                Canvas.SetLeft(maneuverCard, (cardImage.Width / 2) - (maneuverCard.Width / 2));
                Canvas.SetTop(maneuverCard, 0);
                Children.Add(maneuverCard);
            }
        }