Example #1
0
        private void GenerateMonkeys(int amountOfMonkeys)
        {
            Random r = new Random();

            if (Id % 2 == 0)
            {
                NameList.Reverse();
            }
            for (int i = 1; i < amountOfMonkeys + 1; i++)
            {
                int    rand = r.Next(Trees.Count - 1);
                Monkey m    = new Monkey(MonkeyCounter++, NameList[i]);
                if (this.Trees[rand].Monkey != null)
                {
                    i--;
                }
                else
                {
                    m.VisitedTrees.Add(m.Hops, Trees[rand]);
                    Trees[rand].Monkey = m;
                    Monkeys.Add(m);
                    Console.WriteLine($"[{Id}]: Placing new monkey {m.Naam} with ID {m.Id} in Tree: {Trees[rand].Id}");
                    Global.Log.WriteMonkeyToImage(this, Trees[rand]);
                }
            }
        }
Example #2
0
        public async Task GetMonkeysAsync()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;
                Monkeys.Clear();

                IDataStore service = DependencyService.Get <IDataStore>();
                var        list    = await service.GetMonkeysAsync();

                foreach (var item in list)
                {
                    Monkeys.Add(item);
                }
            }
            catch (Exception ex)
            {
                MessagingCenter.Send(ex, "error");
            }
            finally
            {
                IsBusy = false;
            }
        }
        async Task GetMonkeysAsync()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;

                var json = await Client.GetStringAsync("https://montemagno.com/monkeys.json");

                var monkeys = Monkey.FromJson(json);

                //var result = await Data.ListAsync<Monkey>(DefaultPartitions.AppDocuments);
                //var monkeys = result.CurrentPage.Items.Select(m => m.DeserializedValue);

                Monkeys.Clear();
                foreach (var monkey in monkeys)
                {
                    Monkeys.Add(monkey);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Unable to get monkeys: {ex.Message}");
                await Application.Current.MainPage.DisplayAlert("Error!", ex.Message, "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
        async Task GetMonkeysAsync()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;

                var monkeys = await DataService.GetMonkeysAsync();

                Monkeys.Clear();
                foreach (var monkey in monkeys)
                {
                    Monkeys.Add(monkey);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Unable to get monkeys: {ex.Message}");
                await Application.Current.MainPage.DisplayAlert("Error!", ex.Message, "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #5
0
        private async Task GetMonkeysAsync()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;

                var result = await Data.ListAsync <Monkey>(DefaultPartitions.AppDocuments);

                var monkeys = result.CurrentPage.Items.Select(monkey => monkey.DeserializedValue);

                Monkeys.Clear();

                monkeys.Aggregate(Monkeys, (collection, monkey) =>
                {
                    collection.Add(monkey);
                    return(collection);
                });

                Monkeys.Add(Monkey.GenerateGoofyMonkey());
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Unable to get monkeys: {ex.Message}");
                await Application.Current.MainPage.DisplayAlert("Error!", ex.Message, "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
        private async Task GetMonkeysAsync()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;

                var json = await Client.GetStringAsync("https://montemagno.com/monkeys.json");

                var monkeys = Monkey.FromJson(json);

                Monkeys.Clear();
                foreach (var monkey in monkeys)
                {
                    Monkeys.Add(monkey);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Unable to get monkeys: {ex.Message}");
                await Application.Current.MainPage.DisplayAlert("Error!", ex.Message, "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
        private void CreateNewMonkey()
        {
            int Id = Monkeys.Count + 1;

            if (Id < MonkeyNames.Count)
            {
                Monkeys.Add(new Monkey(Id, MonkeyNames[Id]));
            }
            else
            {
                Monkeys.Add(new Monkey(Id, $"Monkey{Id}"));
            }
        }
Example #8
0
        async void OnListViewItemTapped(object sender, SelectedItemChangedEventArgs e)
        {
            ListView lv = (ListView)sender;

            //// this assumes your List is bound to a List<Club>
            Monkeys.Add(new Monkey {
                Url = this.ToString()
            });
            Monkey monkeys = (Monkey)lv.SelectedItem;


            await Navigation.PushAsync(new MyPageDisplay(monkeys.Url.ToString(), monkeys.Name.ToString()));
        }
Example #9
0
        private void AddMonkey()
        {
            var rnd = new Random();

            Monkeys.Add(new Monkey
            {
                Name     = "Monkey " + rnd.Next(1000),
                Location = new Location {
                    Latitude = 34.0 + rnd.NextDouble() / 10.0, Longitude = -118.3 + rnd.NextDouble() / 10.0
                },
                Details  = "The squirrel monkeys are the New World monkeys of the genus Saimiri. They are the only genus in the subfamily Saimirinae. The name of the genus Saimiri is of Tupi origin, and was also used as an English name by early researchers.",
                ImageUrl = "http://upload.wikimedia.org/wikipedia/commons/thumb/2/20/Saimiri_sciureus-1_Luc_Viatour.jpg/220px-Saimiri_sciureus-1_Luc_Viatour.jpg"
            });
        }
Example #10
0
        async Task AzureSearch(string text)
        {
            Monkeys.Clear();

            var searchResults = await indexClient.Documents.SearchAsync <Monkey>(text);

            foreach (SearchResult <Monkey> result in searchResults.Results)
            {
                Monkeys.Add(new Monkey
                {
                    Name     = result.Document.Name,
                    Location = result.Document.Location,
                    Details  = result.Document.Details,
                    ImageUrl = result.Document.ImageUrl
                });
            }
        }
Example #11
0
        void FilterItems(string filter)
        {
            var filteredItems = _source.Where(monkey => monkey.Name.ToLower().Contains(filter.ToLower())).ToList();

            foreach (var monkey in _source)
            {
                if (!filteredItems.Contains(monkey))
                {
                    Monkeys.Remove(monkey);
                }
                else
                {
                    if (!Monkeys.Contains(monkey))
                    {
                        Monkeys.Add(monkey);
                    }
                }
            }
        }
Example #12
0
        public async Task LoadMonkeys()
        {
            IsBusy = true;
            Monkeys.Clear();

            var dataManager = App.MonkeyDataManager;

            var monkeys = await dataManager.GetMonkeysAsync();

            foreach (var item in monkeys)
            {
                var imageFiles = await dataManager.GetImageFiles(item);

                // Display only the photo files
                if (imageFiles != null && imageFiles.Count() > 0)
                {
                    var monkeyVm = new MonkeyViewModel(item);
                    monkeyVm.PhotoUrl = fileHelper.GetLocalFilePath(
                        item.Id, imageFiles.First().Name);

                    Monkeys.Add(monkeyVm);
                }
                IsBusy = false;
            }

            //var collection = new ObservableCollection<MonkeyViewModel>();

            //collection.Add(new MonkeyViewModel(new Models.Monkey
            //{
            //    UserName = "******",
            //    Status = "Chilling out in Malaysia",
            //    PhotoUrl = "http://photos1.meetupstatic.com/photos/event/8/f/d/6/600_343476822.jpeg"
            //}));
            //collection.Add(new MonkeyViewModel(new Models.Monkey
            //{
            //    UserName = "******",
            //    Status = "Wooh! Got boxed",
            //    PhotoUrl = "http://photos1.meetupstatic.com/photos/event/8/f/d/6/600_343476822.jpeg"
            //}));

            // monkeys = collection;
        }
Example #13
0
        void AddMonkeyAtPosition(SCNVector3 worldPos, nfloat rotation)
        {
            if (Monkeys == null)
            {
                Monkeys = new List <MonkeyCharacter> ();
            }

            SCNNode palmTree = CreateMonkeyPalmTree();

            palmTree.Position = worldPos;
            palmTree.Rotation = new SCNVector4(0f, 1f, 0f, rotation);
            RootNode.AddChildNode(palmTree);

            MonkeyCharacter monkey = (MonkeyCharacter)palmTree.FindChildNode("monkey", true);

            if (monkey != null)
            {
                Monkeys.Add(monkey);
            }
        }
        private void LoadItems(int pageSize = 10)
        {
            IsBusy = true;

            if (Monkeys == null)
            {
                Monkeys = new ObservableCollection <Monkey>();
            }

            for (int i = CurrentPage; i < CurrentPage + pageSize; i++)
            {
                Monkeys.Add(new Monkey()
                {
                    MonkeyId = i + 1,
                    Name     = string.Format("Monkey {0}", i + 1)
                });
            }

            CurrentPage = Monkeys.Count;
            IsBusy      = false;
        }
Example #15
0
        private void LoadMonkeys()
        {
            Monkeys.Add(new Monkey {
                Name     = "Baboon",
                Location = new Location {
                    Latitude = 34.027897, Longitude = -118.301869
                },
                Details  = "Baboons are African and Arabian Old World monkeys belonging to the genus Papio, part of the subfamily Cercopithecinae.",
                ImageUrl = "http://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Papio_anubis_%28Serengeti%2C_2009%29.jpg/200px-Papio_anubis_%28Serengeti%2C_2009%29.jpg"
            });

            Monkeys.Add(new Monkey {
                Name     = "Capuchin Monkey",
                Location = new Location {
                    Latitude = 34.047797, Longitude = -118.321869
                },
                Details  = "The capuchin monkeys are New World monkeys of the subfamily Cebinae. Prior to 2011, the subfamily contained only a single genus, Cebus.",
                ImageUrl = "http://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Capuchin_Costa_Rica.jpg/200px-Capuchin_Costa_Rica.jpg"
            });

            Monkeys.Add(new Monkey {
                Name     = "Blue Monkey",
                Location = new Location {
                    Latitude = 34.007897, Longitude = -118.300069
                },
                Details  = "The blue monkey or diademed monkey is a species of Old World monkey native to Central and East Africa, ranging from the upper Congo River basin east to the East African Rift and south to northern Angola and Zambia",
                ImageUrl = "http://upload.wikimedia.org/wikipedia/commons/thumb/8/83/BlueMonkey.jpg/220px-BlueMonkey.jpg"
            });


            Monkeys.Add(new Monkey {
                Name     = "Squirrel Monkey",
                Location = new Location {
                    Latitude = 34.107897, Longitude = -118.292869
                },
                Details  = "The squirrel monkeys are the New World monkeys of the genus Saimiri. They are the only genus in the subfamily Saimirinae. The name of the genus Saimiri is of Tupi origin, and was also used as an English name by early researchers.",
                ImageUrl = "http://upload.wikimedia.org/wikipedia/commons/thumb/2/20/Saimiri_sciureus-1_Luc_Viatour.jpg/220px-Saimiri_sciureus-1_Luc_Viatour.jpg"
            });
        }
        private void RefreshData()
        {
            IsRefreshing = true;

            ServicePointManager.ServerCertificateValidationCallback +=
                (sender, certificate, chain, sslPolicyErrors) => true;

            var API_URL = "https://localhost:5001/monkeys";
            var client  = new RestClient(API_URL)
            {
                Timeout = -1
            };
            var request = new RestRequest(Method.GET);

            IRestResponse response = client.Execute(request);

            List <Monkey> remoteMonkeys = JsonConvert.DeserializeObject <List <Monkey> >(response.Content);

            Monkeys.Clear();

            remoteMonkeys.ForEach(monkey => Monkeys.Add(monkey));

            IsRefreshing = false;
        }
        void UpdateData()
        {
            Monkeys.Clear();

            Monkeys.Add(new Monkey
            {
                Index    = "0",
                Name     = "Howler Monkey",
                Location = "South America",
                Details  = "Howler monkeys are among the largest of the New World monkeys. Fifteen species are currently recognised. Previously classified in the family Cebidae, they are now placed in the family Atelidae.",
                Image    = "http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Alouatta_guariba.jpg/200px-Alouatta_guariba.jpg",
                Color    = Color.Aqua
            });

            Monkeys.Add(new Monkey
            {
                Index    = "1",
                Name     = "Japanese Macaque",
                Location = "Japan",
                Details  = "The Japanese macaque, is a terrestrial Old World monkey species native to Japan. They are also sometimes known as the snow monkey because they live in areas where snow covers the ground for months each",
                Image    = "http://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Macaca_fuscata_fuscata1.jpg/220px-Macaca_fuscata_fuscata1.jpg",
                Color    = Color.OrangeRed
            });
        }
Example #18
0
 private void HandlePlusButtonCompletion(object sender, ChatDetail chatDtl)
 {
     Monkeys.Add(chatDtl);
 }
Example #19
0
        public MonkeysViewModel(IMvxNavigationService navigation)
        {
            navigationService = navigation;



            Monkeys.Add(new Monkey
            {
                Name     = "Baboon",
                Location = "Africa & Asia",
                Details  = "Baboons are African and Arabian Old World monkeys belonging to the genus Papio, part of the subfamily Cercopithecinae.",
            });

            Monkeys.Add(new Monkey
            {
                Name     = "Capuchin Monkey",
                Location = "Central & South America",
                Details  = "The capuchin monkeys are New World monkeys of the subfamily Cebinae. Prior to 2011, the subfamily contained only a single genus, Cebus.",
            });

            Monkeys.Add(new Monkey
            {
                Name     = "Blue Monkey",
                Location = "Central and East Africa",
                Details  = "The blue monkey or diademed monkey is a species of Old World monkey native to Central and East Africa, ranging from the upper Congo River basin east to the East African Rift and south to northern Angola and Zambia",
            });


            Monkeys.Add(new Monkey
            {
                Name     = "Squirrel Monkey",
                Location = "Central & South America",
                Details  = "The squirrel monkeys are the New World monkeys of the genus Saimiri. They are the only genus in the subfamily Saimirinae. The name of the genus Saimiri is of Tupi origin, and was also used as an English name by early researchers.",
            });

            Monkeys.Add(new Monkey
            {
                Name     = "Golden Lion Tamarin",
                Location = "Brazil",
                Details  = "The golden lion tamarin also known as the golden marmoset, is a small New World monkey of the family Callitrichidae.",
            });

            Monkeys.Add(new Monkey
            {
                Name     = "Howler Monkey",
                Location = "South America",
                Details  = "Howler monkeys are among the largest of the New World monkeys. Fifteen species are currently recognised. Previously classified in the family Cebidae, they are now placed in the family Atelidae.",
            });

            Monkeys.Add(new Monkey
            {
                Name     = "Japanese Macaque",
                Location = "Japan",
                Details  = "The Japanese macaque, is a terrestrial Old World monkey species native to Japan. They are also sometimes known as the snow monkey because they live in areas where snow covers the ground for months each",
            });

            Monkeys.Add(new Monkey
            {
                Name     = "Mandrill",
                Location = "Southern Cameroon, Gabon, Equatorial Guinea, and Congo",
                Details  = "The mandrill is a primate of the Old World monkey family, closely related to the baboons and even more closely to the drill. It is found in southern Cameroon, Gabon, Equatorial Guinea, and Congo.",
            });

            Monkeys.Add(new Monkey
            {
                Name     = "Proboscis Monkey",
                Location = "Borneo",
                Details  = "The proboscis monkey or long-nosed monkey, known as the bekantan in Malay, is a reddish-brown arboreal Old World monkey that is endemic to the south-east Asian island of Borneo.",
            });


            var sorted = from monkey in Monkeys
                         orderby monkey.Name
                         group monkey by monkey.NameSort into monkeyGroup
                         select new Grouping <string, Monkey>(monkeyGroup.Key, monkeyGroup);

            MonkeysGrouped = new ObservableCollection <Grouping <string, Monkey> >(sorted);
        }
Example #20
0
        public ListPage()
        {
            InitializeComponent();
            this.bannerAd_view.AdsId  = AdmobUnitIds.BannerId;
            this.bannerAd_view2.AdsId = AdmobUnitIds.BannerId;
            nt_Clicked.Clicked       += Btn_Clicked;
            List <Monkey> lists = new List <Monkey>();

            Monkeys = lists;
            Monkeys.Add(new Monkey
            {
                Name     = "خدمات بيع",
                Location = "تقسيط وكاش",
                ImageUrl = "ab.jpg",
                Url      = "https://elaabed611.blogspot.com/search/label/%D8%AE%D8%AF%D9%85%D8%A7%D8%AA%20%D9%83%D8%A7%D8%B4%20%D9%88%D8%AA%D9%82%D8%B3%D9%8A%D8%B7"
            });
            Monkeys.Add(new Monkey
            {
                Name     = "تابعنا على فيسبوك",
                Location = "العابد",
                ImageUrl = "ph.jpg",
                Url      = "https://www.facebook.com/elabeed2587"
            });
            Monkeys.Add(new Monkey
            {
                Name     = "اكسسوارات المحمول",
                Location = "بسعر الجملة",
                ImageUrl = "ac.jpg",
                Url      = "https://elaabed611.blogspot.com/search/label/%D8%A7%D9%83%D8%B3%D8%B3%D9%88%D8%A7%D8%B1%D8%A7%D8%AA"
            });
            Monkeys.Add(new Monkey
            {
                Name     = "اكسسوارات شركة كورن",
                Location = "كورن",
                ImageUrl = "ac.jpg",
                Url      = "https://elaabed611.blogspot.com/search/label/%D8%A7%D9%83%D8%B3%D8%B3%D9%88%D8%B1%D8%A7%20%D8%B4%D8%B1%D9%83%D8%A9%20%D9%83%D9%88%D8%B1%D9%86"
            });

            Monkeys.Add(new Monkey
            {
                Name     = "منتجات شركة كورن",
                Location = "كورن",
                ImageUrl = "ac.jpg",
                Url      = "https://elaabed611.blogspot.com/search/label/%D9%85%D9%86%D8%AA%D8%AC%D8%A7%D8%AA%20%D8%B4%D8%B1%D9%83%D8%A9%20%D9%83%D9%88%D8%B1%D9%86%20%D8%A8%D8%A7%D9%84%D8%B6%D9%85%D8%A7%D9%86"
            });
            Monkeys.Add(new Monkey
            {
                Name     = "تحويلات وهوائي",
                Location = "كل الخطوط",
                ImageUrl = "ab.gpj",
                Url      = "https://elaabed611.blogspot.com/search/label/%D9%85%D8%AD%D9%85%D9%88%D9%84"
            });
            Monkeys.Add(new Monkey
            {
                Name     = "Oppo",
                Location = "كل انواع اوبو",
                ImageUrl = "oppoa73.jpg",
                Url      = "https://elaabed611.blogspot.com/search/label/oppo"
            });
            Monkeys.Add(new Monkey
            {
                Name     = "Huawei",
                Location = "كل انواع Huawei",
                ImageUrl = "huawei.jpg",
                Url      = "https://www.facebook.com/elabeed2587"
            });
            Monkeys.Add(new Monkey
            {
                Name     = "Realme",
                Location = "كل انواع Realme",
                ImageUrl = "Realme.jpg",
                Url      = "https://elaabed611.blogspot.com/search/label/Realme"
            });
            Monkeys.Add(new Monkey
            {
                Name     = "Iphone",
                Location = "كل انواع Iphone ",
                ImageUrl = "iphone.jpg",
                Url      = "https://www.facebook.com/elabeed2587"
            });
            Monkeys.Add(new Monkey
            {
                Name     = "Samsung",
                Location = "كل انواع Samsung",
                ImageUrl = "samsung.jpg",
                Url      = "https://elaabed611.blogspot.com/search/label/%D8%B3%D8%A7%D9%85%D8%B3%D9%88%D9%86%D8%AC"
            });
            BindingContext = this;
        }