Пример #1
0
        private Vector2f GetStartPosition(ScreenLocation location, Vector2f size)
        {
            var   windowSize = getWindowSize();
            float x          = 0;
            float y          = 0;

            switch (location)
            {
            case ScreenLocation.TopLeft:
                x = -size.X;
                y = toastBuffer.Y;
                break;

            case ScreenLocation.BottomLeft:
                x = -size.X;
                y = windowSize.Y - toastBuffer.Y;
                break;

            case ScreenLocation.TopRight:
                x = windowSize.X;
                y = toastBuffer.Y;
                break;

            case ScreenLocation.BottomRight:
                x = windowSize.X;
                y = windowSize.Y - toastBuffer.Y;
                break;
            }

            return(new Vector2f(x, y));
        }
Пример #2
0
        /// <summary>
        /// Set all atributes
        /// </summary>
        /// <param name="playerName"></param>
        /// <param name="size"></param>
        /// <param name="location"></param>
        /// <param name="fontSize"></param>
        public PlayerInfo(string playerName, Point size, ScreenLocation location, int fontSize)
        {
            this.screenLocation = location;
            this.size           = size;
            this.playerName     = playerName;
            this.Width          = size.X;
            this.Height         = size.Y;
            this.cards          = 0;

            block = new TextBlock();

            block.Width  = size.X - 20;
            block.Height = size.Y - 20;
            block.Margin = new Thickness(10);



            this.Children.Add(block);

            UpdateBox();

            block.FontSize = fontSize;

            inactive = new ImageBrush()
            {
                ImageSource = new BitmapImage((new Uri("assets/images/background_panel.png", UriKind.RelativeOrAbsolute)))
            };
            active = new ImageBrush()
            {
                ImageSource = new BitmapImage((new Uri("assets/images/background_panel_active.png", UriKind.RelativeOrAbsolute)))
            };
            this.Background = inactive;
            UpdateScreenLocation();
        }
Пример #3
0
        private Vector2f GetEndPosition(ScreenLocation location, Vector2f size)
        {
            var   windowSize = getWindowSize();
            var   buffer     = new Vector2f(20, 20);
            float x          = 0;
            float y          = 0;

            switch (location)
            {
            case ScreenLocation.TopLeft:
                x = buffer.X;
                y = buffer.Y;
                break;

            case ScreenLocation.BottomLeft:
                x = buffer.X;
                y = windowSize.Y - size.Y - buffer.Y;
                break;

            case ScreenLocation.TopRight:
                x = windowSize.X - size.X - buffer.X;
                y = buffer.Y;
                break;

            case ScreenLocation.BottomRight:
                x = windowSize.X - size.X - buffer.X;
                y = windowSize.Y - size.Y - buffer.Y;
                break;
            }

            return(new Vector2f(x, y));
        }
Пример #4
0
        /// <summary>
        /// Sets a radiobutton in GB_Location to checked based on which Location is given and
        /// enables the GroupBox.
        /// </summary>
        /// <param name="l">The ScreenLocation to set.</param>
        private void SetGB_Location(ScreenLocation l)
        {
            //Set Location
            switch (l)
            {
            case ScreenLocation.TopLeft:        RB_TopLeft.Checked = true; break;

            case ScreenLocation.TopCentre:      RB_TopCenter.Checked = true; break;

            case ScreenLocation.TopRight:       RB_TopRight.Checked = true; break;

            case ScreenLocation.MiddleLeft:     RB_MiddleLeft.Checked = true; break;

            case ScreenLocation.MiddleCentre:   RB_MiddleCenter.Checked = true; break;

            case ScreenLocation.MiddleRight:    RB_MiddleRight.Checked = true; break;

            case ScreenLocation.BottomLeft:     RB_BottomLeft.Checked = true; break;

            case ScreenLocation.BottomCentre:   RB_BottomCenter.Checked = true; break;

            case ScreenLocation.BottomRight:    RB_BottomRight.Checked = true; break;

            default: throw new InvalidEnumArgumentException("l", l.GetHashCode(), typeof(ScreenLocation));
            }

            //Enable Location Radio Button
            GB_Location.Enabled = true;
        }
Пример #5
0
 public void WriteScreenLocation(ScreenLocation screenLocation)
 {
     WriteSByte((sbyte)screenLocation.X);
     WriteSByte((sbyte)screenLocation.Y);
     WriteSByte((sbyte)screenLocation.PixelOffsetX);
     WriteSByte((sbyte)screenLocation.PixelOffsetY);
 }
Пример #6
0
        public Toast(ToastType type, ScreenLocation location, string message, float duration = 5)
        {
            this.Message = message;
            this.Type = type;
            this.Location = location;
            this.Duration = duration;

            timeAlive = 0;
            visual = new ToastVisual(this);            
        }
Пример #7
0
        public void SetTaskbarLocation(string deviceName, Native.ABEdge location)
        {
            int index = ScreenLocation.FindIndex(kvp => kvp.DeviceName.Equals(deviceName));

            if (index < 0)
            {
                ScreenLocation.Add(new TaskbarLocation(deviceName, location));
            }
            else
            {
                ScreenLocation[index] = new TaskbarLocation(deviceName, location);
            }
        }
Пример #8
0
        public Native.ABEdge GetTaskbarLocation(string deviceName)
        {
            Native.ABEdge location;
            int           index = ScreenLocation.FindIndex(kvp => kvp.DeviceName.Equals(deviceName));

            if (index < 0)
            {
                location = Native.ABEdge.Bottom;
                ScreenLocation.Add(new TaskbarLocation(deviceName, location));
            }
            else
            {
                location = ScreenLocation[index].Location;
            }
            return(location);
        }
Пример #9
0
        public MainForm()
        {
            //set view position on center of ulong
            _currentView = new ScreenLocation(new PointULong(ulong.MaxValue / 2, ulong.MaxValue / 2));

            _graph = new GraphPaint();
            _graph.MouseDown += Graph_MouseDown;
            _graph.MouseMove += Graph_MouseMove;
            _graph.MouseUp += Graph_MouseUp;
            _graph.MouseWheel += Graph_MouseWheel;

            base.Controls.Add(_graph);

            InitializeComponent();

            Initialize();
        }
Пример #10
0
        private void UpdateScreenLocation(DreamObject movable, DreamValue screenLocationValue)
        {
            if (!_entityManager.TryGetComponent <DMISpriteComponent>(_atomManager.GetAtomEntity(movable), out var sprite))
            {
                return;
            }

            ScreenLocation screenLocation;

            if (screenLocationValue.TryGetValueAsString(out string screenLocationString))
            {
                screenLocation = new ScreenLocation(screenLocationString);
            }
            else
            {
                screenLocation = new ScreenLocation(0, 0, 0, 0);
            }

            sprite.ScreenLocation = screenLocation;
        }
Пример #11
0
 /// <summary>
 /// Changes the Location of the selected Caption.
 /// </summary>
 /// <param name="l">The location to set the caption to.</param>
 public void ChangeLocation(ScreenLocation l)
 {
     SelectedCaption.Location = l;
 }
Пример #12
0
 public MoveScreenMessage(ScreenLocation location)
 {
     Location = location;
 }
Пример #13
0
 public OnScreenLocationItem(string name, ScreenLocation location)
 {
     Name     = name;
     Location = location;
 }
Пример #14
0
 private void UpdateMainWindowHandle(UIElement content)
 {
     this.MainWindowHwndSource = ScreenLocation.FindTopLevelHwndSource(content);
 }