Beispiel #1
0
        private void HandleNavigation_Tapped(object sender, EventArgs e)
        {
            var items = new List <CheckItem>();

            items.Add(new CheckItem {
                Name = "Friends"
            });
            items.Add(new CheckItem {
                Name = "Colleagues"
            });
            items.Add(new CheckItem {
                Name = "Family"
            });

            if (multiPage == null)
            {
                multiPage = new SelectMultipleBasePage <CheckItem>(items)
                {
                    Title = "Check all that apply"
                }
            }
            ;

            Navigation.PushAsync(multiPage);
        }
        /// <summary>
        /// Enable or Disable screens
        /// </summary>
        private async void btnEnableScreens_Clicked(object sender, EventArgs e)
        {
            var items = App.AppSettings.EnabledScreens ?? new List <ScreenModel>
            {
                new ScreenModel {
                    ID = "Dashboard", Name = AppResources.title_dashboard, IsSelected = true
                },
                new ScreenModel {
                    ID = "Switch", Name = AppResources.title_switches, IsSelected = true
                },
                new ScreenModel {
                    ID = "Scene", Name = AppResources.title_scenes, IsSelected = true
                },
                new ScreenModel {
                    ID = "Temperature", Name = AppResources.title_temperature, IsSelected = true
                },
                new ScreenModel {
                    ID = "Weather", Name = AppResources.title_weather, IsSelected = true
                },
                new ScreenModel {
                    ID = "Utilities", Name = AppResources.title_utilities, IsSelected = true
                }
            };

            _oEnableScreenPage =
                new SelectMultipleBasePage <ScreenModel>(items, new Command(ExecuteSaveEnableScreensCommand))
            {
                Title = AppResources.enable_items
            };
            await Navigation.PushAsync(_oEnableScreenPage);
        }
        public async Task <SelectMultipleBasePage <Person> > GetMultiplePage()
        {
            var           items  = new List <Person>();
            List <Person> people = await App.PersonDatabase.GetPeopleAsync();

            foreach (var item in people)
            {
                items.Add(item);
            }

            if (MultiPage == null)
            {
                MultiPage = new SelectMultipleBasePage <Person>(items)
                {
                    Title = "Selecione as pessoas para o grupo"
                };
            }
            if (MultiPage != null && People != null)
            {
                for (int i = 0; i < MultiPage.WrappedItems.Count; i++)
                {
                    var person = People.Find(e => e.ID == MultiPage.WrappedItems[i].Item.ID);
                    if (person != null)
                    {
                        MultiPage.WrappedItems[i].IsSelected = true;
                    }
                }
            }
            return(MultiPage);
        }
        public StartQuizPage(int courseid)
        {
            InitializeComponent();

            SetBusyIndicator(true);

            url = "http://13.126.189.26:10008/api/getEvaluation-by-majorTopic/0/" + courseid;

            GetData();

            if (list[0].listQuestion.Count == 0)
            {
                lbltxt.IsVisible        = true;
                stackQuestion.IsVisible = false;
            }
            else
            {
                stackQuestion.IsVisible = true;
                lbltxt.IsVisible        = false;
                for (int i = 0; i < list.Count; i++)
                {
                    Qcount = Qcount + list[i].listQuestion.Count;
                }

                lblQuestion.Text = list[0].listQuestion[0].Question;
                lblquesNo.Text   = "Q." + quesNo;

                listAns.ItemsSource = list[0].listQuestion[0].listAnswer;

                answerList = list[0].listQuestion[0].listAnswer;
                var multiPage = new SelectMultipleBasePage <AnswerInfo>(answerList);
            }
        }
Beispiel #5
0
        private async void ProvinceAdd()
        {
            // LoadCalls();
            var items = new List <CheckItemMultiSelect>();

            items.Add(new CheckItemMultiSelect {
                Name = "Popular"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Santa Cruz"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Manrique"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Aranjuez"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Castilla"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Doce de Octubre"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Robledo"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Villa Hermosa"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Buenos Aires"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "La Candelaria"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Laureles-Estadio"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "La América"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "San Javier"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "El Poblado"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Guayabal"
            });
            items.Add(new CheckItemMultiSelect {
                Name = "Belén"
            });
            multiPage = new SelectMultipleBasePage <CheckItemMultiSelect>(items, this)
            {
                Title = "Seleccione el sector"
            };
            await navigationService.NavigatorSelectMultiple(multiPage);
        }
Beispiel #6
0
		async void OnClick (object sender, EventArgs ea) 
		{
			var items = new List<CheckItem>();
			items.Add (new CheckItem{ Name="Xamarin.com"});
			items.Add (new CheckItem{ Name="Twitter"});
			items.Add (new CheckItem{ Name="Facebook"});
			items.Add (new CheckItem{ Name="Internet ad"});
			items.Add (new CheckItem{ Name="Online article"});
			items.Add (new CheckItem{ Name="Magazine ad"});
			items.Add (new CheckItem{ Name="Friends"});
			items.Add (new CheckItem{ Name="At work"});

			if (multiPage == null)
				multiPage = new SelectMultipleBasePage<CheckItem> (items){ Title = "Check all that apply" };

			await Navigation.PushAsync (multiPage);
		}
        public async Task ButtonAdd_ClickAsync()
        {
            List <GolfApp2.Models.Tees>       tees  = App.database.GetItems <GolfApp2.Models.Tees>().ToList <GolfApp2.Models.Tees>();
            List <GolfApp2.Screens.CheckItem> items = new List <GolfApp2.Screens.CheckItem>();

            foreach (GolfApp2.Models.Tees itm in tees)
            {
                items.Add(new Screens.CheckItem {
                    Name = itm.TeeName
                });
            }

            multiPage = new SelectMultipleBasePage <GolfApp2.Screens.CheckItem>(items)
            {
                Title = "Check all that apply"
            };
            await Navigation.PushAsync(multiPage);
        }
