Beispiel #1
0
 private void InvokeSpecies(List <Species> species, Animal_Selection animalSelection)
 {
     try
     {
         if (animalSelection.InvokeRequired)
         {
             animalSelection.Invoke(new Action <List <Species>, Animal_Selection>(InvokeSpecies), species, animalSelection);
         }
         animalSelection.ReceiveSpecies(species);
     }
     catch (NullReferenceException)
     {
     }
 }
Beispiel #2
0
        public void ClientActions(MessageObject message)
        {
            switch (message.FormIdentifier)
            {
            //Loading Screen
            case 0:
            {
                LoadingScreen loadingscreen = (LoadingScreen)Form.ActiveForm;
                switch (message.ObjectIdentifier)
                {
                //Farmer
                case 1:
                {
                    switch (message.ActionIdentifier)
                    {
                    //Select
                    case 1:
                    {
                        Farmer[] AllFarmers = (Farmer[])message.Data.BinaryDeserialization();
                        InvokeFarmerforLoading(AllFarmers, loadingscreen);
                        break;
                    }

                    default:
                        break;
                    }
                    break;
                }

                default:
                    break;
                }
                break;
            }

            //Farmer Selection
            case 1:
            {
                Farmer_Selection farmerSelection = (Farmer_Selection)Form.ActiveForm;
                switch (message.ObjectIdentifier)
                {
                //Farmer
                case 1:
                {
                    switch (message.ActionIdentifier)
                    {
                    //Select
                    case 1:
                    {
                        Farmer[] AllFarmers = (Farmer[])message.Data.BinaryDeserialization();
                        InvokeFarmer(AllFarmers, farmerSelection);
                        break;
                    }

                    default:
                        break;
                    }
                    break;
                }

                default:
                    break;
                }
                break;
            }

            //Animal Selection
            case 4:
            {
                Animal_Selection animalSelection = (Animal_Selection)Form.ActiveForm;

                switch (message.ObjectIdentifier)
                {
                //Species
                case 4:
                {
                    switch (message.ActionIdentifier)
                    {
                    //Select
                    case 1:
                    {
                        List <Species> species = (List <Species>)message.Data.BinaryDeserialization();
                        InvokeSpecies(species, animalSelection);
                        break;
                    }

                    default:
                        break;
                    }
                    break;
                }

                default:
                    break;
                }
                break;
            }

            //Farm View
            case 6:
            {
                Farm_View farmView = (Farm_View)Form.ActiveForm;
                switch (message.ObjectIdentifier)
                {
                //Farm
                case 2:
                {
                    switch (message.ActionIdentifier)
                    {
                    //Select
                    case 1:
                    {
                        ArrayList farmViewData = (ArrayList)message.Data.BinaryDeserialization();
                        InvokeFarmView(farmViewData, farmView);
                        break;
                    }

                    default:
                        break;
                    }
                    break;
                }

                //Animal
                case 3:
                {
                    switch (message.ActionIdentifier)
                    {
                    //Select
                    case 1:
                    {
                        break;
                    }

                    default:
                        break;
                    }
                    break;
                }

                //Location
                case 5:
                {
                    switch (message.ActionIdentifier)
                    {
                    //Select
                    case 1:
                    {
                        break;
                    }

                    default:
                        break;
                    }
                    break;
                }

                default:
                    break;
                }
                break;
            }

            default:
                break;
            }
        }