Ejemplo n.º 1
0
        public string FeedFish(string aquariumName)
        {
            IAquarium aquarium = this.aquariums.FirstOrDefault(x => x.Name == aquariumName);

            aquarium.Feed();
            return(String.Format(OutputMessages.FishFed, aquarium.Fish.Count));
        }
        public string InsertDecoration(string aquariumName, string decorationType)
        {
            IDecoration decoration = this.decorations.FindByType(decorationType);

            if (decoration == null)
            {
                throw new InvalidOperationException
                          (string.Format(Utilities.Messages.ExceptionMessages
                                         .InexistentDecoration, decorationType));
            }

            IAquarium aquarium = this.aquariums.FirstOrDefault(a => a.Name == aquariumName);

            if (aquarium == null)
            {
                throw new InvalidOperationException
                          (Utilities.Messages.ExceptionMessages.InvalidAquariumType);
            }

            aquarium.AddDecoration(decoration);
            this.decorations.Remove(decoration);

            return(string.Format(Utilities.Messages
                                 .OutputMessages.EntityAddedToAquarium, decorationType, aquariumName));
        }
Ejemplo n.º 3
0
 public Piranha(PointF location, SizeF size, IAquarium aquarium)
     : base(location, size, aquarium)
 {
     Speed = Settings.Piranha.Speed;
     PushState(Walking, FishState.Walking);
     Type = FishType.Piranha;
 }
Ejemplo n.º 4
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IFish fish = null;

            if (fishType != "FreshwaterFish" && fishType != "SaltwaterFish")
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }
            else if (fishType == "FreshwaterFish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            else
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }

            IAquarium aquarium = aquariums.FirstOrDefault(x => x.Name == aquariumName);
            Fish      fish1    = fish as Fish;

            if (fish1.FIshLivingPlace != aquarium.GetType().Name)
            {
                return("Water not suitable.");
            }
            else
            {
                aquarium.AddFish(fish);
                return(string.Format(OutputMessages.EntityAddedToAquarium, fishType, aquariumName));
            }
        }
Ejemplo n.º 5
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)//todo
        {
            IAquarium aquarium = this.aquariums.FirstOrDefault(a => a.Name == aquariumName);
            IFish     fish     = null;

            if (fishType == "FreshwaterFish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            else if (fishType == "SaltwaterFish")
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }
            else
            {
                throw new InvalidOperationException("Invalid fish type.");
            }

            if ((fish.GetType().Name.Contains("Freshwater") && aquarium.GetType().Name.Contains("Freshwater")) ||
                (fish.GetType().Name.Contains("Saltwater") && aquarium.GetType().Name.Contains("Saltwater")))
            {
                aquarium.AddFish(fish);

                return($"Successfully added {fishType} to {aquariumName}.");
            }
            else
            {
                return("Water not suitable.");
            }
        }
Ejemplo n.º 6
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            //Posible exception

            IAquarium aquarium = this.aquariums.First(a => a.Name == aquariumName);

            IFish fish = null;

            switch (fishType)
            {
            case "FreshwaterFish":
                fish = new FreshwaterFish(fishName, fishSpecies, price);
                aquarium.AddFish(fish);

                return(aquarium.GetType().Name == "FreshwaterAquarium"
                        ? string.Format(OutputMessages.FishAdded, fishType, aquariumName)
                        : OutputMessages.UnsuitableWater);

            case "SaltwaterFish":
                fish = new SaltwaterFish(fishName, fishSpecies, price);
                aquarium.AddFish(fish);

                return(aquarium.GetType().Name == "SaltwaterAquarium"
                        ? string.Format(OutputMessages.FishAdded, fishType, aquariumName)
                        : OutputMessages.UnsuitableWater);

            default:
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }
        }