Beispiel #8
0
        public Formular(string templateArrayNumber)
        {
            InitializeComponent();

            if (EnableBackButtonOverride)
            {
                CustomBackButtonAction = async() =>
                {
                    bool result = await hasFormularBeenEdited();

                    if (result)
                    {
                        saveFormular();
                    }
                    else
                    {
                        await Navigation.PopAsync(true);
                    }
                };
            }

            this.templateArrayNumber = templateArrayNumber;
            generateTemplate();

            //When a multiselect picker is chosen
            MessagingCenter.Subscribe <AbstractDynamicUI>(this, "MULTISELECT", async(sender) =>
            {
                var items = new List <CheckItem>();
                Dictionary <string, string> valueDictionary = sender.getValueList();
                List <string> valueList = valueDictionary.Values.ToList();
                foreach (string item in valueList)
                {
                    items.Add(new CheckItem {
                        Name = item
                    });
                }

                var multiPage = new SelectMultipleBasePage <CheckItem>(items)
                {
                    Title = "Check all that apply"
                };
                await Navigation.PushAsync(multiPage);
            });
        }
Beispiel #9
0
        async void OnClick(object sender, EventArgs ea)
        {
            var items = new List <CheckItem>();

            items.Add(new CheckItem {
                Name = "Xamarin.com"
            });
            items.Add(new CheckItem {
                Name = "Twitter"
            });
            items.Add(new CheckItem {
                Name = "Facebook"
            });
            items.Add(new CheckItem {
                Name = "Internet ad"
            });
            items.Add(new CheckItem {
                Name = "Online article"
            });
            items.Add(new CheckItem {
                Name = "Magazine ad"
            });
            items.Add(new CheckItem {
                Name = "Friends"
            });
            items.Add(new CheckItem {
                Name = "At work"
            });

            if (multiPage == null)
            {
                multiPage = new SelectMultipleBasePage <CheckItem>(items)
                {
                    Title = "Check all that apply"
                }
            }
            ;

            await Navigation.PushAsync(multiPage);
        }
    }
        async void DownWhite_Tapped(object sender, System.EventArgs e)
        {
            //change question
            stackMain.IsEnabled = true;
            await PageDown.TranslateTo(0, Page.Height, 500, Easing.SinIn);

            var a = answerList.Where(item => item.IsSelected == item.IsCorrect).Select(wrappedItem => new { wrappedItem.Answer, wrappedItem.IsCorrect, wrappedItem.IsSelected }).ToList();
            var b = answerList.Where(item => item.IsSelected == true).Select(wrappedItem => new { wrappedItem.Answer, wrappedItem.IsCorrect, wrappedItem.IsSelected }).ToList();

            if (b.Count != 0)
            {
                quesNo++;
                if (a.Count == answerList.Count)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        for (int j = 0; j < list[i].listQuestion.Count; j++)
                        {
                            if (i == 0 && j == 0)
                            {
                            }
                            else
                            {
                                lstCnt++;
                                if (quesNo == lstCnt)
                                {
                                    lblQuestion.Text    = list[i].listQuestion[j].Question;
                                    lblquesNo.Text      = "Q." + quesNo;
                                    listAns.ItemsSource = list[i].listQuestion[j].listAnswer;
                                    answerList          = list[i].listQuestion[j].listAnswer;
                                    var multiPage = new SelectMultipleBasePage <AnswerInfo>(answerList);
                                    SetBusyIndicator(false);
                                }
                            }
                        }
                    }
                    if (Qcount == quesNo)
                    {
                        var result = await DisplayAlert("Message", "Quiz Completed", "ok", "");

                        if (result == true)
                        {
                            await Navigation.PushAsync(new MasterPage());

                            SetBusyIndicator(false);
                        }
                        else
                        {
                            return;
                        }
                    }
                    lstCnt = 1;
                    SetBusyIndicator(false);
                }

                else
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        for (int j = 0; j < list[i].listQuestion.Count; j++)
                        {
                            if (i == 0 && j == 0)
                            {
                            }
                            else
                            {
                                lstCnt++;
                                if (quesNo == lstCnt)
                                {
                                    lblQuestion.Text    = list[i].listQuestion[j].Question;
                                    lblquesNo.Text      = "Q." + quesNo;
                                    listAns.ItemsSource = list[i].listQuestion[j].listAnswer;
                                    answerList          = list[i].listQuestion[j].listAnswer;
                                    var multiPage = new SelectMultipleBasePage <AnswerInfo>(answerList);
                                    SetBusyIndicator(false);
                                }
                            }
                        }
                    }

                    if (Qcount == quesNo)
                    {
                        var result = await DisplayAlert("Message", "Quiz Completed", "ok", "cancel");

                        if (result == true)
                        {
                            await Navigation.PushAsync(new MasterPage());

                            SetBusyIndicator(false);
                        }
                        else
                        {
                            return;
                        }
                    }
                    lstCnt = 1;
                    SetBusyIndicator(false);
                }
            }
            else
            {
                if (Device.OS == TargetPlatform.iOS)
                {
                    await DisplayAlert("Message", "Select any answer", "Ok");
                }
                else
                {
                    XFToast.ShortMessage("Select any answer");
                }
            }
        }
 public async Task NavigatorSelectMultiple(SelectMultipleBasePage <CheckItemMultiSelect> multiPage)
 {
     await App.Navigator.PushAsync(multiPage);
 }