public Plants GetModel()
        {
            if (_model == null)
            {
                _model = new Plants();

                _model.Add(new Plant
                {
                    Name        = "율마",
                    MarkerColor = MarkerColor.Green,
                    WaterPeriod = new TimeSpan(10, 0, 0),
                    WaterTime   = new TimeSpan(0, 0, 2),
                    LastWatered = DateTime.MinValue
                });
                _model.Add(new Plant
                {
                    Name        = "아이비",
                    MarkerColor = MarkerColor.Red,
                    WaterPeriod = new TimeSpan(10, 0, 0),
                    WaterTime   = new TimeSpan(0, 0, 7),
                    LastWatered = DateTime.MinValue
                });
                _model.Add(new Plant
                {
                    Name        = "스파티필름",
                    MarkerColor = MarkerColor.Blue,
                    WaterPeriod = new TimeSpan(10, 0, 0),
                    WaterTime   = new TimeSpan(0, 0, 5),
                    LastWatered = DateTime.MinValue
                });
            }

            return(_model);
        }
        public void AddPlant()
        {
repeate:
            Console.WriteLine("--->> ADD PLANTS <<---");
            Console.WriteLine("Enter Plant Name: ");
            plant.PlantName = Console.ReadLine();
            Console.WriteLine("Enter Plant Address: ");
            plant.PlantAddress = Console.ReadLine();
            if (plant.PlantName != null && plant.PlantAddress != null)
            {
                try
                {
                    Plants.Add(plant);
                    SaveChanges();
                    Console.WriteLine("Manufecturing plants are added");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            else
            {
                Console.WriteLine(" !!Enter all required fields!! ");
                goto repeate;
            }
        }
Exemple #3
0
        public AdministrationViewModel()
        {
            Task.Run(() => {
                if (File.Exists(@"vrste.txt"))
                {
                    List <string> plants = new List <string>(File.ReadLines(@"vrste.txt").ToList());
                    int id = 0;
                    foreach (var plant in plants)
                    {
                        Plants.Add(new PlantModel(plant, id++));
                    }
                    NotifyOfPropertyChange(() => Plants);
                }
                _dataSet = new DataSet();
                if (File.Exists(@"podaci.xml"))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(@"podaci.xml");

                    _dataSet.Load((XmlElement)doc.DocumentElement.ChildNodes[0]);

                    NumberOfInputNodes = _dataSet.Data[0].InputSize;
                    NotifyOfPropertyChange(() => NumberOfInputNodes);
                }
            });
        }
Exemple #4
0
        public async void GetMethod()
        {
            Plants.Clear();

            //var plants = await DataStore.GetItemsAsync(true);
            var clientget = new HttpClient();
            var uri2      = "http://192.168.87.171:3000/measurements";

            try
            {
                var response2 = await clientget.GetAsync(uri2);

                if (response2.IsSuccessStatusCode)
                {
                    string content = await response2.Content.ReadAsStringAsync();

                    Console.WriteLine(content);
                    List <Plant> plantie = JsonConvert.DeserializeObject <List <Plant> >(content);

                    foreach (var item in plantie)
                    {
                        Plant planget = new Plant {
                            PlantID = item.plantID, Temperature = item.temperature, AirHumidity = item.airHumidity, TempWarning = item.tempWarning, DrySoil = item.drySoil, DateTime = item.dateTime, ImageSource = item.imageSource, ColorBackground = item.colorBackground
                        };


                        Plants.Add(planget);
                    }
                }
            }
            catch (Exception)
            {
                Debug.WriteLine("Error");
            }
        }
Exemple #5
0
        public static void ReadPlants()
        {
            string queryString = "select p_id, s_title, t_title, st_title, count,cult_id, house_id from plants natural join stages natural join cultures natural join sorts natural join types order by p_id";

            using (NpgsqlConnection connection = new NpgsqlConnection(ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString))
            {
                NpgsqlCommand command = new NpgsqlCommand(queryString, connection);
                connection.Open();
                NpgsqlDataReader reader = command.ExecuteReader();
                try
                {
                    while (reader.Read())
                    {
                        Plant new_plant = new Plant
                        {
                            Plant_id       = (int)reader[0],
                            Sort           = reader[1].ToString(),
                            Type           = reader[2].ToString(),
                            Stage          = reader[3].ToString(),
                            Count          = (int)reader[4],
                            Cult_id        = (int)reader[5],
                            House_id       = (int)reader[6],
                            Cards_of_plant = new List <Card>()
                        };
                        Plants.Add(new_plant);
                        new_plant = null;
                    }
                }
                finally { reader.Close(); }
            }
        }
        public void CreatePlant()
        {
            string name = PromptForValidName <PowerPlant>(Plants, "What is the name of this power plant: ");

            PowerPlant plant = new PowerPlant(name, BuildingType.POWERPLANT);

            Plants.Add(plant);
        }
Exemple #7
0
 public void Initialize()
 {
     Plants.Add(
         new PlantViewModel(
             "Purple Rose",
             1,
             DateTime.Now.AddDays(-2),
             "https://ae01.alicdn.com/kf/HTB13kt_RVXXXXcSXXXXq6xXFXXXr/5d-diy-diamond-painting-flowers-purple-rose-diamond-painting-bloemen-diamond-embroidery-mosaic-flowers-painting-rhinestones.jpg_640x640.jpg"));
     Plants.Add(
         new PlantViewModel(
             "Ilex verticillata",
             14,
             DateTime.Now.AddDays(-7),
             "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQhKRG7kiMY9gihS8gSTfuASylMhyDJjr9h9I8mwEIwGIaDIHbUkw"));
     Plants.Add(
         new PlantViewModel(
             "Sanguinaria",
             7,
             DateTime.Now.AddDays(-2),
             "https://www.studyread.com/wp-content/uploads/2016/04/sanguinaria-300x252.jpg?ezimgfmt=ng:webp/ngcb1"));
     Plants.Add(new PlantViewModel("Lotus", 30, DateTime.Now.AddDays(-10), "https://images-na.ssl-images-amazon.com/images/I/51mUIhGuV1L._SX425_.jpg"));
     Plants.Add(
         new PlantViewModel(
             "Cactus",
             365,
             DateTime.Now.AddDays(-254),
             "https://cdn.shopify.com/s/files/1/2203/9263/products/Notocactus_magnificus_Balloon_Cactus_1.jpg?v=1532468983"));
     Plants.Add(
         new PlantViewModel(
             "Apple",
             30,
             DateTime.Now.AddDays(-15),
             "https://upload.wikimedia.org/wikipedia/commons/thumb/2/22/Malus_domestica_a1.jpg/220px-Malus_domestica_a1.jpg"));
     Plants.Add(
         new PlantViewModel(
             "Apocynum cannabinum",
             7,
             DateTime.Now.AddDays(-2),
             "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/Apocynum_cannabinum_6801.JPG/220px-Apocynum_cannabinum_6801.JPG"));
     Plants.Add(
         new PlantViewModel(
             "Almond",
             30,
             DateTime.Now.AddDays(-15),
             "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/Ametllesjuliol.jpg/220px-Ametllesjuliol.jpg"));
     Plants.Add(
         new PlantViewModel(
             "Fraxinus pennsylvanica",
             30,
             DateTime.Now.AddDays(-15),
             "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Fraxinus_pensylvanica_a1.jpg/220px-Fraxinus_pensylvanica_a1.jpg"));
     Plants.Add(
         new PlantViewModel(
             "Acer negundo",
             7,
             DateTime.Now.AddDays(-2),
             "https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/Acnegundo.jpg/220px-Acnegundo.jpg"));
 }
Exemple #8
0
        public PlantItem(bool fertileDirt = false) : base(0x1602)
        {
            Weight = 1.0;

            m_PlantStatus = PlantStatus.BowlOfDirt;
            PlantSystem   = new PlantSystem(this, fertileDirt);
            Level         = SecureLevel.Owner;

            Plants.Add(this);
        }
 public void AddPlant(string newSpecies, string newLocation, int newSunlight, int newWater)
 {
     // Plant a new plant
     //    This command will let the user type in the information for a plant and add it to the list
     Plants.Add(new Plant {
         Species = newSpecies, LocatedPlanted = newLocation, LightNeeded = newSunlight, WaterNeeded = newWater
     });
     SaveChanges();
     Console.WriteLine($"Your {newSpecies} were planted in the {newLocation} garden.");
 }
Exemple #10
0
 public void AddNewPlant()
 {
     Plants.Add(new PlantModel(NewPlant, Plants.Count));
     SelectedPlant = Plants[Plants.Count - 1];
     NewPlant      = "";
     NotifyOfPropertyChange(() => Plants);
     NotifyOfPropertyChange(() => NewPlant);
     NotifyOfPropertyChange(() => SelectedPlant);
     NotifyOfPropertyChange(() => CanAddNewPlant);
     NotifyOfPropertyChange(() => CanGetTokens);
 }
Exemple #11
0
        public TegridyDbContext(DbContextOptions <TegridyDbContext> options) : base(options)
        {
            if (!Users.Any())
            {
                lock (x)
                {
//                    PlantsAudit.Add(MockedData.scheduledAction);
                    PlantsInfo.Add(MockedData.plantInfo);
                    Plants.Add(MockedData.plant);
                    Users.Add(MockedData.user);
                    this.SaveChanges();
                }
            }
        }
        public static void Initliaze()
        {
            var appConfigFlower = ConfigurationManager.AppSettings["flowers"] ?? null;

            if (!isInitialized && !String.IsNullOrEmpty(appConfigFlower))
            {
                var flowerCount = int.Parse(appConfigFlower);
                for (var i = 0; i < flowerCount; i++)
                {
                    var plant = new Plant();
                    Plants.Add(plant.Id, plant);
                }
            }

            isInitialized = true;
        }
        private async void pickPhoto()
        {
            /*
             * try
             * {
             *  var result = await FilePicker.PickAsync();
             *  if (result != null)
             *  {
             *      Text = $"File Name: {result.FileName}";
             *      if (result.FileName.EndsWith("jpg", StringComparison.OrdinalIgnoreCase) ||
             *          result.FileName.EndsWith("png", StringComparison.OrdinalIgnoreCase))
             *      {
             *          var stream = await result.OpenReadAsync();
             *          Image = ImageSource.FromStream(() => stream);
             *      }
             *  }
             * }
             * catch (Exception ex)
             * {
             *  // The user canceled or something went wrong
             * }
             */



            Plant testPlant = new Plant();

            Console.WriteLine("This is the pick photo");


            var result = await MediaPicker.PickPhotoAsync(new MediaPickerOptions

            {
                Title = "Please pick a photo"
            });

            var stream = await result.OpenReadAsync();

            testPlant.ImageSource = ImageSource.FromStream(() => stream);

            ThePlants = testPlant;
            Plants.Add(ThePlants);

            Console.WriteLine(thePlants.ToString() + "This is the console");
        }
Exemple #14
0
        async Task AddNewPlant(object sender, Plant plant)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            if (plant != null)
            {
                await App.PlantService.AddPlantAsync(plant);

                Plants.Add(plant);
            }

            IsBusy = false;
        }