Ejemplo n.º 7
0
        public string CalculateValue(string aquariumName)
        {
            IAquarium aquarium = aquariums.FirstOrDefault(x => x.Name == aquariumName);
            decimal   sum      = aquarium.Fish.Sum(x => x.Price) + aquarium.Decorations.Sum(x => x.Price);

            return(string.Format(OutputMessages.AquariumValue, aquariumName, sum));
        }
        public string AddFish(string aquariumName,
                              string fishType, string fishName,
                              string fishSpecies, decimal price)
        {
            IFish fish = null;

            if (fishType == "FreshwaterFish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            else if (fishType == "SaltwaterFish")
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }
            else
            {
                throw new InvalidOperationException
                          (ExceptionMessages.InvalidFishType);
            }

            IAquarium aquarium = GetAquariumByName(aquariumName);

            if (((fish is FreshwaterFish) && (aquarium is FreshwaterAquarium)) ||
                ((fish is SaltwaterFish) && (aquarium is SaltwaterAquarium)))
            {
                aquarium.AddFish(fish);
                return(string.Format(OutputMessages
                                     .EntityAddedToAquarium, fishType, aquariumName));
            }

            return(OutputMessages.UnsuitableWater);
        }
Ejemplo n.º 9
0
 public BlueNeon(PointF location, SizeF size, IAquarium aquarium)
     : base(location, size, aquarium)
 {
     Type  = FishType.BlueNeon;
     Speed = Settings.BlueNeon.Speed;
     PushState(Walking, FishState.Walking);
 }
Ejemplo n.º 10
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IAquarium aquarium = aquariums[aquariumName];

            IFish fish = null;

            if (fishType == "SaltwaterFish")
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }
            else if (fishType == "FreshwaterFish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }

            if (fish == null)
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }

            if ((fishType == "SaltwaterFish" && aquarium.GetType().Name == "SaltwaterAquarium") ||
                (fishType == "FreshwaterFish" && aquarium.GetType().Name == "FreshwaterAquarium"))
            {
                aquarium.AddFish(fish);
                return(string.Format(OutputMessages.EntityAddedToAquarium, fishType, aquariumName));
            }
            else
            {
                return(OutputMessages.UnsuitableWater);
            }
        }
Ejemplo n.º 11
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IFish     fish     = null;
            IAquarium aquarium = aquariums.FirstOrDefault(x => x.Name == aquariumName);

            if (fishType != nameof(FreshwaterFish) && fishType != nameof(SaltwaterFish))
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }
            else
            {
                string currentAquariumType = aquarium.GetType().Name;

                if (fishType == "FreshwaterFish" && currentAquariumType == "FreshwaterAquarium")
                {
                    fish = new FreshwaterFish(fishName, fishSpecies, price);
                }
                else if (fishType == "SaltwaterFish" && currentAquariumType == "SaltwaterAquarium")
                {
                    fish = new SaltwaterFish(fishName, fishSpecies, price);
                }
                else
                {
                    return(OutputMessages.UnsuitableWater);
                }
                aquarium.AddFish(fish);
                return(string.Format(OutputMessages.EntityAddedToAquarium, fishType, aquariumName));
            }
        }
Ejemplo n.º 12
0
        public string FeedFish(string aquariumName)
        {
            IAquarium aquarium = aquariums.FirstOrDefault(a => a.Name == aquariumName);

            aquarium.Feed();
            return($"Fish fed: {aquarium.Fish.Count}");
        }
Ejemplo n.º 13
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IAquarium aqurium = aquariums.First(a => a.Name == aquariumName);

            if (fishType == "FreshwaterFish")
            {
                if (aqurium.GetType().Name != "FreshwaterAquarium")
                {
                    throw new InvalidOperationException(OutputMessages.UnsuitableWater);
                }
                aqurium.AddFish(new FreshwaterFish(fishName, fishSpecies, price));
            }
            else if (fishType == "SaltwaterFish")
            {
                if (aqurium.GetType().Name != "SaltwaterAquarium")
                {
                    throw new InvalidOperationException(OutputMessages.UnsuitableWater);
                }
                aqurium.AddFish(new SaltwaterFish(fishName, fishSpecies, price));
            }
            else
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }

            return(String.Format(OutputMessages.EntityAddedToAquarium, fishType, aquariumName));
        }
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IFish fish;

            if (fishType == typeof(FreshwaterFish).Name)
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            else if (fishType == typeof(SaltwaterFish).Name)
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }
            else
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }

            IAquarium aquarium = this.aquariums.FirstOrDefault(a => a.Name == aquariumName);

            string aquariumType        = aquarium.GetType().Name[0].ToString();
            string fishTypeFirstLetter = fishType[0].ToString();

            if (aquariumType != fishTypeFirstLetter)
            {
                return(OutputMessages.UnsuitableWater);
            }
            else
            {
                aquarium.AddFish(fish);
                return(string.Format(OutputMessages.EntityAddedToAquarium, fishType, aquariumName));
            }
        }
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IFish fish;

            if (fishType == "FreshwaterFish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            else if (fishType == "SaltwaterFish")
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }
            else
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }

            IAquarium currentAquarium = this.aquariums.FirstOrDefault(a => a.Name == aquariumName);

            string aquariumType = currentAquarium.GetType().Name;

            bool isTheRightAquariumForTheRightFish =
                fishType == "FreshwaterFish" && aquariumType == "FreshwaterAquarium" ||
                fishType == "SaltwaterFish" && aquariumType == "SaltwaterAquarium";

            if (isTheRightAquariumForTheRightFish)
            {
                currentAquarium.AddFish(fish);
                return(string.Format(OutputMessages.EntityAddedToAquarium, fish.GetType().Name, currentAquarium.Name));
            }
            else
            {
                return(OutputMessages.UnsuitableWater);
            }
        }
