Пример #1
0
		public Issue2339 ()
		{
			var picker = new Picker { Items = {"One", "Two", "Three"} };
			var pickerBtn = new Button {
				Text = "Click me to call .Focus on Picker"
			};

			pickerBtn.Clicked += (sender, args) => {
				picker.Focus ();
			};

			var pickerBtn2 = new Button {
				Text = "Click me to call .Unfocus on Picker"
			};

			pickerBtn2.Clicked += (sender, args) => {
				picker.Unfocus ();
			};

			var pickerBtn3 = new Button {
				Text = "Click me to .Focus () picker, wait 2 seconds, and .Unfocus () picker",
				Command = new Command (async () => {
					picker.Focus ();
					await Task.Delay (2000);
					picker.Unfocus ();
				})
			};

			var focusFiredCount = 0;
			var unfocusFiredCount = 0;

			var focusFiredLabel = new Label { Text = "Picker Focused: " + focusFiredCount };
			var unfocusedFiredLabel = new Label { Text = "Picker UnFocused: " + unfocusFiredCount };

			picker.Focused += (s, e) => {
				focusFiredCount++;
				focusFiredLabel.Text = "Picker Focused: " + focusFiredCount;
			};
			picker.Unfocused += (s, e) => {
				unfocusFiredCount++;
				unfocusedFiredLabel.Text = "Picker UnFocused: " + unfocusFiredCount;
			};

			Content = new StackLayout {
				Children = {
					focusFiredLabel, 
					unfocusedFiredLabel,
					pickerBtn,
					pickerBtn2,
					pickerBtn3,
					picker
				}
			};
		}
        /// <summary>
        /// Update the view when the focused property changes.
        /// </summary>
        /// <param name="bindable">The object the itemsource is bound to.</param>
        /// <param name="oldValue">The original value of the property.</param>
        /// <param name="newValue">The new value of the property.</param>
        static void OnFocusedChanged(BindableObject bindable, object oldValue, object newValue)
        {
            //If the host object is a picker..
            if (bindable is Picker)
            {
                //Unbox.
                Picker picker = bindable as Picker;

                //If setting is true.
                if ((bool)newValue)
                {
                    //Set the Focus
                    picker.Focus();


                    //Attach handling for lost focus.
                    picker.Unfocused += Picker_Unfocused;
                }
                else
                {
                    //Remove handling.
                    picker.Unfocused -= Picker_Unfocused;
                }
            }
        }
Пример #3
0
        public void ShowFilePicker(Picker picker)
        {
            try
            {
                SelectedFile = null;// new SmbInfo();

                var fileList = new List <SmbInfo>();

                if (TransferType == 1 && !string.IsNullOrEmpty(MySmbInfo.LocalDirectory))
                {
                    fileList = StorageService.GetFileList(MySmbInfo.LocalDirectory);
                }
                else if (TransferType == 0 && !string.IsNullOrEmpty(MySmbInfo.ServerDirectory))
                {
                    fileList = smbService.Smb2GetFileList(MySmbInfo);
                }

                FileList = new ObservableCollection <SmbInfo>(fileList);
                RaisePropertyChanged("FileList");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            picker.Focus();
        }
Пример #4
0
 private void ShowFileBtn_Clicked(object sender, EventArgs e)
 {
     if (Device.RuntimePlatform != Device.Windows)
     {
         if (!popupLayout.IsVisible)
         {
             popupLayout.IsVisible = true;
             picker.Focus();
         }
         else
         {
             popupLayout.IsVisible = false;
             picker.Unfocus();
         }
     }
     else
     {
         if (!popupLayout.IsVisible)
         {
             popupLayout.IsVisible = true;
         }
         else
         {
             popupLayout.IsVisible = false;
         }
     }
 }
        public MaterialDatePicker()
        {
            InitializeComponent();
            EntryField.BindingContext    = this;
            BottomBorder.BackgroundColor = DefaultColor;
            EntryField.Focused          += (s, a) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    EntryField.Unfocus();
                    Picker.Focus();
                });
            };
            Picker.Focused += async(s, a) =>
            {
                HiddenBottomBorder.BackgroundColor = AccentColor;
                HiddenLabel.TextColor = AccentColor;
                HiddenLabel.IsVisible = true;
                if (string.IsNullOrEmpty(EntryField.Text))
                {
                    // animate both at the same time
                    await Task.WhenAll(
                        HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, BottomBorder.Width, BottomBorder.Height), 200),
                        HiddenLabel.FadeTo(1, 60),
                        HiddenLabel.TranslateTo(HiddenLabel.TranslationX, EntryField.Y - EntryField.Height + 4, 200, Easing.BounceIn)
                        );

                    EntryField.Placeholder = null;
                }
                else
                {
                    await HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, BottomBorder.Width, BottomBorder.Height), 200);
                }
            };
            Picker.Unfocused += async(s, a) =>
            {
                if (IsValid)
                {
                    HiddenLabel.TextColor = DefaultColor;
                }
                Picker_DateSelected(s, new DateChangedEventArgs(Picker.Date, Picker.Date));
                if (string.IsNullOrEmpty(EntryField.Text))
                {
                    // animate both at the same time
                    await Task.WhenAll(
                        HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, 0, BottomBorder.Height), 200),
                        HiddenLabel.FadeTo(0, 180),
                        HiddenLabel.TranslateTo(HiddenLabel.TranslationX, EntryField.Y, 200, Easing.BounceIn)
                        );

                    EntryField.Placeholder = Placeholder;
                }
                else
                {
                    await HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, 0, BottomBorder.Height), 200);
                }
            };

            Picker.DateSelected += Picker_DateSelected;
        }
Пример #6
0
        private void AddQuestion(StackLayout stack, Services.Section s)
        {
            selectQuestionType.IsVisible   = true;
            selectQuestionType.ItemsSource = new List <string> {
                "Multiple", "Text"
            };
            selectQuestionType.SelectedIndexChanged += (sender, args) =>
            {
                Services.Question question;
                switch (selectQuestionType.SelectedIndex)
                {
                case 0:
                    question = new Services.Question(Services.QuestionType.Multiple);
                    break;

                default:
                    question = new Services.Question(Services.QuestionType.Text);
                    break;
                }

                s.addQuestion(question);
                stack.Children.Add(GetQuestionView(question, s));
                selectQuestionType.IsVisible = false;
            };

            if (!selectQuestionType.IsFocused && selectQuestionType.IsVisible)
            {
                selectQuestionType.IsVisible = false;
            }
            selectQuestionType.Focus();
        }
Пример #7
0
        private void SetDisplay(Picker control)
        {
            this.Text      = ErrorMessage;
            this.IsVisible = true;

            if (this.SetFocusOnError == true)
            {
                control.Focus();
            }
        }
