Esempio n. 1
0
        public void NewClientIdTest()
        {
            AquariumControl target = new AquariumControl(); // TODO: Initialize to an appropriate value

            target.AddClientWindow(new FishServer.ClientWindow(0, target, new System.Drawing.Rectangle()));
            target.AddClientWindow(new FishServer.ClientWindow(2, target, new System.Drawing.Rectangle()));
            target.AddClientWindow(new FishServer.ClientWindow(1, target, new System.Drawing.Rectangle()));

            int expected = 1; // TODO: Initialize to an appropriate value
            int actual;

            actual = target.NewClientId();
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Esempio n. 2
0
        //------------------------- Constructors -----------------------//

        public ClientWindow(int id, AquariumControl aquarium, Rectangle sight)
        {
            _id = id;
            _aquariumControl = aquarium;

            _currentSight = sight;
            if (_currentSight.Width < _minimumWidth)
            {
                _currentSight.Width = _minimumWidth;
            }
            if (_currentSight.Height < _minimumHeight)
            {
                _currentSight.Height = _minimumHeight;
            }

            if (_currentSight.Width > _aquariumControl.Width - _currentSight.X)
            {
                _currentSight.Width = _aquariumControl.Width - _currentSight.X;
            }
            if (_currentSight.Height > _aquariumControl.Height - _currentSight.Y)
            {
                _currentSight.Height = _aquariumControl.Height - _currentSight.Y;
            }

            _backgroundColor = Color.FromArgb(_backgroundAlpha, Color.LightYellow);
            _borderColor     = Color.Red;
            _idColor         = Color.GreenYellow;

            _image = createBackgroundImage(_currentSight.Width, _currentSight.Height, false);

            this.GotFocus        += new EventHandler(ClientWindow_GotFocus);
            this.LostFocus       += new EventHandler(ClientWindow_LostFocus);
            this.MouseClick      += new MouseEventHandler(ClientWindow_MouseClick);
            this.MouseDown       += new MouseEventHandler(ClientWindow_MouseDown);
            this.MouseMove       += new MouseEventHandler(ClientWindow_MouseMove);
            this.LocationChanged += new ClientWindowLocationEventHandler(ClientWindow_LocationChanged);
            this.SizeChanged     += new ClientWindowSizeEventHandler(ClientWindow_SizeChanged);
        }
Esempio n. 3
0
        //------------------------- Constructor --------------------------------//

        public FishServices(AquariumControl aquariumControl, int clientId)
        {
            _aquariumControl = aquariumControl;
            _clientId        = clientId;
        }