Ejemplo n.º 16
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            if (fishType != "FreshwaterFish" && fishType != "SaltwaterFish")
            {
                throw new InvalidOperationException("Invalid fish type.");
            }

            IAquarium aquarium = aquariums.FirstOrDefault(a => a.Name == aquariumName);

            string aquariumToFish = string.Empty;

            IFish fish = null;

            if (fishType == "FreshwaterFish")
            {
                fish           = new FreshwaterFish(fishName, fishSpecies, price);
                aquariumToFish = "Freshwater";
            }
            else if (fishType == "SaltwaterFish")
            {
                fish           = new SaltwaterFish(fishName, fishSpecies, price);
                aquariumToFish = "Saltwater";
            }

            if (!aquarium.GetType().Name.Contains(aquariumToFish))
            {
                return("Water not suitable.");
            }

            aquarium.AddFish(fish);

            return($"Successfully added {fish.GetType().Name} to {aquarium.Name}.");
        }
Ejemplo n.º 17
0
        public string AddAquarium(string aquariumType, string aquariumName)
        {
            if (aquariumType != "FreshwaterAquarium" && aquariumType != "SaltwaterAquarium")
            {
                throw new InvalidOperationException("Invalid aquarium type.");
            }

            IAquarium aquarium = null;

            switch (aquariumType)
            {
            case "FreshwaterAquarium":
                aquarium = new FreshwaterAquarium(aquariumName);
                break;

            case "SaltwaterAquarium":
                aquarium = new SaltwaterAquarium(aquariumName);
                break;
            }

            if (aquarium.Comfort > aquarium.Capacity)
            {
                return("Not enough capacity");
            }

            this.aquariums.Add(aquarium);
            return($"Successfully added {aquariumType}.");
        }
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IAquarium aquarium = aquariums.FirstOrDefault(p => p.Name == aquariumName);

            IFish fish = null;

            if (fishType == nameof(FreshwaterFish))
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);

                if (aquarium.GetType().Name == nameof(FreshwaterAquarium))
                {
                    aquarium.AddFish(fish);
                    return(string.Format(OutputMessages.EntityAddedToAquarium, fishType, aquariumName));
                }
            }
            else if (fishType == nameof(SaltwaterFish))
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);

                if (aquarium.GetType().Name == nameof(SaltwaterAquarium))
                {
                    aquarium.AddFish(fish);
                    return(string.Format(OutputMessages.EntityAddedToAquarium, fishType, aquariumName));
                }
            }
            else
            {
                throw new InvalidOperationException(string.Format(ExceptionMessages.InvalidFishType));
            }
            return(string.Format(OutputMessages.UnsuitableWater));
        }
Ejemplo n.º 19
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IFish fish = null;

            if (fishType == nameof(FreshwaterFish))
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            else if (fishType == nameof(SaltwaterFish))
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }
            else
            {
                throw new InvalidOperationException("Invalid fish type.");
            }

            IAquarium aquarium = aquariums.FirstOrDefault(a => a.Name == aquariumName);

            if (fish.GetType().Name.StartsWith("Fresh") && aquarium.GetType().Name.StartsWith("Fresh") ||
                fish.GetType().Name.StartsWith("Salt") && aquarium.GetType().Name.StartsWith("Salt"))
            {
                aquarium.AddFish(fish);
                return($"Successfully added {fishType} to {aquariumName}.");
            }
            else
            {
                return($"Water not suitable.");
            }
        }