Пример #8
0
 private void OnTapped(object sender, EventArgs e)
 {
     pickerLanguage.ItemsSource           = DataSource;
     pickerLanguage.ItemDisplayBinding    = new Binding("LanguageName");
     pickerLanguage.SelectedIndexChanged += OnLanguageChanged;
     if (ShowSelection)
     {
         pickerLanguage.Focus();
     }
 }
Пример #9
0
        private void SimChoice(Action <int> onChoice = null)
        {
            var simPicker = new Picker {
                Title       = "Sim",
                IsVisible   = false,
                ItemsSource = Model.Message.Sims,                                   // ItemDisplayBinding = new Binding("Name")
            };

            simPicker.SelectedIndexChanged += (object s, EventArgs ev) => onChoice?.Invoke(simPicker.SelectedIndex);
            bottom.Children.Add(simPicker);
            simPicker.Focus();
        }
Пример #10
0
        void OnButtonPickerEndCicked(object sender, EventArgs args)
        {
            // check if feature is purchased, show app-store if not purchased
            if (AppStore.Instance.IsAppStoreShown(layout))
            {
                return;
            }

            pickerEnd.IsVisible    = true;
            btnPickerEnd.IsVisible = false;
            pickerEnd.Focus(); // note: focus/unfocus events not fired by picker if this method is used
        }
Пример #11
0
        public MaterialTimePicker()
        {
            InitializeComponent();
            EntryField.BindingContext = this;
            EntryField.Focused       += (s, a) =>
            {
                EntryField.Unfocus();
                Picker.Focus();
            };
            Picker.Focused += async(s, a) =>
            {
                HiddenBottomBorder.BackgroundColor = AccentColor;
                HiddenLabel.TextColor = AccentColor;
                HiddenLabel.IsVisible = true;
                if (string.IsNullOrEmpty(EntryField.Text))
                {
                    // animate both at the same time
                    await Task.WhenAll(
                        HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, BottomBorder.Width, BottomBorder.Height), 200),
                        HiddenLabel.FadeTo(1, 60),
                        HiddenLabel.TranslateTo(HiddenLabel.TranslationX, EntryField.Y - EntryField.Height + 4, 200, Easing.BounceIn)
                        );

                    EntryField.Placeholder = null;
                }
                else
                {
                    await HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, BottomBorder.Width, BottomBorder.Height), 200);
                }
            };
            Picker.Unfocused += async(s, a) =>
            {
                HiddenLabel.TextColor = Color.Gray;
                if (Time == null)
                {
                    // animate both at the same time
                    await Task.WhenAll(
                        HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, 0, BottomBorder.Height), 200),
                        HiddenLabel.FadeTo(0, 180),
                        HiddenLabel.TranslateTo(HiddenLabel.TranslationX, EntryField.Y, 200, Easing.BounceIn)
                        );

                    EntryField.Placeholder = Placeholder;
                }
                else
                {
                    await HiddenBottomBorder.LayoutTo(new Rectangle(BottomBorder.X, BottomBorder.Y, 0, BottomBorder.Height), 200);
                }
            };

            Picker.PropertyChanged += Picker_PropertyChanged;;
        }
Пример #12
0
        public BybTimePicker()
        {
            this.items = new List <HourAndMinute>();
            for (int hour = 6; hour <= 23; ++hour)
            {
                for (int minute = 0; minute <= 45; minute += 15)
                {
                    this.items.Add(new HourAndMinute(hour, minute));
                }
            }

            this.HorizontalOptions = LayoutOptions.FillAndExpand;
            this.HeightRequest     = 50;
            this.Padding           = new Thickness(0);
            //this.BackgroundColor = Color.Transparent;
            //this.HasShadow = false;

            this.picker = new BybNoBorderPicker()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Color.Transparent,
                Title             = "Pick time"
            };
            foreach (var item in items)
            {
                this.picker.Items.Add(item.Text);
            }
            this.picker.SelectedIndex         = items.Count - 16;
            this.picker.SelectedIndexChanged += picker_SelectedIndexChanged;

//            this.Content = new StackLayout
//            {
//                Orientation = StackOrientation.Horizontal,
//                Spacing = 5,
//                Padding = new Thickness(0, 0, 0, 0),
//                Children =
//                {
//                    this.picker,
//                }
//            };
            this.Children.Add(this.picker);

            this.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() =>
                {
                    picker.Focus();
                }),
                NumberOfTapsRequired = 1
            });
        }
Пример #13
0
 private void OnTapped(object sender, EventArgs e)
 {
     pickerLanguage.ItemsSource = DataSource;
     pickerLanguage.Focus();
     pickerLanguage.SelectedIndexChanged += (sender1, e1) =>
     {
         var langSelected = pickerLanguage.SelectedItem;
         if (langSelected != null)
         {
             SelectedIndex = 0;
             Text          = langSelected.ToString();
         }
     };
 }
Пример #14
0
        private void OnListViewItemTapped(object sender, ItemTappedEventArgs e)
        {
            var listView = (ListView)sender;

            if (listView.SelectedItem == null)
            {
                return;
            }

            var selectedCartItem = (CartCellViewModel)listView.SelectedItem;

            _selectedCartItemId = selectedCartItem.CartItemId;
            _qtyPicker.Focus();
            listView.SelectedItem = null;
        }
 //---------------------------------------------- End Of InitComp --------------------------------------
 protected override void OnAppearing()
 {
     base.OnAppearing();
     hotelPicker.Focus();
     if (Settings.DomainSwitcher)
     {
         swicherStatLabel.Text      = "Production";
         swicherStatLabel.TextColor = Color.LawnGreen;
     }
     else
     {
         swicherStatLabel.Text      = "Development";
         swicherStatLabel.TextColor = Color.Red;
     }
 }