Exemple #15
0
        async Task RefreshPlants()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            Plants.Clear();
            List <Plant> plants = await App.PlantService.GetAllPlantsAsync();

            foreach (var plant in plants)
            {
                await LoadPlantPhoto(plant);

                Plants.Add(plant);
            }
            IsBusy = false;
        }
    protected void SpawnPlant(string name)
    {
        PlantDefinition pDef = PlantManifest.GetPlantDefinition(name);

        if (pDef == null)
        {
            return; // If the PlantDefinition is null, we just return here. We will have already logged an error in PlantManifest's function which will have our stack trace.
        }
        Plant p = Instantiate(pDef.Actor, inputPosition,
                              Quaternion.identity, transform);

        Plants.Add(p);

        p.Definition = pDef;
        p.Picked     = true;

        pickedActor = p;
        pickedActor.transform.position   = inputPosition;
        pickedActor.transform.localScale = new Vector3(1f, 1f, 1f);
    }
Exemple #17
0
 public LeafRecognizerViewModel()
 {
     Task.Run(() =>
     {
         if (File.Exists(@"tezine.xml"))
         {
             bpn = new BackPropagationNetwork(@"tezine.xml");
             NumberOfInputNodes = bpn.InputSize;
         }
         if (File.Exists(@"vrste.txt"))
         {
             List <string> plants = new List <string>(File.ReadLines(@"vrste.txt").ToList());
             int id = 0;
             foreach (var plant in plants)
             {
                 Plants.Add(new PlantModel(plant, id++));
             }
             NotifyOfPropertyChange(() => Plants);
         }
         NotifyOfPropertyChange(() => CanRecognizeLeaf);
     });
 }
Exemple #18
0
        async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                Plants.Clear();
                var plants = await DataStore.GetItemsAsync(true);

                foreach (var plant in plants)
                {
                    Plants.Add(plant);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #19
0
        async Task UpdatePlant(object sender, Plant plant)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            if (plant != null)
            {
                await App.PlantService.UpdatePlantAsync(plant.Id, plant);

                var oldPlant = Plants.SingleOrDefault(x => x.Id == plant.Id);
                if (oldPlant != null)
                {
                    Plants.Remove(oldPlant);
                    Plants.Add(plant);
                }
            }

            IsBusy = false;
        }
Exemple #20
0
 public void AddPlant(Plant item)
 {
     Plants.Add(item);
 }
Exemple #21
0
 public void Create(Vector2 _pos, Genes genes, float energyGiven)
 {
     //stuff to do when creating a new plant
     Plants.Add(new Plant(_pos, genes, energyGiven));
 }