Ejemplo n.º 20
0
        public object Create(params object[] value)
        {
            IAquarium aquarium = null;

            string aquariumType = value[0].ToString();
            string aquariumName = value[1].ToString();


            if (aquariumType == "FreshwaterAquarium" || aquariumType == "SaltwaterAquarium")
            {
                if (aquariumType == "FreshwaterAquarium")
                {
                    aquarium = new FreshwaterAquarium(aquariumName);
                }

                if (aquariumType == "SaltwaterAquarium")
                {
                    aquarium = new SaltwaterAquarium(aquariumName);
                }

                return(aquarium);
            }

            throw new InvalidOperationException(ExceptionMessages.InvalidAquariumType);
        }
Ejemplo n.º 21
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IAquarium aquarium = shopAquariums.FirstOrDefault(el => el.Name == aquariumName);
            IFish     fish     = null;

            if (fishType != "FreshwaterFish" && fishType != "SaltwaterFish")
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }
            if ((fishType == "FreshwaterFish" && aquarium.GetType().Name != "FreshwaterAquarium") || (fishType == "SaltwaterFish" && aquarium.GetType().Name != "SaltwaterAquarium"))
            {
                return(OutputMessages.UnsuitableWater);
            }
            if (fishType == "FreshwaterFish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
                shopAquariums.FirstOrDefault(el => el.Name == aquariumName).AddFish(fish);
            }
            else
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
                shopAquariums.FirstOrDefault(el => el.Name == aquariumName).AddFish(fish);
            }
            //return string.Format(OutputMessages.SuccessfullyAdded, fishType, aquariumName);
            return($"Successfully added {fishType} to {aquariumName}.");
        }
Ejemplo n.º 22
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            if (fishType != nameof(SaltwaterFish) && fishType != nameof(FreshwaterFish))
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }

            IAquarium aquarium = this.aquaria.First(x => x.Name == aquariumName);

            if (aquarium.GetType().Name == nameof(SaltwaterAquarium) && fishType == nameof(FreshwaterFish) || aquarium.GetType().Name == nameof(FreshwaterAquarium) && fishType == nameof(SaltwaterFish))
            {
                return(string.Format(OutputMessages.UnsuitableWater));
            }

            if (fishType == nameof(FreshwaterFish))
            {
                aquarium.AddFish(new FreshwaterFish(fishName, fishSpecies, price));
            }
            else
            {
                aquarium.AddFish(new SaltwaterFish(fishName, fishSpecies, price));
            }

            return(string.Format(OutputMessages.EntityAddedToAquarium, fishType, aquariumName));
        }
Ejemplo n.º 23
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IFish fish;

            if (fishType == "SaltwaterFish")
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }
            else if (fishType == "FreshwaterFish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            else
            {
                throw new InvalidOperationException(string.Format(ExceptionMessages.InvalidFishType));
            }

            IAquarium aquarium = this.aquariums.FirstOrDefault(x => x.Name == aquariumName);

            if (aquarium.GetType().Name == "FreshwaterAquarium" && fish.GetType().Name == "SaltwaterFish" ||
                aquarium.GetType().Name == "SaltwaterAquarium" && fish.GetType().Name == "FreshwaterFish")
            {
                return(string.Format(OutputMessages.UnsuitableWater));
            }
            else
            {
                aquarium.AddFish(fish);
            }

            return(string.Format(OutputMessages.FishAdded, fishType, aquariumName));
        }
Ejemplo n.º 24
0
        public string FeedFish(string aquariumName)
        {
            IAquarium aquarium = aquariums.First(a => a.Name == aquariumName);

            aquarium.Feed();
            return(String.Format(OutputMessages.FishFed, aquarium.Fish.Count));
        }
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            if (fishType != "FreshwaterFish" && fishType != "SaltwaterFish")
            {
                throw new InvalidOperationException("Invalid fish type.");
            }
            IFish fish = null;

            if (fishType == "FreshwaterFish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            else if (fishType == "SaltwaterFish")
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }
            IAquarium aquarium = this.aquariums.Where(x => x.Name == aquariumName).FirstOrDefault();

            if (aquarium.GetType().Name.Contains("Fresh") && fish.GetType().Name.Contains("Fresh"))
            {
                aquarium.AddFish(fish);
            }
            else if (aquarium.GetType().Name.Contains("Salt") && fish.GetType().Name.Contains("Salt"))
            {
                aquarium.AddFish(fish);
            }
            else
            {
                return($"Water not suitable.");
            }

            return($"Successfully added {fish.GetType().Name} to {aquariumName}.");
        }