Пример #16
0
        private void RunPicker()
        {
            bool bContinue = true;

            PickerStatus++;

            if (m_LevelList.Where(s => s.Order == PickerStatus).Count() == 0)
            {
                bContinue = false;
            }

            if (bContinue)
            {
                string UseLevel = m_LevelList.Where(s => s.Order == PickerStatus).First().Level;


                List <BadgeType> curList = m_BadgeList.Where(s => s.Misc == UseLevel && s.Type1 == "Profile" && s.Type2 == "Element").ToList();

                Picker ppNew = new Picker();


                ppNew.ItemsSource        = curList;
                ppNew.ItemDisplayBinding = new Binding("Description");

                if (m_ActiveProfile[PickerStatus - 1] != null)
                {
                    ppNew.SelectedItem = m_ActiveProfile[PickerStatus - 1];
                }
                else
                {
                    ppNew.SelectedItem = curList.First();
                }

                ppNew.SelectedIndexChanged += pickProfile_SelectedIndexChanged;
                ppNew.Unfocused            += PpNew_Unfocused;

                m_SelectFlag = true;

                viewMain.Children.Add(ppNew);
                ppNew.IsVisible = true;
                ppNew.Focus();
            }
            else
            {
                UpdateActiveProfileText();
                cmdEdit.IsEnabled = true;
            }
        }
        public MaterialDatePicker()
        {
            InitializeComponent();
            EntryField.BindingContext    = this;
            Picker.BindingContext        = this;
            BottomBorder.BackgroundColor = DefaultColor;
            EntryField.Focused          += (s, a) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    EntryField.Unfocus();
                    Picker.Focus();
                });
            };
            Picker.Focused += async(s, a) =>
            {
                await CalculateLayoutFocused();
            };
            Picker.Unfocused += async(s, a) =>
            {
                EntryUnfocused?.Invoke(this, a);
                await CalculateLayoutUnfocused();
            };

            Picker.PropertyChanged += async(sender, args) =>
            {
                if (args.PropertyName == nameof(Picker.NullableDate))
                {
                    CustomDateFormat = CustomDateFormat ?? _defaultDateFormat;
                    var datepicker = (BorderlessDatePicker)sender;
                    EntryField.Text = datepicker.NullableDate.Value.ToString(CustomDateFormat, CultureInfo.CurrentCulture);
                    this.Date       = datepicker.NullableDate;
                    await CalculateLayoutUnfocused();
                }
            };

            //UpdateValidation();
        }
Пример #18
0
        public MainPage()
        {
            InitializeComponent();

            Label  lblMainText = this.FindByName <Label>("mainText");
            Picker picker      = this.FindByName <Picker>("mainPicker");
            Image  imgMain     = this.FindByName <Image>("mainImage");

            imgMain.Aspect = Aspect.AspectFit;
            imgMain.Source = ImageSource.FromResource("karte_amberg.png");

            string text = @"Fitness und Gesundheitstraining ist nicht nur eine Tätigkeit, sondern eine Lebenseinstellung.";

            //text += @"Fit 24 und seine Mitarbeiter sind der festen Überzeugung, dass Bewegung zu den Grundbedürfnissen des Menschen gehören und dass richtiges, auf die Person zugeschnittes Training nicht nur die Kondition verbessert, sondern viel mehr bewirkt.";
            //text += @"Ein schmerzfreier Rücken oder eine Figur, mit der man sich wohl fühlt, tragen direkt zu mehr Lebensqualität bei.";
            //text += @"Fit 24 legt besonders viel Wert auf Qualität und Freundlichkeit.";
            //text += @"Jeder wird hier mit einem Lächeln begrüßt und findet in unserer großen Auswahl an Trainingsmöglichkeiten sicher das passende Training." + "\n";
            //text += @"In Kursen wie Spinning oder Zumba kann man in der Gruppe mit viel Spaß und Anleitung sein Ziel verfolgen.";
            text += @"Wer effektiv abnehmen möchte, für den ist unser Gesundheitszirkel, genau das Richtige.";
            text += @"Vollautomatische Geräte, die sich individuell und von ganz alleine auf den Trainierenden einstellen." + "\n";
            //text += @"Dies und noch viel mehr kann man 24 Stunden am Tag und sieben Tage die Woche nutzen.";
            text += @"Es gibt keine Öffnungszeiten und keine Feiertage." + "\n";
            text += @"Die Teams von Fit 24 freuen sich auf deinen Besuch.";
            //text += @"Vereinbare einfach einen Termin für ein unverbindliches Probetraining und pack es an." + "\n";
            text += @"Dein Fit 24 Team";

            lblMainText.Text             = text;
            picker.SelectedIndex         = 0;
            picker.SelectedIndexChanged += Picker_SelectedIndexChanged;

            imgMain.GestureRecognizers.Add(new TapGestureRecognizer
            {
                TappedCallback = (v, o) => {
                    picker.Focus();
                },
                NumberOfTapsRequired = 1
            });
        }
Пример #19
0
        void Handle_OnChanged(object sender, Xamarin.Forms.ToggledEventArgs e)
        {
            if (e.Value)
            {
                Picker.IsVisible = true;

                Device.StartTimer(new System.TimeSpan(0, 0, 0, 0, 200), () =>
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        scrollview.ScrollToAsync(Picker, ScrollToPosition.End, false);
                    });

                    return(false);
                });

                Picker.Focus();
            }
            else
            {
                Picker.IsVisible = false;
            }
        }
Пример #20
0
        protected override void Init()
        {
            var picker = new Picker
            {
                ItemsSource = new string[] { "A", "B", "C" }
            };

            Content = new StackLayout
            {
                Children =
                {
                    picker,
                    new Button
                    {
                        Text    = "Click to focus the picker",
                        Command = new Command(() =>
                        {
                            picker.Focus();
                        })
                    }
                }
            };
        }
Пример #21
0
        /// <summary>
        /// Todays Timetable
        /// </summary>
        public void TodaysTimetableLayout()
        {
            try
            {
                TitleBar lblPageName = new TitleBar("Today's TimeTable");
                StackLayout slTitle = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 5, 0, 0),
                    BackgroundColor = Color.White,
                    Children = { lblPageName }
                };

                Seperator spTitle = new Seperator();

                BindableRadioGroup radByTeacherOrClass = new BindableRadioGroup();

                radByTeacherOrClass.ItemsSource = new[] { "By Teacher", "By Class" };
                radByTeacherOrClass.HorizontalOptions = LayoutOptions.FillAndExpand;
                radByTeacherOrClass.Orientation = StackOrientation.Horizontal;
                radByTeacherOrClass.TextColor = Color.Black;

                StackLayout slRadio = new StackLayout
                {
                    Children = { radByTeacherOrClass },
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };

                #region By Teacher

                Image imgTeacherDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand };
                Label lblTeacher = new Label { TextColor = Color.Black, Text = "Teacher" };
                Picker pcrTeacher = new Picker { IsVisible = false, Title = "Teacher" };

                StackLayout slTeacherDisplay = new StackLayout { Children = { lblTeacher, pcrTeacher, imgTeacherDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) };

                Frame frmTeacher = new Frame
                {
                    Content = slTeacherDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor = Color.Black,
                    Padding = new Thickness(10)
                };

                var teacherTap = new TapGestureRecognizer();

                teacherTap.NumberOfTapsRequired = 1; // single-tap
                teacherTap.Tapped += (s, e) =>
                {
                    pcrTeacher.Focus();
                };
                frmTeacher.GestureRecognizers.Add(teacherTap);
                slTeacherDisplay.GestureRecognizers.Add(teacherTap);

                StackLayout slTeacherFrameLayout = new StackLayout
                {
                    Children = { frmTeacher }
                };

                StackLayout slTeacherLayout = new StackLayout
                {
                    Children = { slTeacherFrameLayout },
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    IsVisible = false
                };

                Label lblStandardName = new Label
                {
                    Text = "Standard Name",
                    TextColor = Color.Black
                };

                StackLayout slStandardName = new StackLayout
                {
                    Children = { lblStandardName },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                };

                Label lblClassTypeName = new Label
                {
                    Text = "Class Type Name",
                    TextColor = Color.Black
                };

                StackLayout slClassTypeName = new StackLayout
                {
                    Children = { lblClassTypeName },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };

                Label lblStubjectName = new Label
                {
                    Text = "Subject Name",
                    TextColor = Color.Black
                };

                StackLayout slSubjectName = new StackLayout
                {
                    Children = { lblStubjectName },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };
                #endregion

                #region By Class

                Image imgStandardDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand };
                Label lblStandard = new Label { TextColor = Color.Black, Text = "Standard" };
                Picker pcrStandard = new Picker { IsVisible = false, Title = "Standard" };

                StackLayout slStandardDisplay = new StackLayout { Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) };

                Frame frmStandard = new Frame
                {
                    Content = slStandardDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor = Color.Black,
                    Padding = new Thickness(10)
                };

                var standardTap = new TapGestureRecognizer();

                standardTap.NumberOfTapsRequired = 1; // single-tap
                standardTap.Tapped += (s, e) =>
                {
                    pcrStandard.Focus();
                };
                frmStandard.GestureRecognizers.Add(standardTap);
                slStandardDisplay.GestureRecognizers.Add(standardTap);

                StackLayout slStandardFrameLayout = new StackLayout
                {
                    Children = { frmStandard }
                };

                StackLayout slStandardLayout = new StackLayout
                {
                    Children = { slStandardFrameLayout },
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                Image imgClassDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand };
                Label lblClass = new Label { TextColor = Color.Black, Text = "Class" };
                Picker pcrClass = new Picker { IsVisible = false, Title = "Class" };

                StackLayout slClassDisplay = new StackLayout { Children = { lblClass, pcrClass, imgClassDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) };

                Frame frmClass = new Frame
                {
                    Content = slClassDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor = Color.Black,
                    Padding = new Thickness(10)
                };

                var classTap = new TapGestureRecognizer();

                classTap.NumberOfTapsRequired = 1; // single-tap
                classTap.Tapped += (s, e) =>
                {
                    pcrClass.Focus();
                };
                frmClass.GestureRecognizers.Add(classTap);
                slClassDisplay.GestureRecognizers.Add(classTap);

                StackLayout slClassFrameLayout = new StackLayout
                {
                    Children = { frmClass }
                };

                StackLayout slClassLayout = new StackLayout
                {
                    Children = { slClassFrameLayout },
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    IsVisible = false
                };

                //Grid Header
                Label lblTeachername = new Label
                {
                    Text = "Teacher Name",
                    TextColor = Color.Black
                };

                StackLayout slTeacherName = new StackLayout
                {
                    Children = { lblTeachername },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };

                Label lblStubject = new Label
                {
                    Text = "Subject Name",
                    TextColor = Color.Black
                };

                StackLayout slSubject = new StackLayout
                {
                    Children = { lblStubject },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };

                #endregion

                Label lblSequensNo = new Label
                {
                    Text = "No",
                    TextColor = Color.Black
                };

                StackLayout slSequensNo = new StackLayout
                {
                    Children = { lblSequensNo },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand
                };

                StackLayout grid = new StackLayout
                {
                    //Children = { slTeacherName, slSequensNo, slSubjectName },
                    Orientation = StackOrientation.Horizontal,
                    IsVisible = false
                };

                Seperator spDisplayHeader = new Seperator { IsVisible = false };

                StackLayout slSearchinOneCol = new StackLayout
                {
                    Children = { slStandardLayout, slClassLayout },
                    Orientation = StackOrientation.Horizontal,
                    IsVisible = false
                };

                _NotAvailData = new Label { Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false };

                _Loader = new LoadingIndicator();

                radByTeacherOrClass.CheckedChanged += (sender, e) =>
                    {
                        Device.BeginInvokeOnMainThread(async () =>
                       {
                           var radio = sender as CustomRadioButton;

                           if (radio == null || radio.Id == -1)
                           {
                               return;
                           }

                           if (radio.Text == "By Teacher")
                           {
                               slTeacherLayout.IsVisible = true;
                               slSearchinOneCol.IsVisible = false;

                               foreach (TeacherModel item in _TeacherList)
                               {
                                   pcrTeacher.Items.Add(item.Name);
                               }

                               grid.Children.Add(slSequensNo);
                               grid.Children.Add(slStandardDisplay);
                               grid.Children.Add(slClassTypeName);
                               grid.Children.Add(slSubjectName);

                           }
                           else
                           {
                               slSearchinOneCol.IsVisible = true;
                               slTeacherLayout.IsVisible = false;

                               grid.Children.Add(slSequensNo);
                               grid.Children.Add(slTeacherName);
                               grid.Children.Add(slSubject);

                               _StatndardList = await StandardModel.GetStandard();

                               foreach (StandardModel item in _StatndardList)
                               {
                                   pcrStandard.Items.Add(item.Name);
                               }
                           }
                       });
                    };

                //List view
                ListView TimeTableListView = new ListView
                {
                    RowHeight = 50,
                    SeparatorColor = Color.Gray
                };

                TimeTableListView.ItemTemplate = new DataTemplate(() => new FillUpAttendanceCell());

                pcrStandard.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        try
                        {
                            _Loader.IsShowLoading = true;
                            pcrClass.Items.Clear();

                            string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                            _SelectedStandardID = _StatndardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                            _ClassTypeList = await ClassTypeModel.GetClassType(_SelectedStandardID);

                            if (_ClassTypeList.Count > 0 && _ClassTypeList != null)
                            {
                                slClassLayout.IsVisible = true;
                                _NotAvailData.IsVisible = false;
                            }
                            else
                            {
                                slClassLayout.IsVisible = false;
                                _NotAvailData.IsVisible = true;
                            }

                            foreach (ClassTypeModel item in _ClassTypeList)
                            {
                                pcrClass.Items.Add(item.Name);
                            }

                            _Loader.IsShowLoading = false;
                        }
                        catch (Exception ex)
                        {

                        }
                    });
                };

                //Class Picker Selected

                pcrClass.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        _Loader.IsShowLoading = true;
                        _NotAvailData.IsVisible = false;

                        string className = lblClass.Text = pcrClass.Items[pcrClass.SelectedIndex];

                        _SelectedClassTypeID = _ClassTypeList.FirstOrDefault(x => x.Name == className).Id;

                        //Get time table list
                        _TimeTableList = await TimeTableModel.ShowTimeTable(_SelectedStandardID, _SelectedClassTypeID);

                        if (_TimeTableList != null && _TimeTableList.Count > 0)
                        {
                            grid.IsVisible = true;
                            spDisplayHeader.IsVisible = true;
                            Items = new ObservableCollection<TimeTableModel>(_TimeTableList);
                            TimeTableListView.ItemsSource = Items;
                        }
                        else
                        {
                            grid.IsVisible = false;
                            spDisplayHeader.IsVisible = false;
                            _NotAvailData.Text = "There is no data for selected standard and class.";
                            _NotAvailData.IsVisible = true;
                        }
                        _Loader.IsShowLoading = false;
                    });
                };

                //Class Picker Selected

                pcrTeacher.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        _Loader.IsShowLoading = true;
                        _NotAvailData.IsVisible = false;

                        string teacherName = lblTeacher.Text = pcrTeacher.Items[pcrTeacher.SelectedIndex];

                        _SelectedTeacherID = _TeacherList.FirstOrDefault(x => x.Name == teacherName).ID;

                        //Get time table list
                        _TimeTableList = await TimeTableModel.ShowTimeTable(_SelectedTeacherID);

                        if (_TimeTableList != null && _TimeTableList.Count > 0)
                        {
                            grid.IsVisible = true;
                            spDisplayHeader.IsVisible = true;
                            Items = new ObservableCollection<TimeTableModel>(_TimeTableList);
                            TimeTableListView.ItemsSource = Items;
                        }
                        else
                        {
                            grid.IsVisible = false;
                            spDisplayHeader.IsVisible = false;
                            _NotAvailData.Text = "There is no data for selected standard and class.";
                            _NotAvailData.IsVisible = true;
                        }
                        _Loader.IsShowLoading = false;
                    });
                };

                StackLayout slTimeTable = new StackLayout
                {
                    Children = { 
                        new StackLayout{
                            Padding = new Thickness(20, Device.OnPlatform(40,20,0), 20, 20),
						    Children = {slTitle, spTitle.LineSeperatorView,slRadio,slTeacherLayout, slSearchinOneCol,grid,spDisplayHeader.LineSeperatorView, _Loader, _NotAvailData,TimeTableListView},
                            VerticalOptions = LayoutOptions.FillAndExpand,
                        },
                    },
                    BackgroundColor = LayoutHelper.PageBackgroundColor
                };

                Content = new ScrollView
                {
                    Content = slTimeTable,
                };
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #22
0
        protected async override void OnAppearing()
        {
            IsLoading = true;
            this.Content.IsEnabled = false;


            // Get filtered plant list if came from search
            if (!cameFromSearch)
            {
                if (App.WoodyPlantRepoLocal.GetAllWoodyPlants().Count > 0)
                {
                    plants = new ObservableCollection <WoodyPlant>(App.WoodyPlantRepoLocal.GetAllWoodyPlants());
                    if (plants.Count > 0)
                    {
                        woodyPlantsList.ItemsSource = plants;
                    }
                    ;
                    ChangeFilterColors(browseFilter);
                    base.OnAppearing();
                }
                else
                {
                    plants = new ObservableCollection <WoodyPlant>(await externalConnection.GetAllPlants());
                    if (plants.Count > 0)
                    {
                        woodyPlantsList.ItemsSource = plants;
                    }
                    ;
                    ChangeFilterColors(browseFilter);
                    base.OnAppearing();
                }
            }
            else
            {
                //plants = await App.WoodyPlantRepoLocal.GetAllSearchPlants();
                ChangeFilterColors(searchFilter);
            }
            // Set sort settings and filter jump list
            GetSortField();
            if (sortField.valuetext == "Sort")
            {
                sortPicker.SelectedIndex = 0;
                FilterJumpList("Common Name");
            }
            else
            {
                sortPicker.SelectedIndex = (int)sortField.valueint;
                FilterJumpList(sortButton.Text);
                SortItems();
            }
            if (cameFromHomeFamily)
            {
                sortPicker.Focus();
            }

            IsLoading = false;
            this.Content.IsEnabled = true;

            if (cameFromHomeSearch)
            {
                SearchFromHome(searchPage);
            }

            if (cameFromHomeFavorites)
            {
                FilterPlantsByFavorites();
            }

            cameFromHomeFamily    = false;
            cameFromHomeSearch    = false;
            cameFromHomeFavorites = false;

            //gridLayout.Children.RemoveAt(0);
            gridLayout.Children.Add(BackImageConstructor(cameFromSearch, searchPage), 0, 0);
        }