Ejemplo n.º 26
0
        public string FeedFish(string aquariumName)
        {
            IAquarium wantedAquarium = aquariums.FirstOrDefault(a => a.Name == aquariumName);

            wantedAquarium.Feed();
            return(String.Format(OutputMessages.FishFed, wantedAquarium.Fish.Count));
        }
Ejemplo n.º 27
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IFish fish = null;

            if (fishType.ToLower() == "freshwaterfish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            else if (fishType.ToLower() == "saltwaterfish")
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }
            if (fish == null)
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }
            if (!aquariums.ContainsKey(aquariumName))
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidAquariumName);
            }
            IAquarium aquarium = this.aquariums[aquariumName];

            if (fishType.ToLower() == "saltwaterfish" && aquarium.GetType().Name.ToLower() == "freshwateraquarium")
            {
                return(OutputMessages.UnsuitableWater);
            }
            else if (fishType.ToLower() == "freshwaterfish" && aquarium.GetType().Name.ToLower() == "saltwateraquarium")
            {
                return(OutputMessages.UnsuitableWater);
            }
            this.aquariums[aquariumName].AddFish(fish);

            return(String.Format(OutputMessages.EntityAddedToAquarium, fish.GetType().Name, aquarium.Name));
        }
Ejemplo n.º 28
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IFish fish;

            switch (fishType)
            {
            case "FreshwaterFish":
                fish = new FreshwaterFish(fishName, fishSpecies, price);
                break;

            case "SaltwaterFish":
                fish = new SaltwaterFish(fishName, fishSpecies, price);
                break;

            default:
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }
            IAquarium aquarium = aquariums.First(a => a.Name == aquariumName);

            if (!fishType.StartsWith(aquarium.GetType().Name[0]))
            {
                return(OutputMessages.UnsuitableWater);
            }
            aquariums.First(a => a.Name == aquariumName).AddFish(fish);
            return(string.Format(OutputMessages.EntityAddedToAquarium, fishType, aquariumName));
        }
Ejemplo n.º 29
0
        public string AddFish(string aquariumName, string fishType, string fishName, string fishSpecies, decimal price)
        {
            IFish fish = null;

            if (fishType == "FreshwaterFish")
            {
                fish = new FreshwaterFish(fishName, fishSpecies, price);
            }
            if (fishType == "SaltwaterFish")
            {
                fish = new SaltwaterFish(fishName, fishSpecies, price);
            }

            if (fish == null)
            {
                throw new InvalidOperationException(ExceptionMessages.InvalidFishType);
            }

            IAquarium seachedAqua = aquariums.FirstOrDefault(a => a.Name == aquariumName);

            if (seachedAqua.GetType().Name == "SaltwaterAquarium" && fishType == "FreshwaterFish")
            {
                return($"Water not suitable.");
            }
            if (seachedAqua.GetType().Name == "FreshwaterAquarium" && fishType == "SaltwaterFish")
            {
                return($"Water not suitable.");
            }

            seachedAqua.AddFish(fish);
            return($"Successfully added {fishType} to {aquariumName}.");
        }
Ejemplo n.º 30
0
        public string FeedFish(string aquariumName)
        {
            IAquarium seachedAqua = aquariums.FirstOrDefault(a => a.Name == aquariumName);

            seachedAqua.Feed();

            return($"Fish fed: {seachedAqua.Fish.Count}");
        }
Ejemplo n.º 31
0
        public MainForm(IAquarium aquariumModel)
        {
            InitializeComponent();

            _aquariumModel = aquariumModel;
            _aquariumModel.UnhandledError += HandleException;

            aquariumControl.Init(_aquariumModel);
        }
Ejemplo n.º 32
0
        public void Init(IAquarium aquarium)
        {
            if (aquarium == null)
                throw new ArgumentNullException("aquarium");

            _aquarium = aquarium;
            _aquarium.ModelUpdated += HandleModelUpdated;

            RefreshSize();
        }