Пример #23
0
 public override void Focus()
 {
     Picker.Focus();
 }
Пример #24
0
 protected override void OnTapped()
 {
     base.OnTapped();
     Picker.Focus();
 }
Пример #25
0
        /// <summary>
        /// Enter Student Mark Layout.
        /// </summary>
        public void EnterStudentMarkLayout()
        {
            TitleBar    lblPageName = new TitleBar("Enter Student Mark");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStandardDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStandard = new Label {
                TextColor = Color.Black, Text = "Standard"
            };
            Picker pcrStandard = new Picker {
                IsVisible = false, Title = "Standard"
            };

            foreach (StandardModel item in _StandardList)
            {
                pcrStandard.Items.Add(item.Name);
            }

            StackLayout slStandardDisplay = new StackLayout {
                Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStandard = new Frame
            {
                Content           = slStandardDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var standardTap = new TapGestureRecognizer();

            standardTap.NumberOfTapsRequired = 1; // single-tap
            standardTap.Tapped += (s, e) =>
            {
                pcrStandard.Focus();
            };
            frmStandard.GestureRecognizers.Add(standardTap);
            slStandardDisplay.GestureRecognizers.Add(standardTap);

            StackLayout slStandardFrameLayout = new StackLayout
            {
                Children = { frmStandard }
            };

            StackLayout slStandardLayout = new StackLayout
            {
                Children          = { slStandardFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Image imgExamTypeDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblExamType = new Label {
                TextColor = Color.Black, Text = "Exam Type"
            };
            Picker pcrExamType = new Picker {
                IsVisible = false, Title = "Exam Type"
            };

            StackLayout slExamTypeDisplay = new StackLayout {
                Children = { lblExamType, pcrExamType, imgExamTypeDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmExamType = new Frame
            {
                Content           = slExamTypeDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var examTypeTap = new TapGestureRecognizer();

            examTypeTap.NumberOfTapsRequired = 1; // single-tap
            examTypeTap.Tapped += (s, e) =>
            {
                pcrExamType.Focus();
            };
            frmExamType.GestureRecognizers.Add(examTypeTap);
            slExamTypeDisplay.GestureRecognizers.Add(examTypeTap);

            StackLayout slExamTypeFrmaeLayout = new StackLayout
            {
                Children = { frmExamType }
            };

            StackLayout slExamTypeLayout = new StackLayout
            {
                Children          = { slExamTypeFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            Image imgExamDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblExam = new Label {
                TextColor = Color.Black, Text = "Exam"
            };
            Picker pcrExam = new Picker {
                IsVisible = false, Title = "Exam"
            };

            StackLayout slExamDisplay = new StackLayout {
                Children = { lblExam, pcrExam, imgExamDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmExam = new Frame
            {
                Content           = slExamDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var examTap = new TapGestureRecognizer();

            examTap.NumberOfTapsRequired = 1; // single-tap
            examTap.Tapped += (s, e) =>
            {
                pcrExam.Focus();
            };
            frmExam.GestureRecognizers.Add(examTap);
            slExamDisplay.GestureRecognizers.Add(examTap);

            StackLayout slExamFrmaeLayout = new StackLayout
            {
                Children = { frmExam }
            };

            StackLayout slExamLayout = new StackLayout
            {
                Children          = { slExamFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStandardLayout, slExamTypeLayout, slExamLayout }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //Stanndard Picker Selected
            pcrStandard.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    pcrExam.Items.Clear();
                    pcrExamType.Items.Clear();
                    Items.Clear();

                    string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                    _SelectedStandardID = _StandardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                    _ExamTypeList = await ExamTypeModel.GetExamType();

                    if (_ExamTypeList.Count > 0 && _ExamTypeList != null)
                    {
                        slExamLayout.IsVisible  = true;
                        _NotAvailData.IsVisible = false;
                    }
                    else
                    {
                        slExamLayout.IsVisible  = false;
                        _NotAvailData.IsVisible = true;
                    }

                    foreach (ExamTypeModel item in _ExamTypeList)
                    {
                        pcrExam.Items.Add(item.Name);
                    }

                    _Loader.IsShowLoading = false;
                });
            };

            pcrExam.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    Items.Clear();

                    string ExamName = lblExam.Text = pcrExam.Items[pcrExam.SelectedIndex];
                    _SelectedExamID = _ExamTypeList.FirstOrDefault(x => x.Name == ExamName).Id;
                });
            };

            //List view
            ListView StudentListView = new ListView
            {
                RowHeight      = 50,
                SeparatorColor = Color.Gray
            };

            StudentListView.ItemsSource  = Items;
            StudentListView.ItemTemplate = new DataTemplate(() => new StudentExamMarksCell());

            //Grid Header Layout
            Label lblAttendance = new Label
            {
                Text      = "Attendance",
                TextColor = Color.Black
            };

            StackLayout slAttendance = new StackLayout
            {
                Children          = { lblAttendance },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            Label lblStudent = new Label
            {
                Text      = "Student",
                TextColor = Color.Black
            };

            StackLayout slStudentName = new StackLayout
            {
                Children          = { lblStudent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            Label lblIsPresent = new Label
            {
                Text      = "A/P",
                TextColor = Color.Black
            };

            StackLayout slExamMarks = new StackLayout
            {
                Children          = { lblIsPresent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            StackLayout grid = new StackLayout
            {
                Children    = { slAttendance, slStudentName, slExamMarks },
                Orientation = StackOrientation.Horizontal,
                IsVisible   = false
            };

            Seperator spDisplayHeader = new Seperator();

            Button btnSave = new Button();

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;

                    SaveStudentMarksMaster saveStudentMarksMaster = new SaveStudentMarksMaster();

                    //fillupAttendanceModel.StandardId = _SelectedStandardID;
                    //fillupAttendanceModel.ClassTypeId = _SelectedClassTypeID;
                    //fillupAttendanceModel.Date = Convert.ToDateTime(lblCurrentDate.Text).ToString("dd/MM/yyyy");
                    //fillupAttendanceModel.Students = Items.ToList();

                    bool isSaveAttendance = await SaveStudentMarksMaster.SaveStudentMarks(saveStudentMarksMaster);

                    if (isSaveAttendance)
                    {
                        await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                    }
                    else
                    {
                        await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slExamType = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _Loader, _NotAvailData },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slExamType,
            };
        }
Пример #26
0
 // Muestra el picker cuando haces click al "mapItem"
 private void ItemChangePage_Clicked(object sender, EventArgs e)
 {
     pickerChangeMap.Focus();
 }
Пример #27
0
        /// <summary>
        /// Student BehaviourNotice Layout.
        /// </summary>
        public void StudentBehaviourLayout()
        {
            TitleBar    lblPageName = new TitleBar("Student Behaviour Notice");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStandardDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStandard = new Label {
                TextColor = Color.Black, Text = "Standard"
            };
            Picker pcrStandard = new Picker {
                IsVisible = false, Title = "Standard"
            };

            foreach (StandardModel item in _StandardList)
            {
                pcrStandard.Items.Add(item.Name);
            }

            StackLayout slStandardDisplay = new StackLayout {
                Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStandard = new Frame
            {
                Content           = slStandardDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var standardTap = new TapGestureRecognizer();

            standardTap.NumberOfTapsRequired = 1; // single-tap
            standardTap.Tapped += (s, e) =>
            {
                pcrStandard.Focus();
            };
            frmStandard.GestureRecognizers.Add(standardTap);
            slStandardDisplay.GestureRecognizers.Add(standardTap);

            StackLayout slStandardFrameLayout = new StackLayout
            {
                Children = { frmStandard }
            };

            StackLayout slStandardLayout = new StackLayout
            {
                Children          = { slStandardFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Image imgClassDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblClass = new Label {
                TextColor = Color.Black, Text = "Class"
            };
            Picker pcrClass = new Picker {
                IsVisible = false, Title = "Class"
            };

            StackLayout slClassDisplay = new StackLayout {
                Children = { lblClass, pcrClass, imgClassDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmClass = new Frame
            {
                Content           = slClassDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var classTap = new TapGestureRecognizer();

            classTap.NumberOfTapsRequired = 1; // single-tap
            classTap.Tapped += (s, e) =>
            {
                pcrClass.Focus();
            };
            frmClass.GestureRecognizers.Add(classTap);
            slClassDisplay.GestureRecognizers.Add(classTap);

            StackLayout slClassFrmaeLayout = new StackLayout
            {
                Children = { frmClass }
            };

            StackLayout slClassLayout = new StackLayout
            {
                Children          = { slClassFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            Image imgStudentNameDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStudentName = new Label {
                TextColor = Color.Black, Text = "Student Name"
            };
            Picker pcrStudentName = new Picker {
                IsVisible = false, Title = "Student Name"
            };

            StackLayout slStudentNameDisplay = new StackLayout {
                Children = { lblStudentName, pcrStudentName, imgStudentNameDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStudentName = new Frame
            {
                Content           = slStudentNameDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var studentNameTap = new TapGestureRecognizer();

            studentNameTap.NumberOfTapsRequired = 1; // single-tap
            studentNameTap.Tapped += (s, e) =>
            {
                pcrStudentName.Focus();
            };
            frmStudentName.GestureRecognizers.Add(studentNameTap);
            slStudentNameDisplay.GestureRecognizers.Add(studentNameTap);

            StackLayout slStudentNameFrmaeLayout = new StackLayout
            {
                Children = { frmStudentName }
            };

            StackLayout slStudentNameLayout = new StackLayout
            {
                Children          = { slStudentNameFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            //ExtendedEntry txtComment = new ExtendedEntry
            //{
            //    Placeholder = "Comment",
            //    TextColor = Color.Black
            //};

            Label lblComment = new Label
            {
                Text      = "Comment",
                TextColor = Color.Black
            };

            StackLayout slLableComment = new StackLayout
            {
                Children = { lblComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            Editor txtComment = new Editor
            {
                HeightRequest   = 80,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slTextComment = new StackLayout
            {
                Children = { txtComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            //txtComment.Focused += (sender, e) =>
            //{
            //    if (txtComment.Text == "Comment")
            //    {
            //        txtComment.Text = string.Empty;
            //        //txtComment.TextColor = Color.Black;
            //    }
            //};

            StackLayout slComment = new StackLayout
            {
                Children          = { slLableComment, slTextComment },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            StackLayout slSearchinOneCol = new StackLayout
            {
                Children    = { slStandardLayout, slClassLayout },
                Orientation = StackOrientation.Horizontal
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStudentNameLayout, slComment }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //Stanndard Picker Selected
            pcrStandard.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    pcrClass.Items.Clear();
                    pcrStudentName.Items.Clear();

                    string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                    _SelectedStandardID = _StandardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                    _ClassTypeList = await ClassTypeModel.GetClassType(_SelectedStandardID);

                    if (_ClassTypeList.Count > 0 && _ClassTypeList != null)
                    {
                        slClassLayout.IsVisible = true;
                        _NotAvailData.IsVisible = false;
                    }
                    else
                    {
                        _NotAvailData.IsVisible = true;
                    }

                    foreach (ClassTypeModel item in _ClassTypeList)
                    {
                        pcrClass.Items.Add(item.Name);
                    }

                    _Loader.IsShowLoading = false;
                });
            };

            //Class Picker Selected

            pcrClass.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    pcrStudentName.Items.Clear();

                    string className = lblClass.Text = pcrClass.Items[pcrClass.SelectedIndex];

                    _SelectedClassTypeID = _ClassTypeList.FirstOrDefault(x => x.Name == className).Id;

                    List <StudentModel> lstStudentList = await StudentModel.GetStudent(_SelectedStandardID, _SelectedClassTypeID);

                    if (lstStudentList != null && lstStudentList.Count > 0)
                    {
                        slStudentNameLayout.IsVisible = true;
                        _NotAvailData.IsVisible       = false;

                        foreach (StudentModel item in _StudentModelList)
                        {
                            pcrStudentName.Items.Add(item.Name);
                        }
                    }
                    else
                    {
                        _NotAvailData.Text      = "There is no student for this class and standard";
                        _NotAvailData.IsVisible = true;
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            Button btnSave = new Button {
                IsVisible = false
            };

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            pcrStudentName.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    //btnSave.IsVisible = true;
                    string studentName = lblStudentName.Text = pcrStudentName.Items[pcrStudentName.SelectedIndex];

                    _SelectedStudentID = _StudentModelList.FirstOrDefault(x => x.Name == studentName).Id;

                    //Exam list call
                    slStudentNameLayout.IsVisible = true;
                });
            };

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;

                    StudentBehaviourNoticeModel studentBehaviourNoticeModel = new StudentBehaviourNoticeModel();
                    studentBehaviourNoticeModel.ClassTypeId = _SelectedClassTypeID;
                    studentBehaviourNoticeModel.StandardId  = _SelectedStandardID;
                    studentBehaviourNoticeModel.StudentId   = _SelectedStudentID;
                    studentBehaviourNoticeModel.Comment     = txtComment.Text;

                    bool isSaveAttendance = await StudentBehaviourNoticeModel.SaveStudentBehaviour(studentBehaviourNoticeModel);

                    if (isSaveAttendance)
                    {
                        await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                    }
                    else
                    {
                        await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slStudentBehaviourNotice = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchinOneCol, slSearchLayout, _Loader, cvBtnSave, _NotAvailData },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slStudentBehaviourNotice,
            };
        }
Пример #28
0
        protected override void Init()
        {
            var picker = new Picker {
                Items = { "One", "Two", "Three" }
            };
            var pickerBtn = new Button
            {
                Text         = "Click me to call .Focus on Picker",
                AutomationId = "btnFocus"
            };

            pickerBtn.Clicked += (sender, args) =>
            {
                picker.Focus();
            };

            var pickerBtn2 = new Button
            {
                Text         = "Click me to call .Unfocus on Picker",
                AutomationId = "btnUnFocus"
            };

            pickerBtn2.Clicked += (sender, args) =>
            {
                picker.Unfocus();
            };

            var pickerBtn3 = new Button
            {
                Text    = "Click me to .Focus () picker, wait 2 seconds, and .Unfocus () picker",
                Command = new Command(async() =>
                {
                    picker.Focus();
                    await Task.Delay(2000);
                    picker.Unfocus();
                }),
                AutomationId = "btnFocusThenUnFocus"
            };

            var focusFiredCount   = 0;
            var unfocusFiredCount = 0;

            var focusFiredLabel = new Label {
                Text = "Picker Focused: " + focusFiredCount
            };
            var unfocusedFiredLabel = new Label {
                Text = "Picker UnFocused: " + unfocusFiredCount
            };

            picker.Focused += (s, e) =>
            {
                focusFiredCount++;
                focusFiredLabel.Text = "Picker Focused: " + focusFiredCount;
            };
            picker.Unfocused += (s, e) =>
            {
                unfocusFiredCount++;
                unfocusedFiredLabel.Text = "Picker UnFocused: " + unfocusFiredCount;
            };

            Content = new StackLayout
            {
                Children =
                {
                    focusFiredLabel,
                    unfocusedFiredLabel,
                    pickerBtn,
                    pickerBtn2,
                    pickerBtn3,
                    picker
                }
            };
        }
Пример #29
0
        private async void AddProject(object sender, EventArgs e)
        {
            Button btn = sender as Button;

            btn.IsEnabled = false;
            Dictionary <string, Project> ProjectDictionary = new Dictionary <string, Project>();
            List <Project> projects = await ApiService.Account.Projects();

            foreach (Project p in projects)
            {
                ProjectDictionary.Add(p.Title, p);
            }

            Picker picker = new Picker()
            {
                Title = "Projectes personals"
            };

            foreach (string key in ProjectDictionary.Keys)
            {
                picker.Items.Add(key);
            }

            ForumStackLayout.Children.Add(picker);

            picker.Focus();

            picker.SelectedIndexChanged += (send, args) =>
            {
                if (picker.SelectedIndex == -1)
                {
                    return;
                }
                else
                {
                    string  projectTitle    = picker.Items[picker.SelectedIndex];
                    Project projectSelected = ProjectDictionary[projectTitle];

                    Button confirm = new Button()
                    {
                        Text            = "Confirmar",
                        BackgroundColor = Color.ForestGreen
                    };

                    ForumStackLayout.Children.Add(confirm);

                    confirm.Clicked += async(s, a) =>
                    {
                        SubscriptionViewModel subscription = new SubscriptionViewModel()
                        {
                            ForumId   = Model.Id.ToString(),
                            ProjectId = projectSelected.Id.ToString()
                        };

                        var result = await ApiService.Forums.AddProjectToForum(subscription);

                        if (result.IsSuccess)
                        {
                            Alert.Send("Projecte afegit correctament");
                            ForumStackLayout.Children.Remove(confirm);
                            ForumStackLayout.Children.Remove(picker);
                            btn.IsEnabled          = true;
                            AddProjectButtonTapped = false;
                        }
                        else
                        {
                            Alert.Send("Error al afegir projecte al fòrum");
                            btn.IsEnabled = true;
                        }
                    };
                }
            };
        }
Пример #30
0
        public PolicyPage()
        {
            page.Title = "PDFViewer Sample";
            InitializeComponent();

            pageNumberEntry.Completed       += pageNumberEntry_Completed;
            pageNumberEntry.Focused         += pageNumberEntry_Focused;
            pdfViewerControl.PageChanged    += PdfViewerControl_PageChanged;
            pdfViewerControl.DocumentLoaded += PdfViewerControl_DocumentLoaded;
            goToNextButton.Clicked          += goToNextButton_Clicked;
            goToPreviousButton.Clicked      += goToPreviousButton_Clicked;
            toolbar.IsVisible                       = true;
            searchBar.IsVisible                     = false;
            searchButton.Clicked                   += OnSearchIconClicked;
            backIcon.Clicked                       += OnBackIconClicked;
            textSearchEntry.PlaceholderColor        = Color.FromRgb(189, 189, 189);
            textSearchEntry.TextColor               = Color.FromRgb(103, 103, 103);
            textSearchEntry.HorizontalTextAlignment = TextAlignment.Start;
            textSearchEntry.Placeholder             = "Search Text";
            //toolbar.WidthRequest = Application.Current.MainPage.Width;
            //searchBar.WidthRequest = Application.Current.MainPage.Width;
            textSearchEntry.TextChanged      += TextField_TextChanged;
            textSearchEntry.Completed        += TextSearchEntry_Completed;
            showFileBtn.Clicked              += ShowFileBtn_Clicked;
            pdfViewerControl.SearchCompleted += PdfViewerControl_SearchCompleted;
            documentBackup = "Anti-BullyingPolicy";
            documentIndex  = 1;
            pdfViewerControl.InputFileStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("AlphaThea.Content." + documentBackup + ".pdf");
            picker = new Picker();
            this.picker.Items.Add("Anti-BullyingPolicy");
            this.picker.Items.Add("FirstAidPolicy");
            this.picker.Items.Add("HarassmentandBullyingPolicy");
            this.picker.SelectedIndexChanged += Picker_SelectedIndexChanged;

            if (Device.RuntimePlatform != Device.Windows)
            {
                popupLayout.WidthRequest      = 0;
                popupLayout.HeightRequest     = 0;
                popupLayout.HorizontalOptions = LayoutOptions.Start;
                popupLayout.VerticalOptions   = LayoutOptions.Start;
                popupLayout.BackgroundColor   = Color.FromHex("#E9E9E9");
                popupLayout.Children.Add(picker);
                picker.Focus();
                picker.Unfocused     += Picker_Unfocused;
                popupLayout.IsVisible = false;
                mainGrid.Children.Add(popupLayout, 0, 0);
            }
            else
            {
                DocumentsList = new List <Document> {
                    new Document("Anti-BullyingPolicy"), new Document("FirstAidPolicy"), new Document("HarassmentandBullyingPolicy")
                };
                var filesDataTemplate = new DataTemplate(() =>
                {
                    var grid          = new Grid();
                    var fileNameLabel = new Label {
                        TextColor = Color.Black, FontSize = 18, Margin = new Thickness(10, 10)
                    };
                    fileNameLabel.SetBinding(Label.TextProperty, "FileName");
                    grid.Children.Add(fileNameLabel);
                    return(new ViewCell {
                        View = grid
                    });
                });

                ListView fileListView = new ListView {
                    ItemsSource = DocumentsList, ItemTemplate = filesDataTemplate
                };
                fileListView.ItemSelected    += FileListView_ItemSelected;
                fileListView.BindingContext   = this;
                popupLayout.WidthRequest      = 280;
                popupLayout.HeightRequest     = 180;
                popupLayout.HorizontalOptions = LayoutOptions.Start;
                popupLayout.VerticalOptions   = LayoutOptions.Start;
                popupLayout.BackgroundColor   = Color.FromHex("#E9E9E9");
                popupLayout.Children.Add(fileListView);
                popupLayout.IsVisible = false;
                mainGrid.Children.Add(popupLayout, 0, 1);
                TapGestureRecognizer gesture = new TapGestureRecognizer();
                gesture.Tapped += gesture_Tapped;
                pdfViewGrid.GestureRecognizers.Add(gesture);
            }
        }
        protected override void Init()
        {
            var stackLayout = new StackLayout
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };

            // DatePicker
            var datePickerButton = new Button
            {
                Text         = "Show DatePicker",
                AutomationId = DatePickerButton
            };

            var datePicker = new DatePicker
            {
                IsVisible = false
            };

            datePickerButton.Clicked += (s, a) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    if (datePicker.IsFocused)
                    {
                        datePicker.Unfocus();
                    }

                    datePicker.Focus();
                });
            };

            // TimePicker
            var timePickerButton = new Button
            {
                Text         = "Show TimePicker",
                AutomationId = TimePickerButton
            };

            var timePicker = new TimePicker
            {
                IsVisible = false
            };

            timePickerButton.Clicked += (s, a) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    if (timePicker.IsFocused)
                    {
                        timePicker.Unfocus();
                    }

                    timePicker.Focus();
                });
            };

            // Picker
            var pickerButton = new Button
            {
                Text         = "Show Picker",
                AutomationId = PickerButton
            };

            var picker = new Picker
            {
                IsVisible   = false,
                ItemsSource = _pickerValues
            };

            pickerButton.Clicked += (s, a) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    if (picker.IsFocused)
                    {
                        picker.Unfocus();
                    }

                    picker.Focus();
                });
            };

            stackLayout.Children.Add(datePickerButton);
            stackLayout.Children.Add(datePicker);

            stackLayout.Children.Add(timePickerButton);
            stackLayout.Children.Add(timePicker);

            stackLayout.Children.Add(pickerButton);
            stackLayout.Children.Add(picker);

            Content = stackLayout;
        }