public void Constructor ()
		{
			var tap = new TapGestureRecognizer ();

			Assert.AreEqual (null, tap.Command);
			Assert.AreEqual (null, tap.CommandParameter);
			Assert.AreEqual (1, tap.NumberOfTapsRequired);
		}
		public void CallbackPassesParameter ()
		{
			var view = new View ();
			var tap = new TapGestureRecognizer ();
			tap.CommandParameter = "Hello";

			object result = null;
			tap.Command = new Command (o => result = o);

			tap.SendTapped (view);
			Assert.AreEqual (result, tap.CommandParameter);
		}
示例#3
0
 private void OnTap(TapGestureRecognizer gesture)
 {
     print("TAP");
     var GO = PickObject(gesture.Position);
     if (GO)
     {
         Debug.Log("ShortTap" + GO.name);
         if (GO.tag == "classic_cell")
             if (OnCellShortTap != null)
                 OnCellShortTap(GO.GetComponent<CellViewClassic>().Model);
         if (GO.tag == "GUI")
             if (OnGUITap != null)
                 OnGUITap(GO);
     }
 }
示例#4
0
		protected override void Init ()
		{
			var instructions = new Label {
				Text = "Tap the frame below. The label with the text 'No taps yet' should change its text to 'Frame was tapped'."
			};
			var frame = new Frame () {};
			var frameLabel = new Label() {Text = "Tap here" };

			frame.Content = new StackLayout() {Children = { frameLabel }};

			var label = new Label { Text = "No taps yet" };

			var rec = new TapGestureRecognizer { NumberOfTapsRequired = 1 };
			rec.Tapped += (s, e) => { label.Text = "Frame was tapped"; };
			frame.GestureRecognizers.Add (rec);

			Content = new StackLayout {
				Children = { instructions, frame, label }
			};
		}
示例#5
0
		protected override void Init ()
		{
			var taps = new Label { Text = "Taps: 0" };
			var pans = new Label ();
			var pinches = new Label ();

			var pangr = new PanGestureRecognizer ();
			var tapgr = new TapGestureRecognizer ();
			var pinchgr = new PinchGestureRecognizer ();

			var frame = new Frame {
				HasShadow = false,
				HorizontalOptions = LayoutOptions.Fill,
				VerticalOptions = LayoutOptions.Fill,
				BackgroundColor = Color.White,
				Padding = new Thickness (5),
				HeightRequest = 300,
				WidthRequest = 300,
				AutomationId = "frame"
			};

			var tapCount = 0;

			tapgr.Command = new Command (() => {
				tapCount += 1;
				taps.Text = $"Taps: {tapCount}";
			});

			pangr.PanUpdated += (sender, args) => pans.Text = $"Panning: {args.StatusType}";

			pinchgr.PinchUpdated += (sender, args) => pinches.Text = $"Pinching: {args.Status}";

			frame.GestureRecognizers.Add (tapgr);
			frame.GestureRecognizers.Add (pangr);
			frame.GestureRecognizers.Add(pinchgr);

			Content = new StackLayout {
				BackgroundColor = Color.Olive,
				Children = { taps, pans, pinches, frame }
			};
		}
示例#6
0
 public TappableGrid()
 {
     tapRecognizer         = new TapGestureRecognizer();
     tapRecognizer.Tapped += (s, e) => { TappedCommand?.Execute(null); };
     GestureRecognizers.Add(tapRecognizer);
 }
示例#7
0
		public void AddGestureRecognizerSetsParent ()
		{
			var view = new View ();
			var gestureRecognizer = new TapGestureRecognizer ();

			view.GestureRecognizers.Add (gestureRecognizer);

			Assert.AreEqual (view, gestureRecognizer.Parent);
		}
示例#8
0
        /// <summary>
        /// Lists the grid view.
        /// </summary>
        /// <param name="list">The list.</param>
        public void ListGridView(IList <Note> list)
        {
            try
            {
                GridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(350)
                });
                GridLayout.Margin = 5;
                int rowCount = list.Count;
                ////ListView listView = new ListView() { HasUnevenRows = true };
                var productIndex = 0;
                var indexe       = -1;
                //// Iterate a single row at a time to add two notes in one row
                for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
                {
                    //// iterating column to add per note in each column in a single row
                    for (int columnIndex = 0; columnIndex < 1; columnIndex++)
                    {
                        Note data = null;
                        indexe++;

                        //// to maintain the size of array to avoid exception
                        if (indexe < list.Count)
                        {
                            data = list[indexe];
                        }

                        //// Once every note is added in respective column and row than it will break
                        if (productIndex >= list.Count)
                        {
                            break;
                        }

                        productIndex += 1;
                        var index = rowIndex * columnIndex + columnIndex;
                        var label = new Xamarin.Forms.Label
                        {
                            Text              = data.Title,
                            TextColor         = Color.Black,
                            FontAttributes    = FontAttributes.Bold,
                            VerticalOptions   = LayoutOptions.Center,
                            HorizontalOptions = LayoutOptions.Start,
                        };

                        var labelKey = new Xamarin.Forms.Label
                        {
                            Text      = data.Key,
                            IsVisible = false
                        };

                        var content = new Xamarin.Forms.Label
                        {
                            Text              = data.Notes,
                            VerticalOptions   = LayoutOptions.Center,
                            HorizontalOptions = LayoutOptions.Start,
                        };

                        StackLayout layout = new StackLayout()
                        {
                            Spacing = 2,
                            Margin  = 2,
                            //// BackgroundColor = Color.White
                        };
                        var tapGestureRecognizer = new TapGestureRecognizer();
                        layout.Children.Add(labelKey);
                        layout.Children.Add(label);
                        layout.Children.Add(content);
                        layout.GestureRecognizers.Add(tapGestureRecognizer);
                        layout.Spacing = 2;
                        layout.Margin  = 2;
                        ////  layout.BackgroundColor = Color.White;

                        var frame = new Frame();
                        frame.BorderColor  = Color.Black;
                        frame.CornerRadius = 25;
                        FrameColorSetter.GetColor(data, frame);
                        frame.Content = layout;
                        tapGestureRecognizer.Tapped += (object sender, EventArgs args) =>
                        {
                            StackLayout         layout123 = (StackLayout)sender;
                            IList <View>        item      = layout123.Children;
                            Xamarin.Forms.Label KeyValue  = (Xamarin.Forms.Label)item[0];
                            var Keyval = KeyValue.Text;
                            Navigation.PushAsync(new UpdateNote(Keyval));
                        };

                        GridLayout.Children.Add(frame, columnIndex, rowIndex);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#9
0
        /// <summary>
        ///Exam Timetable
        /// </summary>
        public void HomeWorkLayout()
        {
            try
            {
                TitleBar    lblPageName = new TitleBar("Home Work");
                StackLayout slTitle     = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    Padding         = new Thickness(0, 5, 0, 0),
                    BackgroundColor = Color.White,
                    Children        = { lblPageName }
                };

                Seperator spTitle = new Seperator();

                Image imgLectureDropDown = new Image {
                    Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
                };
                Label lblLecture = new Label {
                    TextColor = Color.Black, Text = "Lecture"
                };
                Picker pcrLecture = new Picker {
                    IsVisible = false, Title = "Lecture"
                };

                foreach (LectureModel item in _LectureList)
                {
                    pcrLecture.Items.Add(item.LectureName);
                }

                StackLayout slLectureDisplay = new StackLayout {
                    Children = { lblLecture, pcrLecture, imgLectureDropDown }, 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 frmLecture = new Frame
                {
                    Content           = slLectureDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor      = Color.Black,
                    Padding           = new Thickness(10)
                };

                var lectureTap = new TapGestureRecognizer();

                lectureTap.NumberOfTapsRequired = 1; // single-tap
                lectureTap.Tapped += (s, e) =>
                {
                    pcrLecture.Focus();
                };
                frmLecture.GestureRecognizers.Add(lectureTap);
                slLectureDisplay.GestureRecognizers.Add(lectureTap);

                StackLayout slLectureFrameLayout = new StackLayout
                {
                    Children = { frmLecture }
                };

                StackLayout slLectureLayout = new StackLayout
                {
                    Children          = { slLectureFrameLayout },
                    Orientation       = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };

                Image imgLeftarrow = new Image
                {
                    Source = Constants.ImagePath.ArrowLeft
                };

                Image imgStartDateDropDown = new Image {
                    Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
                };
                Label lblCurrentDate = new Label {
                    TextColor = Color.Black
                };
                lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
                DatePicker dtStartDate = new DatePicker {
                    IsVisible = false
                };

                StackLayout slStartDateDisplay = new StackLayout {
                    Children = { lblCurrentDate, dtStartDate, imgStartDateDropDown }, 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 layout for start date
                Frame frmStartDate = new Frame
                {
                    Content           = slStartDateDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor      = Color.Black,
                    Padding           = new Thickness(10)
                };

                var currentDateTap = new TapGestureRecognizer();

                currentDateTap.NumberOfTapsRequired = 1; // single-tap
                currentDateTap.Tapped += (s, e) =>
                {
                    dtStartDate.Focus();
                };
                frmStartDate.GestureRecognizers.Add(currentDateTap);
                slStartDateDisplay.GestureRecognizers.Add(currentDateTap);

                //dtStartDate.Unfocused += (sender, e) =>
                //    {
                //        if (lblCurrentDate.Text == "Date")
                //        {
                //            lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
                //        }
                //    };

                StackLayout slStartDateFrmaeLayout = new StackLayout
                {
                    Children = { frmStartDate }
                };

                StackLayout slStartDateLayout = new StackLayout
                {
                    Children          = { slStartDateFrmaeLayout },
                    Orientation       = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };

                Image imgRightarrow = new Image
                {
                    Source = Constants.ImagePath.ArrowRight
                };

                StackLayout slDateLayout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 10),
                    Children    = { imgLeftarrow, slStartDateLayout, imgRightarrow },
                    IsVisible   = false
                };

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

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

                _Loader = new LoadingIndicator();

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

                HomeWorkListView.ItemsSource  = Items;
                HomeWorkListView.ItemTemplate = new DataTemplate(() => new ViewAttendanceCell());

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

                StackLayout slHomeWorkLabel = new StackLayout
                {
                    Children          = { lblHomeWork },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand
                };

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

                StackLayout slComment = new StackLayout
                {
                    Children          = { lblComment },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };

                grid = new StackLayout
                {
                    Children    = { slHomeWorkLabel, slComment },
                    Orientation = StackOrientation.Horizontal,
                    IsVisible   = false
                };

                pcrLecture.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        slDateLayout.IsVisible = true;
                        lblCurrentDate.Text    = DateTime.Now.ToString("dd-MM-yy");
                        string lectureName     = lblLecture.Text = pcrLecture.Items[pcrLecture.SelectedIndex];

                        _SelectedLectureID = _LectureList.FirstOrDefault(x => x.LectureName == lectureName).Id;
                    });
                };

                dtStartDate.DateSelected += (s, e) =>
                {
                    Items.Clear();
                    lblCurrentDate.Text = (dtStartDate).Date.ToString("dd-MM-yy");

                    _DateCounter = (dtStartDate).Date.ConvetDatetoDateCounter();

                    LoadData(_DateCounter, _SelectedLectureID);
                };


                //Left button click

                var leftArrowTap = new TapGestureRecognizer();

                leftArrowTap.NumberOfTapsRequired = 1; // single-tap
                leftArrowTap.Tapped += (s, e) =>
                {
                    Items.Clear();
                    _DateCounter        = _DateCounter - 1;
                    lblCurrentDate.Text = _DateCounter.GetDateFromDateCount().ToString("dd-MM-yy");
                    dtStartDate.Date    = _DateCounter.GetDateFromDateCount();

                    LoadData(_DateCounter, _SelectedLectureID);
                };
                imgLeftarrow.GestureRecognizers.Add(leftArrowTap);

                //Right button click

                var rightArrowTap = new TapGestureRecognizer();

                rightArrowTap.NumberOfTapsRequired = 1; // single-tap
                rightArrowTap.Tapped += (s, e) =>
                {
                    Items.Clear();
                    _DateCounter        = _DateCounter + 1;
                    lblCurrentDate.Text = _DateCounter.GetDateFromDateCount().ToString("dd-MM-yy");
                    dtStartDate.Date    = _DateCounter.GetDateFromDateCount();

                    LoadData(_DateCounter, _SelectedLectureID);
                };
                imgRightarrow.GestureRecognizers.Add(rightArrowTap);

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

                Content = new ScrollView
                {
                    Content = slHomeWork,
                };
            }
            catch (Exception ex)
            {
            }
        }
示例#10
0
        public AddTermViews(Term term)
        {
            TermId = term.Id;

            editTermLabel = new Label {
                Text = "Edit Term", HorizontalOptions = LayoutOptions.End, Margin = new Thickness(10, 0)
            };
            addClassLabel = new Label {
                Text = "Add Class", HorizontalOptions = LayoutOptions.End, Margin = new Thickness(10, 15, 0, 5), IsVisible = false
            };

            SCStack = new StackLayout {
                Margin = new Thickness(15, 2, 0, 0)
            };

            using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
            {
                conn.CreateTable <StudentClass>();
                var scList = conn.Table <StudentClass>().ToList();

                foreach (StudentClass sc in scList)
                {
                    if (sc.ForeignTermId == TermId)
                    {
                        StackLayout innerStack = new StackLayout
                        {
                            Orientation = StackOrientation.Horizontal,
                            StyleId     = $"{sc.Id}",
                            Children    =
                            {
                                new Label {
                                    Text = $"{sc.Title}", VerticalOptions = LayoutOptions.CenterAndExpand
                                },
                                new DatePicker
                                {
                                    HorizontalOptions = LayoutOptions.EndAndExpand,
                                    VerticalOptions   = LayoutOptions.Center,
                                    FontSize          = Device.GetNamedSize(NamedSize.Micro, typeof(DatePicker)),
                                    IsEnabled         = false,
                                    Date = sc.StartDate
                                },
                                new Label {
                                    Text = "-", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center
                                },
                                new DatePicker
                                {
                                    HorizontalOptions = LayoutOptions.End,
                                    VerticalOptions   = LayoutOptions.Center,
                                    FontSize          = Device.GetNamedSize(NamedSize.Micro, typeof(DatePicker)),
                                    IsEnabled         = false,
                                    Date = sc.EndDate
                                },
                            }
                        };

                        BoxView divider = new BoxView {
                            Color = Color.FromHex("#002F51"), HeightRequest = 1, Margin = new Thickness(0, 0, 0, 5)
                        };

                        SCStack.Children.Add(innerStack);
                        SCStack.Children.Add(divider);
                    }
                }
            }

            dates = new DateMaker(term.StartDate, term.EndDate);

            termName = new Entry
            {
                Text              = $"{term.Name}",
                FontSize          = Device.GetNamedSize(NamedSize.Title, typeof(Label)),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                IsReadOnly        = true
            };
            previousText = termName.Text;

            deleteTermButt = new Button {
                Text = "Delete", HorizontalOptions = LayoutOptions.StartAndExpand, IsVisible = false
            };
            saveTermButt = new Button {
                Text = "Save", IsVisible = false
            };
            cancelTermButt = new Button {
                Text = "Cancel", IsVisible = false
            };

            layout = new StackLayout
            {
                Margin          = new Thickness(15, 10),
                BackgroundColor = Color.FromHex("#EEE"),
                VerticalOptions = LayoutOptions.Start,
                Children        =
                {
                    new StackLayout
                    {
                        Margin          = new Thickness(15, 10),
                        VerticalOptions = LayoutOptions.Start,
                        Children        =
                        {
                            editTermLabel,
                            new StackLayout
                            {
                                Orientation = StackOrientation.Horizontal,
                                Children    =
                                {
                                    termName,
                                    dates.GetStart(),
                                    new Label {
                                        Text = "-",  HorizontalOptions= LayoutOptions.End, VerticalOptions = LayoutOptions.Center
                                    },
                                    dates.GetEnd()
                                }
                            },
                            new BoxView
                            {
                                Color         = Color.FromHex("#002F51"),
                                HeightRequest = 3,
                                Margin        = new Thickness(0,                        5)
                            },
                            SCStack,
                            addClassLabel,
                            new StackLayout
                            {
                                Orientation = StackOrientation.Horizontal,
                                Children    =
                                {
                                    deleteTermButt,
                                    saveTermButt,
                                    cancelTermButt
                                }
                            }
                        }
                    }
                }
            };


            //Event Initializers

            var editTermClickEvent = new TapGestureRecognizer();

            editTermClickEvent.Tapped += (s, e) => ToggleEditable();
            editTermLabel.GestureRecognizers.Add(editTermClickEvent);

            saveTermButt.Clicked   += SaveTermButton_Clicked;
            cancelTermButt.Clicked += (s, e) => ToggleEditable();
        }
示例#11
0
        public ActivePromotionDetailPage(ActivePromotions item)
        {
            InitializeComponent();

            //  act_promo = item;

            title.Text          = item.name;
            type_val.Text       = item.type;
            proservice_val.Text = item.product;
            startdate_val.Text  = item.start_date;
            enddate_val.Text    = item.end_date;


            //  promoresult = Controller.InstanceCreation().GetSalesData(cus_id);

            if (item.type == "7_total_price_product_filter_by_quantity")
            {
                sevan_totalpricefilter_stack.IsVisible = true;
                sevan_totalListview.ItemsSource        = item.type_list;

                one_dis_on_totorder_stack.IsVisible     = false;
                two_dis_on_cat_stack.IsVisible          = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                six_unitpricefilter_stack.IsVisible     = false;
            }

            else if (item.type == "6_price_filter_quantity")
            {
                six_unitpricefilter_stack.IsVisible = true;
                six_unitpriceListview.ItemsSource   = item.type_list;

                one_dis_on_totorder_stack.IsVisible     = false;
                two_dis_on_cat_stack.IsVisible          = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else if (item.type == "5_pack_free_gift")
            {
                five_bypackfree_stack.IsVisible     = true;
                fiveaaa_bypackfree2_stack.IsVisible = true;

                five_bypackfreeListview.ItemsSource = item.list1;
                bypackfreeListview2.ItemsSource     = item.list2;

                five_bypackfreeListview.HeightRequest = item.list1.Count * 50;
                bypackfreeListview2.HeightRequest     = item.list2.Count * 50;

                one_dis_on_totorder_stack.IsVisible     = false;
                two_dis_on_cat_stack.IsVisible          = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                six_unitpricefilter_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else if (item.type == "4_pack_discount")
            {
                four_bypackdiscount_stack.IsVisible     = true;
                fouraaa_bypackdiscount2_stack.IsVisible = true;

                four_bypackdiscountListview.ItemsSource  = item.list1;
                four_bypackdiscountListview2.ItemsSource = item.list2;

                four_bypackdiscountListview.HeightRequest  = item.list1.Count * 50;
                four_bypackdiscountListview2.HeightRequest = item.list2.Count * 50;

                one_dis_on_totorder_stack.IsVisible    = false;
                two_dis_on_cat_stack.IsVisible         = false;
                three_dis_by_quan_stack.IsVisible      = false;
                five_bypackfree_stack.IsVisible        = false;
                fiveaaa_bypackfree2_stack.IsVisible    = false;
                six_unitpricefilter_stack.IsVisible    = false;
                sevan_totalpricefilter_stack.IsVisible = false;
            }

            else if (item.type == "3_discount_by_quantity_of_product")
            {
                three_dis_by_quan_stack.IsVisible = true;

                three_dis_by_quanListview.ItemsSource = item.type_list;

                one_dis_on_totorder_stack.IsVisible = false;
                two_dis_on_cat_stack.IsVisible      = false;

                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                six_unitpricefilter_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else if (item.type == "2_discount_category")
            {
                two_dis_on_cat_stack.IsVisible     = true;
                two_dis_on_catListview.ItemsSource = item.type_list;

                one_dis_on_totorder_stack.IsVisible     = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                six_unitpricefilter_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else if (item.type == "1_discount_total_order")
            {
                one_dis_on_totorder_stack.IsVisible     = true;
                one_dis_on_totorderListview.ItemsSource = item.type_list;

                two_dis_on_cat_stack.IsVisible          = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                six_unitpricefilter_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else
            {
            }

            var backRecognizer = new TapGestureRecognizer();

            backRecognizer.Tapped += (s, e) => {
                PopupNavigation.PopAsync();
                //    Navigation.PopAllPopupAsync();
                //   Navigation.PushAsync(new CalendarPage());
                //  App.Current.MainPage = new MasterPage(new CalendarPage());
            };
            backImg.GestureRecognizers.Add(backRecognizer);
        }
示例#12
0
        protected void AtribuiEventoCapturaFotos()
        {
            try
            {
                //evento para capturar foto
                var tapGestureRecognizerSnapShot = new TapGestureRecognizer();

                //se o dispositivo não possuir camera, desabilita o clique de chamada da opção de foto e
                //informa os procedimentos ao usuario quanto a carga de fotos local (galeria)

                //não possui camera?
                if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
                {
                    //não, então testa se as fotos estão liberadas para serem escolhidas no aparelho pode escolher fotos?
                    if (!CrossMedia.Current.IsPickPhotoSupported)
                    {
                        //não, não pode escolher
                        btSnapshot.Source        = "ic_picture_blocked.png";
                        lblSnapshotGuidance.Text = "NÃO É POSSÍVEL INCLUIR UMA FOTO. MESMO ASSIM VOCÊ PODE CONTINUAR A PUBLICAÇÃO DA SUA OCORRÊNCIA.";
                    }
                    else
                    {
                        //sim, pode escolher
                        btSnapshot.Source        = "ic_picture_gallery.png";
                        lblSnapshotGuidance.Text = "CLIQUE NO ÍCONE AO LADO PARA ESCOLHER UMA FOTO EM SEU DISPOSITIVO.";

                        //ao clicar executa o evento
                        tapGestureRecognizerSnapShot.Tapped += (object sender, EventArgs e) => {
                            PickPhotoFromGallery();
                        };

                        //adiciona evento a imagem
                        btSnapshot.GestureRecognizers.Add(tapGestureRecognizerSnapShot);
                    }
                }
                else
                {
                    //possui camera
                    tapGestureRecognizerSnapShot.Tapped += async(object sender, EventArgs e) => {
                        //variavel para retenção da resposta
                        string result = string.Empty;

                        // é permitido escolher foto na galeria também?
                        if (CrossMedia.Current.IsPickPhotoSupported)
                        {
                            //sim, pode escolher, então mostra um pop up com as opções para captura de foto
                            result = await DisplayActionSheet("TaVazando - Foto", "Fechar", "", new string[] { "Nova Foto", "Escolher na Galeria" });
                        }
                        else
                        {
                            //não, não pode
                            result = "nova foto";
                        }

                        //testa resultado
                        if (!string.IsNullOrEmpty(result) && result.ToLower().Equals("nova foto"))
                        {
                            //cria objeto de midia
                            Media.Plugin.Abstractions.StoreCameraMediaOptions options = new Media.Plugin.Abstractions.StoreCameraMediaOptions();

                            //cria novo nome para a imagem utilizando os 10 primeiros digitos de um novo Guid
                            options.Name = string.Format("ocr_{0}", Guid.NewGuid().ToString().Substring(0, 10));

                            //ativa a camera
                            Media.Plugin.Abstractions.MediaFile photo = await CrossMedia.Current.TakePhotoAsync(options);

                            Sessao.OcorrenciaAtiva.CaminhoImage = photo.Path;
                            Sessao.OcorrenciaAtiva.NomeImagem   = options.Name;
                            Sessao.OcorrenciaAtiva.Image        = photo;
                            ApplyPhoto();
                        }
                        else
                        {
                            //escolhe foto diretamente do celular
                            PickPhotoFromGallery();
                        }
                    };

                    btSnapshot.GestureRecognizers.Add(tapGestureRecognizerSnapShot);
                }
            }
            catch (Exception ex)
            {
                DisplayLog(ex.Message);
                DisplayLog(string.Format("{0} : {1}", "AtribuiEventoCapturaFotos", ex.Message));
            }
        }
示例#13
0
        protected void AtribuiEventoAbrirTipoOcorrencia()
        {
            try
            {
//				//cria um novo controlador de reconhecimento de toque
                var tapGestureRecognizer = new TapGestureRecognizer();
//
//				//cria o evento
                tapGestureRecognizer.Tapped += (object s, EventArgs ev) => {
                    //AbreListaTipoOcorrencia ();

                    XLabs.Forms.Controls.PopupLayout _PopUpLayout = new XLabs.Forms.Controls.PopupLayout();

                    ListView lstOcorrencias = new ListView();
                    lstOcorrencias.Style          = (Style)Application.Current.Resources ["list_view"];
                    lstOcorrencias.ItemsSource    = Sessao.Ocorrencias;
                    lstOcorrencias.ItemTemplate   = new DataTemplate(typeof(ListViewCell));
                    lstOcorrencias.SeparatorColor = Color.FromHex(theme.COLOR_GREY_LIGHT);
                    lstOcorrencias.HasUnevenRows  = true;
                    lstOcorrencias.ItemSelected  += (object sender, SelectedItemChangedEventArgs e) =>
                    {
                        Sessao.OcorrenciaAtiva.TipoOcorrencia = ((TipoOcorrencia)e.SelectedItem);
                        Application.Current.MainPage          = new NavigationPage(new frmMain());

                        if (_PopUpLayout.IsPopupActive)
                        {
                            _PopUpLayout.DismissPopup();
                        }

                        ctrlPopup.IsVisible   = false;
                        btnPublicar.IsVisible = true;
                        controls.IsVisible    = true;
                    };


                    StackLayout header = new StackLayout();
                    header.Style       = (Style)Application.Current.Resources ["dynamic_toolbar"];
                    header.Padding     = 10;
                    header.Spacing     = 10;
                    header.Orientation = StackOrientation.Horizontal;
                    header.Children.Add(new Image()
                    {
                        Style = (Style)Application.Current.Resources ["toolbar_icon"]
                    });
                    header.Children.Add(new Label()
                    {
                        Style = (Style)Application.Current.Resources ["toolbar_text"], Text = "Tipos de Ocorrência"
                    });

                    StackLayout PopUp = new StackLayout
                    {
                        WidthRequest    = this.Width,                      // Important, the Popup hast to have a size to be showed
                        HeightRequest   = this.Height,
                        BackgroundColor = Color.White,                     // for Android and WP
                        Orientation     = StackOrientation.Vertical,
                        Padding         = 0,
                        Spacing         = 10,
                        Children        =
                        {
                            header,                             // my Label on top
                            lstOcorrencias                      // The Listview (all Cities/Zip-Codes in the Datasurce -> List)
                        }
                    };

                    ctrlPopup.Children.Add(PopUp);
                    ctrlPopup.IsVisible   = true;
                    btnPublicar.IsVisible = false;
                    controls.IsVisible    = false;

                    _PopUpLayout.Content = ctrlPopup;
                    _PopUpLayout.ShowPopup(PopUp);
                };

                //adiciona o evento ao controle de interface grafica
                btSeletor.GestureRecognizers.Add(tapGestureRecognizer);
                clickArea.GestureRecognizers.Add(tapGestureRecognizer);
            }
            catch (Exception ex)
            {
                DisplayLog(string.Format("{0} : {1}", "AtribuiEventoAbrirTipoOcorrencia", ex.Message));
            }
        }
示例#14
0
        public void Init()
        {
            Password = new Label
            {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                Margin   = new Thickness(15, 40, 15, 40),
                HorizontalTextAlignment = TextAlignment.Center,
                FontFamily      = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier"),
                LineBreakMode   = LineBreakMode.TailTruncation,
                VerticalOptions = LayoutOptions.Start,
                TextColor       = Color.Black
            };

            Tgr = new TapGestureRecognizer();
            Password.GestureRecognizers.Add(Tgr);
            Password.SetBinding(Label.TextProperty, nameof(PasswordGeneratorPageModel.Password));

            SliderCell = new SliderViewCell(this, _passwordGenerationService, _settings);

            var buttonColor = Color.FromHex("3c8dbc");

            RegenerateCell = new ExtendedTextCell {
                Text = AppResources.RegeneratePassword, TextColor = buttonColor
            };
            CopyCell = new ExtendedTextCell {
                Text = AppResources.CopyPassword, TextColor = buttonColor
            };

            UppercaseCell = new ExtendedSwitchCell
            {
                Text = "A-Z",
                On   = _settings.GetValueOrDefault(Constants.PasswordGeneratorUppercase, true)
            };

            LowercaseCell = new ExtendedSwitchCell
            {
                Text = "a-z",
                On   = _settings.GetValueOrDefault(Constants.PasswordGeneratorLowercase, true)
            };

            SpecialCell = new ExtendedSwitchCell
            {
                Text = "!@#$%^&*",
                On   = _settings.GetValueOrDefault(Constants.PasswordGeneratorSpecial, true)
            };

            NumbersCell = new ExtendedSwitchCell
            {
                Text = "0-9",
                On   = _settings.GetValueOrDefault(Constants.PasswordGeneratorNumbers, true)
            };

            AvoidAmbiguousCell = new ExtendedSwitchCell
            {
                Text = AppResources.AvoidAmbiguousCharacters,
                On   = !_settings.GetValueOrDefault(Constants.PasswordGeneratorAmbiguous, false)
            };

            NumbersMinCell = new StepperCell(AppResources.MinNumbers,
                                             _settings.GetValueOrDefault(Constants.PasswordGeneratorMinNumbers, 1), 0, 5, 1, () =>
            {
                _settings.AddOrUpdateValue(Constants.PasswordGeneratorMinNumbers,
                                           Convert.ToInt32(NumbersMinCell.Stepper.Value));
                Model.Password = _passwordGenerationService.GeneratePassword();
            });

            SpecialMinCell = new StepperCell(AppResources.MinSpecial,
                                             _settings.GetValueOrDefault(Constants.PasswordGeneratorMinSpecial, 1), 0, 5, 1, () =>
            {
                _settings.AddOrUpdateValue(Constants.PasswordGeneratorMinSpecial,
                                           Convert.ToInt32(SpecialMinCell.Stepper.Value));
                Model.Password = _passwordGenerationService.GeneratePassword();
            });

            var table = new ExtendedTableView
            {
                VerticalOptions = LayoutOptions.Start,
                EnableScrolling = false,
                Intent          = TableIntent.Settings,
                HasUnevenRows   = true,
                NoHeader        = true,
                Root            = new TableRoot
                {
                    new TableSection(Helpers.GetEmptyTableSectionTitle())
                    {
                        RegenerateCell,
                        CopyCell
                    },
                    new TableSection(AppResources.Options)
                    {
                        SliderCell,
                        UppercaseCell,
                        LowercaseCell,
                        NumbersCell,
                        SpecialCell
                    },
                    new TableSection(Helpers.GetEmptyTableSectionTitle())
                    {
                        NumbersMinCell,
                        SpecialMinCell
                    },
                    new TableSection(Helpers.GetEmptyTableSectionTitle())
                    {
                        AvoidAmbiguousCell
                    }
                }
            };

            if (Device.RuntimePlatform == Device.iOS)
            {
                table.RowHeight          = -1;
                table.EstimatedRowHeight = 44;

                if (_passwordValueAction != null)
                {
                    ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
                }
            }

            var stackLayout = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                Children        = { Password, table },
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 0
            };

            var scrollView = new ScrollView
            {
                Content         = stackLayout,
                Orientation     = ScrollOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            if (_passwordValueAction != null)
            {
                var selectToolBarItem = new ToolbarItem(AppResources.Select, Helpers.ToolbarImage("ion_chevron_right.png"), async() =>
                {
                    if (_fromAutofill)
                    {
                        _googleAnalyticsService.TrackExtensionEvent("SelectedGeneratedPassword");
                    }
                    else
                    {
                        _googleAnalyticsService.TrackAppEvent("SelectedGeneratedPassword");
                    }

                    _passwordValueAction(Password.Text);
                    await Navigation.PopForDeviceAsync();
                }, ToolbarItemOrder.Default, 0);

                ToolbarItems.Add(selectToolBarItem);
            }

            Title          = AppResources.PasswordGenerator;
            Content        = scrollView;
            BindingContext = Model;
        }
        /// <summary>
        ///Exam Timetable
        /// </summary>
        public void ExamTimetableLayout()
        {
            try
            {
                TitleBar    lblPageName = new TitleBar("Exam TimeTable");
                StackLayout slTitle     = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    Padding         = new Thickness(0, 5, 0, 0),
                    BackgroundColor = Color.White,
                    Children        = { lblPageName }
                };

                Seperator spTitle = new Seperator();

                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"
                };

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


                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 slExamTypeFrameLayout = new StackLayout
                {
                    Children = { frmExamType }
                };

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

                Image stdExamMasterDropDown = new Image {
                    Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
                };
                Label lblStdExamMaster = new Label {
                    TextColor = Color.Black, Text = "Standard Exam Master"
                };
                Picker pcrStdExamMaster = new Picker {
                    IsVisible = false, Title = "Standard Exam Master"
                };

                StackLayout slStdExamMasterDisplay = new StackLayout {
                    Children = { lblStdExamMaster, pcrStdExamMaster, stdExamMasterDropDown }, 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 frmStdExamMaster = new Frame
                {
                    Content           = slStdExamMasterDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor      = Color.Black,
                    Padding           = new Thickness(10)
                };

                var stdExamMasterTap = new TapGestureRecognizer();

                stdExamMasterTap.NumberOfTapsRequired = 1; // single-tap
                stdExamMasterTap.Tapped += (s, e) =>
                {
                    pcrStdExamMaster.Focus();
                };
                frmStdExamMaster.GestureRecognizers.Add(stdExamMasterTap);
                slStdExamMasterDisplay.GestureRecognizers.Add(stdExamMasterTap);

                StackLayout slStdExamMasterFrameLayout = new StackLayout
                {
                    Children = { frmStdExamMaster }
                };

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

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

                //List view
                ListView ExamTimeTableListView = new ListView
                {
                    RowHeight      = 60,
                    SeparatorColor = Color.Gray
                };

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

                _Loader = new LoadingIndicator();

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

                        string ExamType     = lblExamType.Text = pcrExamType.Items[pcrExamType.SelectedIndex];
                        _SelectedExamTypeID = _ExamTypeList.Where(x => x.Name == ExamType).FirstOrDefault().Id;

                        _StandardExamMasterList = await StandardExamMasterModel.GetStdExamMaster();

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

                        foreach (StandardExamMasterModel item in _StandardExamMasterList)
                        {
                            pcrStdExamMaster.Items.Add(item.Name);
                        }

                        _Loader.IsShowLoading = false;
                    });
                };

                ExamTimeTableListView.ItemTemplate = new DataTemplate(() => new ExamTimeTableCell());

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

                StackLayout slDate = new StackLayout
                {
                    Children          = { lblDate },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand
                };

                Label lblExamName = new Label
                {
                    Text      = "Exam Name",
                    TextColor = Color.Black
                };

                StackLayout slExamName = new StackLayout
                {
                    Children          = { lblExamName },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };

                Label lblTotalMarks = new Label
                {
                    Text      = "Total Marks",
                    TextColor = Color.Black
                };

                StackLayout slTotalMarks = new StackLayout
                {
                    Children          = { lblTotalMarks },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };

                var grid = new Grid {
                    IsVisible = false
                };
                grid.Children.Add(slDate, 0, 0);
                grid.Children.Add(slExamName, 1, 0);
                grid.Children.Add(slTotalMarks, 2, 0);

                Seperator spDisplayHeader = new Seperator {
                    IsVisible = false
                };

                pcrStdExamMaster.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        _Loader.IsShowLoading         = true;
                        string StandardExamMaster     = lblStdExamMaster.Text = pcrStdExamMaster.Items[pcrStdExamMaster.SelectedIndex];
                        _SelectedStandardExamMasterID = _StandardExamMasterList.Where(x => x.Name == StandardExamMaster).FirstOrDefault().Id;

                        int dayStartDateCounter = DateTime.Now.ConvetDatetoDateCounter();

                        int dayEndDateCounter = DateTime.Now.AddMonths(1).ConvetDatetoDateCounter();

                        List <ExamScheduleModel> lstExamSchedule = await ExamScheduleModel.GetExamTimeTable(dayStartDateCounter, dayEndDateCounter, _SelectedExamTypeID, _SelectedStandardExamMasterID);

                        if (lstExamSchedule != null && lstExamSchedule.Count > 0)
                        {
                            _NotAvailData.IsVisible = false;
                            //grid.IsVisible = true;
                            //spDisplayHeader.IsVisible = true;
                            Items = new ObservableCollection <ExamScheduleModel>(lstExamSchedule);

                            ExamTimeTableListView.ItemsSource = Items;
                        }
                        else
                        {
                            _NotAvailData.IsVisible = true;
                            //grid.IsVisible = false;
                            //spDisplayHeader.IsVisible = false;
                        }

                        _Loader.IsShowLoading = false;
                    });
                };

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

                Content = new ScrollView
                {
                    Content = slExamTimeTable,
                };
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        private void ToUser(UserResponse userResponse)
        {
            family.Clear();
            friend.Clear();
            var familyCounter = 1;
            var friendCounter = 1;
            var height1       = 30;
            var height2       = 20;

            if (userResponse.result != null)
            {
                foreach (UserDto dto in userResponse.result)
                {
                    if (dto.user_email_id != null)
                    {
                        user = new Models.User()
                        {
                            FirstName       = dto.user_first_name,
                            LastName        = dto.user_last_name,
                            Email           = dto.user_email_id,
                            HavePic         = DataParser.ToBool(dto.have_pic),
                            PicUrl          = dto.user_picture,
                            MessageCard     = dto.message_card,
                            MessageDay      = dto.message_day,
                            MajorEvents     = dto.user_major_events,
                            MyHistory       = dto.user_history,
                            TimeSettings    = ToTimeSettings(dto),
                            user_birth_date = dto.user_birth_date
                        };
                    }
                    else
                    {
                        var firstName = "";
                        foreach (char a in dto.people_name)
                        {
                            if (a != ' ')
                            {
                                firstName += a;
                            }
                            else
                            {
                                break;
                            }
                        }
                        Person toAdd = new Person()
                        {
                            Name        = firstName,
                            Relation    = dto.relation_type,
                            PicUrl      = dto.ta_picture,
                            Id          = dto.ta_people_id,
                            PhoneNumber = dto.ta_phone
                        };
                        if (toAdd.PicUrl == null || toAdd.PicUrl == "")
                        {
                            toAdd.PicUrl = "aboutme.png";
                        }
                        if (toAdd.Relation == "Family")
                        {
                            //family.Add(toAdd);
                            if (familyCounter <= 5)
                            {
                                var myStack = new StackLayout();
                                myStack.HorizontalOptions = LayoutOptions.Center;
                                myStack.WidthRequest      = 40;
                                myStack.HeightRequest     = 40;

                                var tap = new TapGestureRecognizer();
                                tap.Tapped += TapGestureRecognizer_Tapped_1;
                                myStack.GestureRecognizers.Add(tap);

                                var myFrame = new Frame();
                                myFrame.IsClippedToBounds = true;
                                myFrame.Padding           = 0;
                                myFrame.WidthRequest      = 40;
                                myFrame.HeightRequest     = 40;
                                myFrame.HasShadow         = false;
                                myFrame.CornerRadius      = 20;
                                myFrame.BorderColor       = Color.Black;

                                var myImage = new Image();
                                myImage.Source = toAdd.PicUrl;
                                myImage.Aspect = Aspect.AspectFill;

                                myFrame.Content = myImage;

                                myStack.Children.Add(myFrame);



                                var name = new CustomizeFontLabel();
                                name.HorizontalTextAlignment = TextAlignment.Center;
                                name.Text      = toAdd.Name;
                                name.TextColor = Color.Black;
                                name.FontSize  = 9;

                                myStack.Children.Add(name);

                                var phone = new CustomizeFontLabel();
                                phone.HorizontalTextAlignment = TextAlignment.Center;
                                phone.Text      = toAdd.PhoneNumber;
                                phone.IsVisible = false;

                                myStack.Children.Add(phone);
                                familyMembersList.Children.Add(myStack);
                                //height1 += 60;
                            }
                            familyCounter++;
                        }
                        if (toAdd.Relation == "Friends" || toAdd.Relation == "Friend")
                        {
                            //friend.Add(toAdd);
                            if (friendCounter <= 5)
                            {
                                var myStack = new StackLayout();
                                myStack.HorizontalOptions = LayoutOptions.Center;
                                myStack.WidthRequest      = 40;
                                myStack.HeightRequest     = 40;

                                var tap = new TapGestureRecognizer();
                                tap.Tapped += TapGestureRecognizer_Tapped_2;
                                myStack.GestureRecognizers.Add(tap);

                                var myFrame = new Frame();
                                myFrame.IsClippedToBounds = true;
                                myFrame.Padding           = 0;
                                myFrame.WidthRequest      = 40;
                                myFrame.HeightRequest     = 40;
                                myFrame.HasShadow         = false;
                                myFrame.CornerRadius      = 20;
                                myFrame.BorderColor       = Color.Black;

                                var myImage = new Image();
                                myImage.Source = toAdd.PicUrl;
                                myImage.Aspect = Aspect.AspectFill;

                                myFrame.Content = myImage;

                                myStack.Children.Add(myFrame);



                                var name = new CustomizeFontLabel();
                                name.HorizontalTextAlignment = TextAlignment.Center;
                                name.Text      = toAdd.Name;
                                name.TextColor = Color.Black;
                                name.FontSize  = 9;

                                myStack.Children.Add(name);

                                var phone = new CustomizeFontLabel();
                                phone.HorizontalTextAlignment = TextAlignment.Center;
                                phone.Text      = toAdd.PhoneNumber;
                                phone.IsVisible = false;

                                myStack.Children.Add(phone);
                                friendMembersList.Children.Add(myStack);
                                //height2 += 60;
                            }
                            friendCounter++;
                        }
                    }
                }
                //familyMembersList.ItemsSource = family;
                //friendMembersList.ItemsSource = friend;
                //familyMembersList.HeightRequest = height1;
                //friendMembersList.HeightRequest = height2;
            }
        }
        public OtherPage()
        {
            InitializeComponent();
            var productIndex = 0;

            for (int rowIndex = 0; rowIndex < 4; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < 3; columnIndex++)
                {
                    productIndex += 1;
                    var image = new Image
                    {
                        Source            = ImageSource.FromResource("check_to_travel_xamarin_forms.images.image" + String.Format("{0:D3}", productIndex) + ".png"),
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.Center,
                        WidthRequest      = 80,
                        HeightRequest     = 80,
                    };
                    var label = new Label
                    {
                        HeightRequest     = 100,
                        WidthRequest      = 100,
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.Center,
                        BackgroundColor   = new Color(0, 0, 0),
                    };
                    var tapGestureRecognizer = new TapGestureRecognizer();
                    tapGestureRecognizer.Tapped += async(sender, e) =>
                    {
                        if (label.BackgroundColor.Equals(new Color(0, 0, 0)))
                        {
                            label.BackgroundColor = new Color(100, 100, 100);

                            Person person = new Person()
                            {
                                Name = "TEST PERSON"
                            };

                            //Add New Person
                            await App.SQLiteDb.SaveItemAsync(person);
                            await DisplayAlert("Success", "Person added Successfully", "OK");

                            //Get All Persons
                            var personList = await App.SQLiteDb.GetItemsAsync();

                            foreach (var personObj in personList)
                            {
                                Debug.WriteLine("person ID : " + personObj.PersonID);
                            }
                        }
                        else
                        {
                            label.BackgroundColor = new Color(0, 0, 0);

                            //Get Person
                            var person = await App.SQLiteDb.GetItemAsync(Convert.ToInt32("1"));

                            if (person != null)
                            {
                                //Delete Person
                                await App.SQLiteDb.DeleteItemAsync(person);
                                await DisplayAlert("Success", "Person Deleted", "OK");

                                //Get All Persons
                                var personList = await App.SQLiteDb.GetItemsAsync();

                                foreach (var personObj in personList)
                                {
                                    Debug.WriteLine("person ID : " + personObj.PersonID);
                                }
                            }
                        }
                    };
                    image.GestureRecognizers.Add(tapGestureRecognizer);
                    gridLayout.Children.Add(label, columnIndex, rowIndex);
                    gridLayout.Children.Add(image, columnIndex, rowIndex);
                }
            }
        }
示例#18
0
 protected override void OnAttachedTo(View view)
 {
     tapRecognizer         = new TapGestureRecognizer();
     tapRecognizer.Tapped += OnTapRecognizerTapped;
     view.GestureRecognizers.Add(tapRecognizer);
 }
示例#19
0
        public void LinhaStackLayout(Tarefa tarefa, int index)
        {
            Image Delete = new Image()
            {
                VerticalOptions = LayoutOptions.Center, Source = ImageSource.FromFile("Delete.png")
            };

            if (Device.RuntimePlatform == Device.UWP)
            {
                Delete.Source = ImageSource.FromFile("Resources/Delete.png");
            }
            TapGestureRecognizer DeleteTap = new TapGestureRecognizer();

            DeleteTap.Tapped += delegate
            {
                new GerenciadorTarefa().Deletar(index);
                CarregarTarefas();
            };
            Delete.GestureRecognizers.Add(DeleteTap);


            Image Prioridade = new Image()
            {
                VerticalOptions = LayoutOptions.Center, Source = ImageSource.FromFile("p" + tarefa.Prioridade + ".png")
            };

            if (Device.RuntimePlatform == Device.UWP)
            {
                Prioridade.Source = ImageSource.FromFile("Resources/p" + tarefa.Prioridade + ".png");
            }

            View StackCentral = null;

            if (tarefa.DataFinalizacao == null)
            {
                StackCentral = new Label()
                {
                    VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, Text = tarefa.Nome
                };
            }
            else
            {
                StackCentral = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.Center, Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand
                };
                ((StackLayout)StackCentral).Children.Add(new Label()
                {
                    Text = tarefa.Nome, TextColor = Color.Gray
                });
                ((StackLayout)StackCentral).Children.Add(new Label()
                {
                    Text = "Finalizado em " + tarefa.DataFinalizacao.Value.ToString("dd/MM/yyyy - hh:mm") + "h", TextColor = Color.Gray, FontSize = 10
                });
            }


            Image Check = new Image()
            {
                VerticalOptions = LayoutOptions.Center, Source = ImageSource.FromFile("CheckOff.png")
            };

            if (Device.RuntimePlatform == Device.UWP)
            {
                Check.Source = ImageSource.FromFile("Resources/CheckOff.png");
            }
            if (tarefa.DataFinalizacao != null)
            {
                Check.Source = ImageSource.FromFile("Resources/CheckOn.png");
                if (Device.RuntimePlatform == Device.UWP)
                {
                    Check.Source = ImageSource.FromFile("Resources/CheckOn.png");
                }
            }
            TapGestureRecognizer CheckTap = new TapGestureRecognizer();

            CheckTap.Tapped += delegate
            {
                new GerenciadorTarefa().Finalizar(index, tarefa);;
                CarregarTarefas();
            };
            Check.GestureRecognizers.Add(CheckTap);

            StackLayout Linha = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal, Spacing = 15
            };

            Linha.Children.Add(Check);
            Linha.Children.Add(StackCentral);
            Linha.Children.Add(Prioridade);
            Linha.Children.Add(Delete);

            SLTarefas.Children.Add(Linha);
        }
示例#20
0
        public FormEntryCell(
            string labelText,
            Keyboard entryKeyboard     = null,
            bool isPassword            = false,
            VisualElement nextElement  = null,
            bool useLabelAsPlaceholder = false,
            string imageSource         = null,
            Thickness?containerPadding = null,
            string button1             = null,
            string button2             = null)
        {
            if (!useLabelAsPlaceholder)
            {
                Label = new Label
                {
                    Text              = labelText,
                    FontSize          = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                    Style             = (Style)Application.Current.Resources["text-muted"],
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };
            }

            Entry = new ExtendedEntry
            {
                Keyboard          = entryKeyboard,
                HasBorder         = false,
                IsPassword        = isPassword,
                AllowClear        = true,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                WidthRequest      = 1,
                FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Entry))
            };

            if (useLabelAsPlaceholder)
            {
                Entry.Placeholder = labelText;
            }

            NextElement = nextElement;

            var imageStackLayout = new StackLayout
            {
                Padding           = containerPadding ?? new Thickness(15, 10),
                Orientation       = StackOrientation.Horizontal,
                Spacing           = 10,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            if (imageSource != null)
            {
                _tgr = new TapGestureRecognizer();

                var theImage = new CachedImage
                {
                    Source            = imageSource,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Center,
                    WidthRequest      = 18,
                    HeightRequest     = 18
                };
                theImage.GestureRecognizers.Add(_tgr);

                imageStackLayout.Children.Add(theImage);
            }

            var formStackLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };

            if (!useLabelAsPlaceholder)
            {
                formStackLayout.Children.Add(Label);
            }

            formStackLayout.Children.Add(Entry);
            imageStackLayout.Children.Add(formStackLayout);

            if (!string.IsNullOrWhiteSpace(button1) || !string.IsNullOrWhiteSpace(button2))
            {
                _buttonStackLayout = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    Spacing         = 5
                };
                imageStackLayout.Children.Add(_buttonStackLayout);

                if (!string.IsNullOrWhiteSpace(button1))
                {
                    Button1 = new ExtendedButton {
                        Image = button1
                    };
                    _buttonStackLayout.Children.Add(Button1);
                    Button1.Padding         = new Thickness(0);
                    Button1.BackgroundColor = Color.Transparent;
                    Button1.WidthRequest    = 40;
                    Button1.VerticalOptions = LayoutOptions.FillAndExpand;
                }

                if (!string.IsNullOrWhiteSpace(button2))
                {
                    Button2 = new ExtendedButton {
                        Image = button2
                    };
                    _buttonStackLayout.Children.Add(Button2);
                    Button2.Padding         = new Thickness(0);
                    Button2.BackgroundColor = Color.Transparent;
                    Button2.WidthRequest    = 40;
                    Button2.VerticalOptions = LayoutOptions.FillAndExpand;
                }
            }

            if (Device.RuntimePlatform == Device.Android)
            {
                var deviceInfo = Resolver.Resolve <IDeviceInfoService>();
                if (useLabelAsPlaceholder)
                {
                    if (deviceInfo.Version < 21)
                    {
                        Entry.Margin = new Thickness(-9, 1, -9, 0);
                    }
                    else if (deviceInfo.Version == 21)
                    {
                        Entry.Margin = new Thickness(0, 4, 0, -4);
                    }
                }
                else
                {
                    Entry.AdjustMarginsForDevice();
                }

                if (containerPadding == null)
                {
                    imageStackLayout.AdjustPaddingForDevice();
                }
            }
            else if (Device.RuntimePlatform == Device.UWP)
            {
                if (_buttonStackLayout != null)
                {
                    _buttonStackLayout.Spacing = 0;
                }
            }

            View = imageStackLayout;
        }
示例#21
0
        public ShowAttendancePage()
        {
            //declare here date time picker
            TakeAttendanceViewModel.AttendanceType = UserType.attendanceType.Show;
            _ShowAttendanceViewModel = new TakeAttendanceViewModel();
            try
            {
                double _imageFOBY = 0.9;
                this.Title = "Show Attendance";
                //switch (Device.RuntimePlatform)
                //{
                //    case Device.iOS:
                //        _Toppadding = 5;
                //        break;
                //    default:
                //        _imageFOBY = 0.9;
                //        break;
                //}

                var datePicker = new DatePicker()
                {
                    //Date = DateTime.Now,
                    BackgroundColor   = Color.White,
                    TextColor         = Color.Black,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    Format            = "dd/MMM/yyyy",
                    WidthRequest      = 130
                };
                //datePicker.SetBinding(DatePicker.DateProperty, new Binding("Date"));
                datePicker.Date = _ShowAttendanceViewModel.Date;
                //declare here refresh button
                var refreshButton = new ImageButtonRefresh()
                {
                    Source = ImageSource.FromFile("RefreshIcon.png"),
                    //Margin = new Thickness(15),
                    HorizontalOptions = LayoutOptions.Center,
                    BackgroundColor   = Color.Transparent,
                    Aspect            = Aspect.Fill,
                };
                //declare here total present & total absent
                var totalPresentANDtotalabsent = new Label()
                {
                    Margin            = new Thickness(0, 0, 0, 3),
                    BackgroundColor   = App.BrandColor,
                    TextColor         = Color.White,
                    Text              = "Total Present & Total absent",
                    FontFamily        = App.fontFamilyHead,
                    WidthRequest      = 300,
                    FontSize          = 16,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                };
                totalPresentANDtotalabsent.Text = _ShowAttendanceViewModel.Total;
                //declare here FOB Button
                var FOBButton = new ImageButtonFOB()
                {
                    Source            = ImageSource.FromFile("iconFOB.png"),
                    Margin            = new Thickness(15),
                    VerticalOptions   = LayoutOptions.EndAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand,
                    BackgroundColor   = Color.Transparent,
                    Aspect            = Aspect.Fill,
                    WidthRequest      = 72,
                    HeightRequest     = 72
                };
                var tapgesture = new TapGestureRecognizer();
                tapgesture.Tapped += (sender, e) =>
                {
                    OnImageClicked_ChangeMeals();
                };

                tapgesture.NumberOfTapsRequired = 1;
                FOBButton.GestureRecognizers.Add(tapgesture);

                ListView listView = new ListView()
                {
                    BackgroundColor = Color.DarkGray,
                    HasUnevenRows   = true,
                };
                //IList<ItemCell> _itemList = new List<ItemCell>();
                //_itemList.Add(new ItemCell { ImageUri = "shivam.png", id = "10102", name = "Shivam Singh" ,status="Present" });
                ////_itemList.Add(new ItemCell { ImageUri = "logo.png", id = "10103", name = "Sonu Nagar", status = "Absent" });
                //_itemList.Add(new ItemCell { ImageUri = "workprogress.png", id = "10104", name = "Arun Singh", status = "Present" });

                //listView.ItemsSource = new ObservableCollection<ItemCell>(_itemList);

                listView.ItemsSource = _ShowAttendanceViewModel.StudentListShow;

                listView.ItemTemplate           = new DataTemplate(typeof(NonSelectableViewCell));
                totalPresentANDtotalabsent.Text = Global_Method_Propertise.Static_method.getTotalPresentandAbsentStudent(_ShowAttendanceViewModel.StudentListShow);

                //listView.ItemsSource = listitems;
                listView.IsPullToRefreshEnabled = true;
                listView.VerticalOptions        = LayoutOptions.Fill;
                listView.Refreshing            += OnRefresh;
                listView.ItemTapped            += OnTapped;
                listView.ItemSelected          += OnSelected;

                AbsoluteLayout.SetLayoutFlags(listView, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(listView, Rectangle.FromLTRB(0, 0, 1, 1));

                AbsoluteLayout.SetLayoutFlags(FOBButton, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(FOBButton, new Rectangle(1.0, _imageFOBY, -1, -1));

                var tapgestureRefreshButton = new TapGestureRecognizer();
                tapgestureRefreshButton.Tapped += (sender, e) =>
                {
                    _ShowAttendanceViewModel.Date = datePicker.Date;
                    TakeAttendanceViewModel.bindShowAttendanceData();
                    totalPresentANDtotalabsent.Text = Global_Method_Propertise.Static_method.getTotalPresentandAbsentStudent(_ShowAttendanceViewModel.StudentListShow);
                };
                tapgestureRefreshButton.NumberOfTapsRequired = 1;
                refreshButton.GestureRecognizers.Add(tapgestureRefreshButton);

                var absoluteLayout = new AbsoluteLayout
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Margin          = new Thickness(0, 0, 0, 0),
                    Children        = { listView, FOBButton }
                };

                var grid = new Grid();
                grid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Auto)
                });
                grid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(500, GridUnitType.Star)
                });
                grid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(50, GridUnitType.Star)
                });

                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });


                grid.Children.Add(datePicker, 0, 0);
                Grid.SetColumnSpan(datePicker, 2);
                grid.Children.Add(refreshButton, 1, 0);
                grid.Children.Add(absoluteLayout, 0, 1);
                Grid.SetColumnSpan(absoluteLayout, 2);
                grid.Children.Add(totalPresentANDtotalabsent, 0, 2);
                Grid.SetColumnSpan(totalPresentANDtotalabsent, 2);
                Content = new StackLayout
                {
                    Children =
                    {
                        grid
                    }
                };
            }
            catch (Exception ex)
            {
            }
        }
示例#22
0
        public DisplayShiftPage(DateTime selectedDate)
        {
            InitializeComponent();
            displayVM = new DisplayShiftViewModel(selectedDate)
            {
                Navigation = Navigation
            };
            BindingContext    = displayVM;
            shiftPicker.Title = Resource.ShiftPickerTitle;

            shifts = displayVM.ShiftList;

            foreach (ShiftTable shift in shifts)
            {
                // Format and add shifts to picker
                if (shift.EndDate == null)
                {
                    shift.EndDate = "Current";
                }

                DateTime shiftStart = DateTime.Parse(shift.StartDate);
                DateTime shiftEnd   = DateTime.Parse(shift.EndDate);

                shiftPicker.Items.Add(string.Format("{0:dd/MM}", shiftStart) + ") " + string.Format("{0:hh:mm tt}", shiftStart) + " - " + string.Format("{0:hh:mm tt}", shiftEnd));
            }

            var leftArrow = new ShapeView
            {
                ShapeType         = ShapeType.Triangle,
                Color             = Color.Gray,
                HeightRequest     = 30,
                WidthRequest      = 30,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Rotation          = -90
            };

            leftArrow.SetBinding(ShapeView.IsVisibleProperty, "CanExecuteLeft");

            var leftTapGesture = new TapGestureRecognizer()
            {
                CommandParameter = "Left"
            };

            leftTapGesture.SetBinding(TapGestureRecognizer.CommandProperty, "ChangeShiftLeftCommand");
            leftArrow.GestureRecognizers.Add(leftTapGesture);
            leftBox.GestureRecognizers.Add(leftTapGesture);

            var rightArrow = new ShapeView
            {
                ShapeType         = ShapeType.Triangle,
                Color             = Color.Gray,
                HeightRequest     = 30,
                WidthRequest      = 30,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Rotation          = 90
            };

            rightArrow.SetBinding(ShapeView.IsVisibleProperty, "CanExecuteRight");

            var rightTapGesture = new TapGestureRecognizer()
            {
                CommandParameter = "Right"
            };

            rightTapGesture.SetBinding(TapGestureRecognizer.CommandProperty, "ChangeShiftRightCommand");
            rightArrow.GestureRecognizers.Add(rightTapGesture);
            rightBox.GestureRecognizers.Add(rightTapGesture);

            grid.Children.Add(leftArrow, 0, 0);
            grid.Children.Add(rightArrow, 2, 0);

            shiftPicker.SelectedIndexChanged += ShiftPicker_SelectedIndexChanged;

            MessagingCenter.Subscribe <string, int>("ChangeShift", "ChangeShift", (s, index) =>
            {
                shiftPicker.SelectedIndex = index;
            });
        }
示例#23
0
        public ProductPage(Product product)
        {
            _product = product;
            Title    = "Product";
            var addToCartButton = new Button
            {
                VerticalOptions = LayoutOptions.Start,
                BorderWidth     = 1,
                BorderColor     = Color.Gray,
                Text            = "Add",
                Image           = "cart.png"
            };

            addToCartButton.Clicked += OnAddToCartButtonClicked;
            var productImageTapGestureRecognizer = new TapGestureRecognizer();

            productImageTapGestureRecognizer.Tapped += OnProductImageTap;
            var grid = new Grid
            {
                Padding           = new Thickness(5, 0),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions    = { new RowDefinition {
                                          Height = new GridLength(100)
                                      } },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(100)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(100)
                    }
                }
            };

            grid.Children.Add(new ContentView
            {
                Content = new Image
                {
                    HeightRequest      = 100,
                    WidthRequest       = 100,
                    Source             = ImageSource.FromResource((_product.ImageSource)),
                    GestureRecognizers = { productImageTapGestureRecognizer }
                }
            }, 0, 0);
            grid.Children.Add(new ContentView
            {
                Content = new Label
                {
                    Text              = string.Format("${0:0.00}", _product.Price),
                    TextColor         = Color.Red,
                    FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                }
            }, 1, 0);
            grid.Children.Add(new ContentView
            {
                Content = addToCartButton
            }, 2, 0);
            Content = new StackLayout
            {
                Spacing  = 0,
                Children =
                {
                    new ContentView
                    {
                        Padding = new Thickness(5),
                        Content = new Label
                        {
                            Text     = _product.Name,
                            FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
                        },
                    },
                    grid,
                    new ContentView
                    {
                        VerticalOptions = LayoutOptions.FillAndExpand,
                        Padding         = new Thickness(5),
                        Content         = new InfoView()
                        {
                            CornerRadius    = 10d,
                            StrokeThickness = 1d,
                            Stroke          = Color.Gray,
                            HeaderText      = _product.Name,
                            BodyText        = _product.Description
                        }
                    }
                }
            };
        }
示例#24
0
        public MainPage()
        {
            Grid abs = new Grid();

            for (int i = 0; i < 10; i++)
            {
                abs.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }

            for (int i = 0; i < 5; i++)
            {
                abs.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }

            a2 = new Label {
                BackgroundColor = Color.White, Text = "1"
            };
            abs.Children.Add(a2, 3, 0);
            a3 = new Label {
                BackgroundColor = Color.White, Text = "2"
            };
            abs.Children.Add(a3, 4, 0);
            a4 = new Label {
                BackgroundColor = Color.White, Text = "3"
            };
            abs.Children.Add(a4, 5, 0);
            a5 = new Label {
                BackgroundColor = Color.White, Text = "4"
            };
            abs.Children.Add(a5, 6, 0);
            a6 = new Label {
                BackgroundColor = Color.White, Text = "5"
            };
            abs.Children.Add(a6, 7, 0);
            a7 = new Label {
                BackgroundColor = Color.White, Text = "6"
            };
            abs.Children.Add(a7, 8, 0);
            a8 = new Label {
                BackgroundColor = Color.White, Text = "7"
            };
            abs.Children.Add(a8, 9, 0);
            a9 = new Label {
                BackgroundColor = Color.White, Text = "8"
            };
            abs.Children.Add(a9, 10, 0);
            a10 = new Label {
                BackgroundColor = Color.White, Text = "9"
            };
            abs.Children.Add(a10, 11, 0);


            p1 = new Label {
                BackgroundColor = Color.White, Text = "Понедельник"
            };
            abs.Children.Add(p1, 0, 1);
            Grid.SetColumnSpan(p1, 2);
            p2 = new Label {
                BackgroundColor = Color.White, Text = "Вторник"
            };
            abs.Children.Add(p2, 0, 2);
            Grid.SetColumnSpan(p2, 2);
            p3 = new Label {
                BackgroundColor = Color.White, Text = "Среда"
            };
            abs.Children.Add(p3, 0, 3);
            Grid.SetColumnSpan(p3, 2);
            p4 = new Label {
                BackgroundColor = Color.White, Text = "Четверг"
            };
            abs.Children.Add(p4, 0, 4);
            Grid.SetColumnSpan(p4, 2);
            p5 = new Label {
                BackgroundColor = Color.White, Text = "Пятница"
            };
            abs.Children.Add(p5, 0, 5);
            Grid.SetColumnSpan(p5, 2);


            r1 = new Label {
                BackgroundColor = Color.Green, Text = "Keel ja \n Kirjandus"
            };
            abs.Children.Add(r1, 3, 1);
            Grid.SetColumnSpan(r1, 2);
            var tap = new TapGestureRecognizer();

            tap.Tapped += async(s, e) =>
            {
                r1 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет B221 \n Ljudmilla Mihhailova", "kinni");
            };
            r1.GestureRecognizers.Add(tap);

            r2 = new Label {
                BackgroundColor = Color.DeepPink, Text = "Võrgud ja Seadm."
            };
            abs.Children.Add(r2, 5, 1);
            Grid.SetColumnSpan(r2, 3);
            var tap1 = new TapGestureRecognizer();

            tap1.Tapped += async(s, e) =>
            {
                r2 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет A123 \n Mikhail Agapov", "kinni");
            };
            r2.GestureRecognizers.Add(tap);

            r3 = new Label {
                BackgroundColor = Color.LightBlue, Text = "Mob. Rak."
            };
            abs.Children.Add(r3, 8, 1);
            Grid.SetColumnSpan(r3, 3);
            var tap2 = new TapGestureRecognizer();

            tap2.Tapped += async(s, e) =>
            {
                r3 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет E07 \n Marina Oleinik", "kinni");
            };
            r3.GestureRecognizers.Add(tap);

            r4 = new Label {
                BackgroundColor = Color.LightYellow, Text = "Transp.log.hut."
            };
            abs.Children.Add(r4, 3, 2);
            Grid.SetColumnSpan(r4, 3);
            var tap3 = new TapGestureRecognizer();

            tap3.Tapped += async(s, e) =>
            {
                r4 = (Label)s;
                await DisplayAlert("Дополнительная информация", "B002 \n Jaanus Krull", "kinni");
            };
            r4.GestureRecognizers.Add(tap);

            r5 = new Label {
                BackgroundColor = Color.Gray, Text = "Inglise W.hald"
            };
            abs.Children.Add(r5, 7, 2);
            Grid.SetColumnSpan(r5, 2);
            var tap5 = new TapGestureRecognizer();

            tap5.Tapped += async(s, e) =>
            {
                r5 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет B242 \n Julia Voronovska", "kinni");
            };
            r5.GestureRecognizers.Add(tap);

            r6 = new Label {
                BackgroundColor = Color.DeepPink, Text = "Eesti keel \n teise kellena"
            };
            abs.Children.Add(r6, 9, 2);
            Grid.SetColumnSpan(r6, 2);
            var tap6 = new TapGestureRecognizer();

            tap6.Tapped += async(s, e) =>
            {
                r6 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет B236 \n Alina Laaneväli-Toots", "kinni");
            };
            r6.GestureRecognizers.Add(tap);

            r7 = new Label {
                BackgroundColor = Color.DeepPink, Text = "W.paig.sead."
            };
            abs.Children.Add(r7, 3, 3);
            Grid.SetColumnSpan(r7, 3);
            var tap7 = new TapGestureRecognizer();

            tap7.Tapped += async(s, e) =>
            {
                r7 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет A243 \n Lury Shkarbanova", "kinni");
            };
            r7.GestureRecognizers.Add(tap);

            r8 = new Label {
                BackgroundColor = Color.LightYellow, Text = "Transp.log.hut."
            };
            abs.Children.Add(r8, 6, 3);
            Grid.SetColumnSpan(r8, 5);
            var tap8 = new TapGestureRecognizer();

            tap8.Tapped += async(s, e) =>
            {
                r8 = (Label)s;
                await DisplayAlert("Дополнительная информация", "B002 \n Jaanus Krull", "kinni");
            };
            r8.GestureRecognizers.Add(tap);

            r9 = new Label {
                BackgroundColor = Color.Pink, Text = "Keemia \n Biologia"
            };
            abs.Children.Add(r9, 11, 3);
            var tap9 = new TapGestureRecognizer();

            tap9.Tapped += async(s, e) =>
            {
                r9 = (Label)s;
                await DisplayAlert("Дополнительная информация", "B144 \n Svetlana Pesetskaja", "kinni");
            };
            r9.GestureRecognizers.Add(tap);

            r10 = new Label {
                BackgroundColor = Color.DeepPink, Text = "W.paig.sead."
            };
            abs.Children.Add(r10, 3, 4);
            Grid.SetColumnSpan(r10, 3);
            var tap10 = new TapGestureRecognizer();

            tap10.Tapped += async(s, e) =>
            {
                r10 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет A243 \n Lury Shkarbanova", "kinni");
            };
            r10.GestureRecognizers.Add(tap);

            r11 = new Label {
                BackgroundColor = Color.DeepPink, Text = "Võrgud ja Seadm."
            };
            abs.Children.Add(r11, 7, 4);
            Grid.SetColumnSpan(r11, 2);
            var tap11 = new TapGestureRecognizer();

            tap11.Tapped += async(s, e) =>
            {
                r11 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет A123 \n Mikhail Agapov", "kinni");
            };
            r11.GestureRecognizers.Add(tap);

            r12 = new Label {
                BackgroundColor = Color.Gray, Text = "Inglise W.hald"
            };
            abs.Children.Add(r12, 9, 4);
            Grid.SetColumnSpan(r12, 2);
            var tap12 = new TapGestureRecognizer();

            tap12.Tapped += async(s, e) =>
            {
                r12 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет B242 \n Julia Voronovska", "kinni");
            };
            r12.GestureRecognizers.Add(tap);

            r13 = new Label {
                BackgroundColor = Color.Pink, Text = "Keemia \n Biologia"
            };
            abs.Children.Add(r13, 3, 5);
            var tap13 = new TapGestureRecognizer();

            tap13.Tapped += async(s, e) =>
            {
                r13 = (Label)s;
                await DisplayAlert("Дополнительная информация", "B144 \n Svetlana Pesetskaja", "kinni");
            };
            r13.GestureRecognizers.Add(tap);

            r14 = new Label {
                BackgroundColor = Color.LightBlue, Text = "Mob. Rak."
            };
            abs.Children.Add(r14, 5, 5);
            Grid.SetColumnSpan(r14, 3);
            var tap14 = new TapGestureRecognizer();

            tap14.Tapped += async(s, e) =>
            {
                r14 = (Label)s;
                await DisplayAlert("Дополнительная информация", "Кабинет E07 \n Marina Oleinik", "kinni");
            };
            r14.GestureRecognizers.Add(tap);
            Content = abs;
        }
示例#25
0
        public MainCarousel()
        {
            InitializeComponent();
            //Creating TapGestureRecognizers
            var tapImage1 = new TapGestureRecognizer();
            var tapImage2 = new TapGestureRecognizer();
            var tapImage3 = new TapGestureRecognizer();
            var tapImage4 = new TapGestureRecognizer();
            var tapImage5 = new TapGestureRecognizer();
            var tapImage6 = new TapGestureRecognizer();
            var tapImage7 = new TapGestureRecognizer();

            //Binding events
            tapImage1.Tapped += tapImage_Tapped1;
            tapImage2.Tapped += tapImage_Tapped2;
            tapImage3.Tapped += tapImage_Tapped3;
            tapImage4.Tapped += tapImage_Tapped4;
            tapImage5.Tapped += tapImage_Tapped5;
            tapImage6.Tapped += tapImage_Tapped6;
            tapImage7.Tapped += tapImage_Tapped7;
            //Associating tap events to the image buttons
            clockimg.GestureRecognizers.Add(tapImage1);
            mapsimg.GestureRecognizers.Add(tapImage2);
            calculatorimg.GestureRecognizers.Add(tapImage3);
            cameraimg.GestureRecognizers.Add(tapImage4);
            phoneimg.GestureRecognizers.Add(tapImage5);
            videoimg.GestureRecognizers.Add(tapImage6);
            galleryimg.GestureRecognizers.Add(tapImage7);
            void tapImage_Tapped1(object sender, EventArgs e)
            {
                // handle the tap
                /// DisplayAlert("see", sender.ToString()+e.ToString(), "Ok");
                Navigation.PushAsync(new ClockPage());
            }

            void tapImage_Tapped2(object sender, EventArgs e)
            {
                // handle the tap
                /// DisplayAlert("see", sender.ToString()+e.ToString(), "Ok");
                Navigation.PushAsync(new MapsPage());
            }

            void tapImage_Tapped3(object sender, EventArgs e)
            {
                // handle the tap
                /// DisplayAlert("see", sender.ToString()+e.ToString(), "Ok");
                Navigation.PushAsync(new CalculatorPage());
            }

            void tapImage_Tapped4(object sender, EventArgs e)
            {
                // handle the tap
                /// DisplayAlert("see", sender.ToString()+e.ToString(), "Ok");
                //DependencyService.Get<ICameraGallery>().CameraMedia();
                Navigation.PushAsync(new CameraPage());
            }

            void tapImage_Tapped5(object sender, EventArgs e)
            {
                // handle the tap
                /// DisplayAlert("see", sender.ToString()+e.ToString(), "Ok");
                //Navigation.PushAsync(new DialerPage());
                Device.OpenUri(new Uri(String.Format("tel:{0}", "8801000264")));
            }

            void tapImage_Tapped6(object sender, EventArgs e)
            {
                // handle the tap
                /// DisplayAlert("see", sender.ToString()+e.ToString(), "Ok");
                Navigation.PushAsync(new VideoPlayerPage());
                // Device.OpenUri(new Uri(String.Format("tel:{0}", "8801000264")));
            }

            void tapImage_Tapped7(object sender, EventArgs e)
            {
                // handle the tap
                /// DisplayAlert("see", sender.ToString()+e.ToString(), "Ok");
                Navigation.PushAsync(new GalleryPage());
            }
        }
示例#26
0
        public SignUpEmail()
        {
            RonocoToolbar        toolbar       = new RonocoToolbar().MakeRonocoToolbar(Color.White);
            Icon                 icon          = new Icon().MakeIconImage(ronoco.mobile.viewmodel.Icon.IconType.Solid, "\uf060", Color.FromRgb(80, 80, 100));
            TapGestureRecognizer tap           = new TapGestureRecognizer();
            RonocoToolbarButton  toolbarButton = new RonocoToolbarButton
            {
                Children = { icon }
            };

            toolbarButton.GestureRecognizers.Add(tap);
            toolbarButton.HorizontalOptions = LayoutOptions.Start;
            toolbarButton.VerticalOptions   = LayoutOptions.Center;
            toolbarButton.BackgroundColor   = Color.White;
            (toolbarButton.GestureRecognizers.ElementAt(0) as TapGestureRecognizer).Tapped += BackButton_Tapped;

            toolbar.Padding         = new Thickness(0, 15, 0, 0);
            toolbar.VerticalOptions = LayoutOptions.Center;
            toolbar = toolbar.AddToolbarButton(toolbar, toolbarButton);

            Padding         = new Thickness(24, 0);
            BackgroundColor = Color.White;

            Label signUpTitle = new Label
            {
                FontFamily = "SFUIDisplay-Medium",
                FontSize   = 26,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor = Color.FromRgb(80, 80, 100),
                Text      = "Sign up",
            };

            EntryField emailEntry = new EntryField().CreateEntryField(new Icon().MakeIconImage(viewmodel.Icon.IconType.Solid,
                                                                                               "\uf0e0", Color.FromRgb(80, 80, 100)), Keyboard.Email, false);

            EntryField passEntry = new EntryField().CreateEntryField(new Icon().MakeIconImage(viewmodel.Icon.IconType.Solid,
                                                                                              "\uf023", Color.FromRgb(80, 80, 100)), Keyboard.Default, true);

            Button signUpSubmit = new Button
            {
                BackgroundColor   = Color.FromRgb(70, 120, 200),
                FontFamily        = "SFUIText-Bold",
                FontSize          = 16,
                TextColor         = Color.White,
                Text              = "GET STARTED",
                HorizontalOptions = LayoutOptions.Center,
                CornerRadius      = 25,
                WidthRequest      = 272,
                HeightRequest     = 48
            };

            signUpSubmit.Pressed += SignUpSubmit_Pressed;



            Grid grid = constants.RonocoGrid.RonocoBackArrowGrid;

            grid.BackgroundColor = Color.White;

            // SetTitleView - Custom NavigationBar, SetHasBackButton to false so there aren't 2 back buttons.
            NavigationPage.SetTitleView(this, toolbar);
            NavigationPage.SetHasBackButton(this, false);

            grid.Children.Add(signUpTitle, 1, 0);
            grid.Children.Add(emailEntry, 1, 2);
            grid.Children.Add(passEntry, 1, 4);
            grid.Children.Add(signUpSubmit, 1, 6);

            Content = grid;
        }
        public Set_Pumping_Scheduler()
        {
            InitializeComponent();
            BackgroundColor  = Color.SkyBlue;
            start_clock.Time = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
            end_clock.Time   = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute + 5, DateTime.Now.Second);
            var Mon_tapGesture = new TapGestureRecognizer();

            Mon_tapGesture.Tapped += (s, e) =>
            {
                mon_col++;
                if (mon_col % 2 == 1)
                {
                    Mon.BackgroundColor = Color.Green;
                }
                else
                {
                    Mon.BackgroundColor = Color.Aqua;
                }
                save_Clicked(s, e);
            };
            Mon.GestureRecognizers.Add(Mon_tapGesture);
            var Tue_tapGesture = new TapGestureRecognizer();

            Tue_tapGesture.Tapped += (s, e) =>
            {
                tue_col++;
                if (tue_col % 2 == 1)
                {
                    Tue.BackgroundColor = Color.Green;
                }
                else
                {
                    Tue.BackgroundColor = Color.Aqua;
                }
                save_Clicked(s, e);
            };
            Tue.GestureRecognizers.Add(Tue_tapGesture);
            var Wed_tapGesture = new TapGestureRecognizer();

            Wed_tapGesture.Tapped += (s, e) =>
            {
                wed_col++;
                if (wed_col % 2 == 1)
                {
                    Wed.BackgroundColor = Color.Green;
                }
                else
                {
                    Wed.BackgroundColor = Color.Aqua;
                }
                save_Clicked(s, e);
            };
            Wed.GestureRecognizers.Add(Wed_tapGesture);
            var Thu_tapGesture = new TapGestureRecognizer();

            Thu_tapGesture.Tapped += (s, e) =>
            {
                thu_col++;
                if (thu_col % 2 == 1)
                {
                    Thu.BackgroundColor = Color.Green;
                }
                else
                {
                    Thu.BackgroundColor = Color.Aqua;
                }
                save_Clicked(s, e);
            };
            Thu.GestureRecognizers.Add(Thu_tapGesture);
            var Fri_tapGesture = new TapGestureRecognizer();

            Fri_tapGesture.Tapped += (s, e) =>
            {
                fri_col++;
                if (fri_col % 2 == 1)
                {
                    Fri.BackgroundColor = Color.Green;
                }
                else
                {
                    Fri.BackgroundColor = Color.Aqua;
                }
                save_Clicked(s, e);
            };
            Fri.GestureRecognizers.Add(Fri_tapGesture);
            var Sat_tapGesture = new TapGestureRecognizer();

            Sat_tapGesture.Tapped += (s, e) =>
            {
                sat_col++;
                if (sat_col % 2 == 1)
                {
                    Sat.BackgroundColor = Color.Green;
                }
                else
                {
                    Sat.BackgroundColor = Color.Aqua;
                }
                save_Clicked(s, e);
            };
            Sat.GestureRecognizers.Add(Sat_tapGesture);
            var Sun_tapGesture = new TapGestureRecognizer();

            Sun_tapGesture.Tapped += (s, e) =>
            {
                sun_col++;
                if (sun_col % 2 == 1)
                {
                    Sun.BackgroundColor = Color.Green;
                }
                else
                {
                    Sun.BackgroundColor = Color.Aqua;
                }
                save_Clicked(s, e);
            };
            Sun.GestureRecognizers.Add(Sun_tapGesture);
        }
示例#28
0
        private void AddTabToView(TabItem tab)
        {
            var tabSize = (TabSizeOption.IsAbsolute && TabSizeOption.Value.Equals(0)) ? new GridLength(1, GridUnitType.Star) : TabSizeOption;

            _headerContainerGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = tabSize
            });

            tab.IsCurrent = _headerContainerGrid.ColumnDefinitions.Count - 1 == SelectedTabIndex;

            var headerIcon = new Image
            {
                Margin            = new Thickness(0, 10, 0, 0),
                BindingContext    = tab,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = tab.HeaderIconSize,
                HeightRequest     = tab.HeaderIconSize
            };

            headerIcon.SetBinding(Image.SourceProperty, nameof(TabItem.HeaderIcon));
            headerIcon.SetBinding(IsVisibleProperty, nameof(TabItem.HeaderIcon), converter: new NullToBoolConverter());

            var headerLabel = new Label
            {
                Margin                  = new Thickness(5, headerIcon.IsVisible? 0: 10, 5, 0),
                BindingContext          = tab,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                VerticalOptions         = LayoutOptions.Center
            };

            headerLabel.SetBinding(Label.TextProperty, nameof(TabItem.HeaderText));
            headerLabel.SetBinding(Label.TextColorProperty, nameof(TabItem.HeaderTextColor));
            headerLabel.SetBinding(Label.FontSizeProperty, nameof(TabItem.HeaderTabTextFontSize));
            headerLabel.SetBinding(Label.FontFamilyProperty, nameof(TabItem.HeaderTabTextFontFamily));
            headerLabel.SetBinding(Label.FontAttributesProperty, nameof(TabItem.HeaderTabTextFontAttributes));
            headerLabel.SetBinding(IsVisibleProperty, nameof(TabItem.HeaderText), converter: new NullToBoolConverter());

            var selectionBarBoxView = new BoxView
            {
                VerticalOptions = LayoutOptions.EndAndExpand,
                BindingContext  = tab,
                HeightRequest   = HeaderSelectionUnderlineThickness,
                WidthRequest    = HeaderSelectionUnderlineWidth
            };

            selectionBarBoxView.SetBinding(IsVisibleProperty, nameof(TabItem.IsCurrent));
            selectionBarBoxView.SetBinding(BoxView.ColorProperty, nameof(TabItem.HeaderSelectionUnderlineColor));
            selectionBarBoxView.SetBinding(WidthRequestProperty, nameof(TabItem.HeaderSelectionUnderlineWidth));
            selectionBarBoxView.SetBinding(HeightRequestProperty, nameof(TabItem.HeaderSelectionUnderlineThickness));
            selectionBarBoxView.SetBinding(HorizontalOptionsProperty,
                                           nameof(TabItem.HeaderSelectionUnderlineWidthProperty),
                                           converter: new DoubleToLayoutOptionsConverter());

            selectionBarBoxView.PropertyChanged += (object sender, PropertyChangedEventArgs e) =>
            {
                if (e.PropertyName == nameof(TabItem.IsCurrent))
                {
                    SetPosition(ItemSource.IndexOf((TabItem)((BoxView)sender).BindingContext));
                }
                if (e.PropertyName == nameof(WidthRequest))
                {
                    selectionBarBoxView.HorizontalOptions = tab.HeaderSelectionUnderlineWidth > 0 ? LayoutOptions.CenterAndExpand : LayoutOptions.FillAndExpand;
                }
            };

            var headerItemSL = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { headerIcon, headerLabel, selectionBarBoxView }
            };
            var tapRecognizer = new TapGestureRecognizer();

            tapRecognizer.Tapped += (object s, EventArgs e) =>
            {
                _supressCarouselViewPositionChangedEvent = true;
                var capturedIndex = _headerContainerGrid.Children.IndexOf((View)s);
                SetPosition(capturedIndex);
                _supressCarouselViewPositionChangedEvent = false;
            };
            headerItemSL.GestureRecognizers.Add(tapRecognizer);
            _headerContainerGrid.Children.Add(headerItemSL, _headerContainerGrid.ColumnDefinitions.Count - 1, 0);
            _carouselView.ItemsSource = ItemSource.Select(t => t.Content);
        }
示例#29
0
        public SettingsPage(SettingsViewModel settingsViewModel,
                            IAnalyticsService analyticsService,
                            IMainThread mainThread) : base(settingsViewModel, analyticsService, mainThread, true)
        {
            const int separatorRowHeight = 1;
            const int settingsRowHeight  = 38;

            var loginRowTapGesture = new TapGestureRecognizer();

            loginRowTapGesture.Tapped += HandleLoginRowTapped;

            Content = new ScrollView
            {
                Content = _contentGrid = new Grid
                {
                    RowSpacing    = 8,
                    ColumnSpacing = 16.5,

                    Margin = new Thickness(30, 0, 30, 5),

                    RowDefinitions = Rows.Define(
                        (Row.GitHubUser, AbsoluteGridLength(GitHubUserView.TotalHeight)),
                        (Row.GitHubUserSeparator, AbsoluteGridLength(separatorRowHeight)),
                        (Row.Login, AbsoluteGridLength(settingsRowHeight)),
                        (Row.LoginSeparator, AbsoluteGridLength(separatorRowHeight)),
                        (Row.Notifications, AbsoluteGridLength(settingsRowHeight)),
                        (Row.NotificationsSeparator, AbsoluteGridLength(separatorRowHeight)),
                        (Row.Theme, AbsoluteGridLength(settingsRowHeight)),
                        (Row.ThemeSeparator, AbsoluteGridLength(separatorRowHeight)),
                        (Row.Language, AbsoluteGridLength(settingsRowHeight)),
                        (Row.LanguageSeparator, AbsoluteGridLength(separatorRowHeight)),
                        (Row.PreferredCharts, AbsoluteGridLength(80)),
                        (Row.CopyrightPadding, AbsoluteGridLength(20)),
                        (Row.Copyright, Star)),

                    ColumnDefinitions = Columns.Define(
                        (Column.Icon, AbsoluteGridLength(24)),
                        (Column.Title, StarGridLength(5)),
                        (Column.Button, StarGridLength(3))),

                    Children =
                    {
                        new GitHubUserView().Row(Row.GitHubUser).ColumnSpan(All <Column>()),

                        new Separator().Row(Row.GitHubUserSeparator).ColumnSpan(All <Column>()),

                        new LoginRowTappableView(loginRowTapGesture).Row(Row.Login).ColumnSpan(All <Column>()),
                        new LoginRowSvg("logout.svg",                                                          getSVGIconColor).Row(Row.Login).Column(Column.Icon),
                        new LoginLabel().Row(Row.Login).Column(Column.Title),
                        new LoginRowSvg("right_arrow.svg",                                                     getSVGIconColor).End().Row(Row.Login).Column(Column.Button),

                        new Separator().Row(Row.LoginSeparator).ColumnSpan(All <Column>()),

                        new SvgImage("bell.svg",                                                               getSVGIconColor).Row(Row.Notifications).Column(Column.Icon),
                        new SettingsTitleLabel(SettingsPageAutomationIds.RegisterForNotificationsTitleLabel).Row(Row.Notifications).Column(Column.Title)
                        .Bind(Label.TextProperty,                                                              nameof(SettingsViewModel.RegisterForNotificationsLabelText)),
                        new EnableNotificationsSwitch().Row(Row.Notifications).Column(Column.Button),

                        new Separator().Row(Row.NotificationsSeparator).ColumnSpan(All <Column>()),

                        new SvgImage("theme.svg",                                                              getSVGIconColor).Row(Row.Theme).Column(Column.Icon),
                        new SettingsTitleLabel(SettingsPageAutomationIds.ThemeTitleLabel).Row(Row.Theme).Column(Column.Title)
                        .Bind(Label.TextProperty,                                                              nameof(SettingsViewModel.ThemeLabelText)),
                        new SettingsPicker(SettingsPageAutomationIds.ThemePicker,                                                       70).Row(Row.Theme).Column(Column.Button)
                        .Bind(Picker.ItemsSourceProperty,                                                      nameof(SettingsViewModel.ThemePickerItemsSource))
                        .Bind(Picker.SelectedIndexProperty,                                                    nameof(SettingsViewModel.ThemePickerSelectedIndex)),

                        new Separator().Row(Row.ThemeSeparator).ColumnSpan(All <Column>()),

                        new SvgImage("language.svg",                                                           getSVGIconColor).Row(Row.Language).Column(Column.Icon),
                        new SettingsTitleLabel(SettingsPageAutomationIds.LanguageTitleLabel).Row(Row.Language).Column(Column.Title)
                        .Bind(Label.TextProperty,                                                              nameof(SettingsViewModel.LanguageLabelText)),
                        new SettingsPicker(SettingsPageAutomationIds.LanguagePicker,                                                       100).Row(Row.Language).Column(Column.Button)
                        .Bind(Picker.ItemsSourceProperty,                                                      nameof(SettingsViewModel.LanguagePickerItemsSource))
                        .Bind(Picker.SelectedIndexProperty,                                                    nameof(SettingsViewModel.LanguagePickerSelectedIndex)),

                        new Separator().Row(Row.LanguageSeparator).ColumnSpan(All <Column>()),

                        new PreferredChartsView(settingsViewModel,                                             mainThread).Row(Row.PreferredCharts).ColumnSpan(All <Column>()),

                        new CopyrightLabel().Row(Row.Copyright).ColumnSpan(All <Column>())
                    }
                }
            };

            this.SetBinding(TitleProperty, nameof(SettingsViewModel.TitleText));
示例#30
0
 private void CreateTapGesture()
 {
     tapGesture = new TapGestureRecognizer();
     tapGesture.Updated += TapGestureCallback;
     FingerScript.AddGesture(tapGesture);
 }
示例#31
0
		public void AddGestureRecognizer ()
		{
			var view = new View ();
			var gestureRecognizer = new TapGestureRecognizer ();

			view.GestureRecognizers.Add (gestureRecognizer);

			Assert.True (view.GestureRecognizers.Contains (gestureRecognizer));
		}

		public Android_TapGestureEventArgs(TapGestureRecognizer gestureRecognizer, Android_GestureListener androidGestureListener)

		{
示例#33
0
		public void RemoveGestureRecognizerUnsetsParent ()
		{
			var view = new View ();
			var gestureRecognizer = new TapGestureRecognizer ();

			view.GestureRecognizers.Add (gestureRecognizer);
			view.GestureRecognizers.Remove (gestureRecognizer);

			Assert.Null (gestureRecognizer.Parent);
		}
        private void CreateRecordingsStack()
        {
            foreach (var recording in records)
            {
                //string[] splitPath = recording.Split('/');
                //string path = splitPath[4].Substring(0, splitPath[4].Length - 4);

                StackLayout sl = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal
                };

                Frame f = new Frame
                {
                    BorderColor = Color.Silver
                };

                Label l = new Label
                {
                    Text           = recording.Title,
                    FontSize       = 10,
                    Margin         = new Thickness(0, 0, 10, 0),
                    BindingContext = recording
                };
                TapGestureRecognizer g = new TapGestureRecognizer();
                g.Tapped += PlayRecording;
                l.GestureRecognizers.Add(g);

                Xamarin.Forms.Image i = new Xamarin.Forms.Image()
                {
                    WidthRequest = 20, HeightRequest = 20
                };
                i.Source  = "redX.png";
                i.ClassId = recording.Title;
                TapGestureRecognizer g2 = new TapGestureRecognizer();
                g2.Tapped += DeleteRecording;
                i.Margin   = 0;
                i.GestureRecognizers.Add(g2);

                Label l2 = new Label();
                TapGestureRecognizer g3 = new TapGestureRecognizer();
                l2.GestureRecognizers.Add(g3);
                l2.Text     = "Edit Recording";
                l2.FontSize = 10;
                l2.ClassId  = recording.Title;



                sl.Children.Add(l);
                sl.Children.Add(l2);
                sl.Children.Add(i);
                Button b = new Button {
                    Text = "Share"
                };
                b.Clicked += B_Clicked;
                g3.Tapped += ChangeRecordingName;
                sl.Children.Add(b);

                f.Content = sl;
                RecordingPane.Children.Add(sl);
            }
        }
示例#35
0
        public DetailsPage()
        {
            InitializeComponent();
            VisualStateManager.GoToState(MountainMenu, "PressedMenu");

            mountains = new List <Mountains>
            {
                new Mountains
                {
                    Picture     = "Mountain1",
                    Description = "Rocky Mountains"
                },
                new Mountains
                {
                    Picture     = "Mountain1",
                    Description = "Mount MacKinley"
                },
                new Mountains
                {
                    Picture     = "Mountain1",
                    Description = "Rocky Mountains"
                },
                new Mountains
                {
                    Picture     = "Mountain1",
                    Description = "Mount MacKinley"
                },
                new Mountains
                {
                    Picture     = "Mountain1",
                    Description = "Rocky Mountains"
                }
            };

            for (int i = 1; i < mountains.Count; i++)
            {
                StackLayout stackHeader = new StackLayout()
                {
                    Orientation = StackOrientation.Vertical,
                    Padding     = new Thickness(1, 10, 1, 0)
                };

                Frame frameImage = new Frame()
                {
                    Content = new Image {
                        Source = $"{mountains[i].Picture}", Aspect = Aspect.Fill, WidthRequest = 10
                    },
                    CornerRadius      = 20,
                    Padding           = 0,
                    IsClippedToBounds = true
                };

                Frame frameText = new Frame()
                {
                    Content = new Label {
                        Text = $"{mountains[i].Description}", VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center
                    },
                    CornerRadius    = 20,
                    HasShadow       = false,
                    TranslationY    = -30,
                    BackgroundColor = Color.FromHex("#f8f8f8"),
                    HeightRequest   = 50
                };

                var tapGestureRecognizer = new TapGestureRecognizer();
                tapGestureRecognizer.Tapped += Frame_Tapped;
                frameText.GestureRecognizers.Add(tapGestureRecognizer);


                stackHeader.Children.Add(frameImage);
                stackHeader.Children.Add(frameText);
                mountainLayout.Children.Add(stackHeader);
            }
        }
示例#36
0
        private Grid GetOptionView(String className)
        {
            MyColor = colors[ColorIndex++ % 3];

            //class name
            var classNameLabel = new Label
            {
                Text           = className,
                TextColor      = MyColor,
                FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            //edit icon
            var editIcon = new FontAwesomeLabel
            {
                Text      = FontIconApp.UserControls.Icon.FAPencil,
                FontSize  = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                TextColor = MyColor
            };

            Grid line = new Grid
            {
                Margin            = new Thickness(10, 0, 5, 0),
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(0.80, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(0.10, GridUnitType.Star)
                    },
                },
                ColumnSpacing = 0,
                RowSpacing    = 0
            };

            line.Children.Add(classNameLabel, 0, 0);
            line.Children.Add(editIcon, 1, 0);

            Frame f = new Frame
            {
                Content         = line,
                BackgroundColor = Color.Transparent,
                BorderColor     = MyColor,
                CornerRadius    = 4,
            };

            var optionView = new Grid
            {
                Padding = new Thickness(5, 5),
                Margin  = new Thickness(16, 8)
            };

            optionView.Children.Add(f);

            var tgr = new TapGestureRecognizer();

            tgr.Tapped += (s, e) =>
            {
                Navigation.PushAsync(new TypeOfClassOptionsPage(className));
            };
            optionView.GestureRecognizers.Add(tgr);

            return(optionView);
        }
示例#37
0
 void OnTap(TapGestureRecognizer gesture)
 {
     Debug.Log("Tap");
 }
示例#38
0
        public Image Effect(string img, string ID, string binding)
        {
            Image btn = new Image
            {
                ClassId         = ID,
                Source          = img,
                BackgroundColor = Color.White,
                Aspect          = Aspect.AspectFit,
                WidthRequest    = w / 5
            };

            switch (ID)
            {
            case "1":
                var BtnColortap1 = new TapGestureRecognizer(BtnColortap1_Tapped);
                BtnColortap1.NumberOfTapsRequired = 1;
                btn.IsEnabled = true;
                btn.GestureRecognizers.Clear();
                btn.GestureRecognizers.Add(BtnColortap1);
                break;

            case "2":
                var BtnColortap2 = new TapGestureRecognizer(BtnColortap2_Tapped);
                BtnColortap2.NumberOfTapsRequired = 1;
                btn.IsEnabled = true;
                btn.GestureRecognizers.Clear();
                btn.GestureRecognizers.Add(BtnColortap2);
                break;

            case "3":
                var BtnColortap3 = new TapGestureRecognizer(BtnColortap3_Tapped);
                BtnColortap3.NumberOfTapsRequired = 1;
                btn.IsEnabled = true;
                btn.GestureRecognizers.Clear();
                btn.GestureRecognizers.Add(BtnColortap3);
                break;

            case "4":
                var BtnColortap4 = new TapGestureRecognizer(BtnColortap4_Tapped);
                BtnColortap4.NumberOfTapsRequired = 1;
                btn.IsEnabled = true;
                btn.GestureRecognizers.Clear();
                btn.GestureRecognizers.Add(BtnColortap4);
                break;

            case "5":
                var BtnColortap5 = new TapGestureRecognizer(BtnColortap5_Tapped);
                BtnColortap5.NumberOfTapsRequired = 1;
                btn.IsEnabled = true;
                btn.GestureRecognizers.Clear();
                btn.GestureRecognizers.Add(BtnColortap5);
                break;

            case "6":
                var BtnColortap6 = new TapGestureRecognizer(BtnColortap6_Tapped);
                BtnColortap6.NumberOfTapsRequired = 1;
                btn.IsEnabled = true;
                btn.GestureRecognizers.Clear();
                btn.GestureRecognizers.Add(BtnColortap6);
                break;
            }

            return(btn);
        }
		public iOS_TapGestureEventArgs(TapGestureRecognizer gestureRecognizer, UITapGestureRecognizer platformGestureRecognizer)
		{
			this.gestureRecognizer = gestureRecognizer;
			this.platformGestureRecognizer = platformGestureRecognizer;
		}
        public MatchHeaderLists()
        {
            searchBar = new Grid()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                ColumnSpacing     = 0,
                RowSpacing        = 0,

                ColumnDefinitions =
                {
                    new ColumnDefinition()
                    {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition()
                    {
                        Width = GridLength.Star
                    },
                    new ColumnDefinition()
                    {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition()
                    {
                        Width = 5
                    },
                },
                RowDefinitions =
                {
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    }
                }
            };
            searchEntry = new Entry()
            {
                Placeholder = "Search matches by team",
                Keyboard    = Keyboard.Numeric,

                MinimumWidthRequest = Width
            };
            var filterBtn = new Button()
            {
                Text            = "Search",
                TextColor       = Color.White,
                FontSize        = GlobalVariables.sizeMedium,
                BackgroundColor = Color.Green,
            };

            filterBtn.Clicked += (sender, e) => {
                autoCompleteOptions();
            };
            searchBar.Children.Add(searchEntry, 1, 0);
            searchBar.Children.Add(filterBtn, 2, 0);

            var upcomingMatchHeader = new ContentView()
            {
                Content = new Frame()
                {
                    OutlineColor = Color.Gray,
                    Padding      = new Thickness(5),

                    Content = new Label()
                    {
                        Text           = "Upcoming Matches",
                        FontSize       = GlobalVariables.sizeMedium,
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.Black
                    }
                }
            };
            var upcomingMatchHeaderTap = new TapGestureRecognizer();

            upcomingMatchHeaderTap.Tapped += (sender, e) => {
                Console.WriteLine("test");
                if (pastMatchView.IsEnabled)
                {
                    upcomingMatchView.IsEnabled = !upcomingMatchView.IsEnabled;
                    setListHieght();
                }
                AppSettings.SaveSettings("UpcomingMatchListEn", upcomingMatchView.IsEnabled.ToString());
            };
            upcomingMatchHeader.GestureRecognizers.Add(upcomingMatchHeaderTap);

            upcomingMatchView.ItemTemplate = new DataTemplate(() => {
                var matchLbl = new Label()
                {
                    TextColor = Color.Black,
                    FontSize  = GlobalVariables.sizeMedium
                };
                matchLbl.SetBinding(Label.TextProperty, "matchNumber");

                var cell = new ViewCell()
                {
                    View = new StackLayout()
                    {
                        Children =
                        {
                            matchLbl
                        }
                    }
                };

                return(cell);
            });

            upcomingMatchView.ItemSelected += (sender, e) => {
                ((ListView)sender).SelectedItem = null;
            };

            upcomingMatchView.ItemTapped += (sender, e) => {
                //Navigation.PushPopupAsync(new MatchInfoPopupPage((EventMatchData)e.Item));
            };

            var pastMatchHeader = new ContentView()
            {
                Content = new Frame()
                {
                    OutlineColor = Color.Gray,
                    Padding      = new Thickness(5),

                    Content = new Label()
                    {
                        Text           = "Past Matches",
                        FontSize       = GlobalVariables.sizeMedium,
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.Black
                    }
                }
            };
            var pastMatchHeaderTap = new TapGestureRecognizer();

            pastMatchHeaderTap.Tapped += (sender, e) => {
                if (upcomingMatchView.IsEnabled)
                {
                    pastMatchView.IsEnabled = !pastMatchView.IsEnabled;
                    setListHieght();
                }
                AppSettings.SaveSettings("PastMatchListEn", pastMatchView.IsEnabled.ToString());
            };
            pastMatchHeader.GestureRecognizers.Add(pastMatchHeaderTap);

            pastMatchView.ItemTemplate = new DataTemplate(() => {
                var matchLbl = new Label()
                {
                    TextColor = Color.Black,
                    FontSize  = GlobalVariables.sizeMedium
                };
                matchLbl.SetBinding(Label.TextProperty, "matchNumber");
                var cell = new ViewCell()
                {
                    View = new StackLayout()
                    {
                        Children =
                        {
                            matchLbl
                        }
                    }
                };

                return(cell);
            });

            pastMatchView.ItemSelected += (sender, e) => {
                ((ListView)sender).SelectedItem = null;
            };
            pastMatchView.ItemTapped += (sender, e) => {
                //Navigation.PushPopupAsync(new MatchInfoPopupPage((EventMatchData)e.Item));
            };

            var ourMatchHeader = new ContentView()
            {
                Content = new Frame()
                {
                    OutlineColor = Color.Gray,
                    Padding      = new Thickness(5),

                    Content = new Label()
                    {
                        Text           = "Our Matches",
                        FontSize       = GlobalVariables.sizeMedium,
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.Black
                    }
                }
            };

            ourMatchView.ItemTemplate = new DataTemplate(() => {
                var matchLbl = new Label()
                {
                    TextColor = Color.Black,
                    FontSize  = GlobalVariables.sizeMedium
                };
                matchLbl.SetBinding(Label.TextProperty, "matchNumber");
                var cell = new ViewCell()
                {
                    View = new StackLayout()
                    {
                        Children =
                        {
                            matchLbl
                        }
                    }
                };

                return(cell);
            });

            ourMatchView.ItemSelected += (sender, e) => {
                ((ListView)sender).SelectedItem = null;
            };
            ourMatchView.ItemTapped += (sender, e) => {
                //Navigation.PushPopupAsync(new MatchInfoPopupPage((EventMatchData)e.Item));
            };

            height = Height;

            Content = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,

                Children =
                {
                    searchBar,
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,

                        Children =
                        {
                            new StackLayout()
                            {
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                                VerticalOptions   = LayoutOptions.FillAndExpand,

                                Children =
                                {
                                    upcomingMatchHeader,
                                    upcomingMatchView,
                                    pastMatchHeader,
                                    pastMatchView
                                }
                            },
                            new StackLayout()
                            {
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                                VerticalOptions   = LayoutOptions.FillAndExpand,

                                Children =
                                {
                                    ourMatchHeader,
                                    ourMatchView
                                }
                            }
                        }
                    }
                }
            };
        }
示例#41
0
        public ActivePromotionDetailPage(ActivePromotionsDB item)
        {
            InitializeComponent();

            //  act_promo = item;


            List <type_list> type_listdb = new List <type_list>();

            List <list1> list1db = new List <list1>();
            List <list2> list2db = new List <list2>();

            var json_list_type = JsonConvert.SerializeObject(item.type_list);
            var json_list1     = JsonConvert.SerializeObject(item.list1);
            var json_list2     = JsonConvert.SerializeObject(item.list2);

            String type_list_str = json_list_type.ToString();
            String list1string   = json_list1.ToString();
            String list2string   = json_list2.ToString();

            //type_list starts here

            String fin_type_string = type_list_str.Replace("\\", "");

            fin_type_string = fin_type_string.Substring(1);
            fin_type_string = fin_type_string.Remove(fin_type_string.Length - 1);
            JArray type_list_string = JsonConvert.DeserializeObject <JArray>(fin_type_string);

            //list 1 starts here

            String finlist1string = list1string.Replace("\\", "");

            finlist1string = finlist1string.Substring(1);
            finlist1string = finlist1string.Remove(finlist1string.Length - 1);
            JArray list1_string = JsonConvert.DeserializeObject <JArray>(finlist1string);

            //list 2 starts here

            String finlist2string = list2string.Replace("\\", "");

            finlist2string = finlist2string.Substring(1);
            finlist2string = finlist2string.Remove(finlist2string.Length - 1);
            JArray list2_string = JsonConvert.DeserializeObject <JArray>(finlist2string);

            if (list1_string != null)
            {
                foreach (JObject obj in list1_string)
                {
                    list1 list1new = new list1();

                    try
                    {
                        list1new.product = obj["product"].ToString();
                    }
                    catch
                    {
                        list1new.product = "";
                    }

                    try
                    {
                        list1new.minimum_quantity = obj["minimum_quantity"].ToString();
                    }
                    catch
                    {
                        list1new.minimum_quantity = "";
                    }

                    try
                    {
                        list1new.maximum_quantity = obj["maximum_quantity"].ToString();
                    }
                    catch
                    {
                        list1new.maximum_quantity = "";
                    }


                    list1db.Add(list1new);
                }
            }


            if (list2_string != null)
            {
                //        public string discount { get; set; }
                //public string product { get; set; }
                //public string account { get; set; }
                //public string quantity_free { get; set; }

                foreach (JObject obj in list2_string)
                {
                    list2 list2new = new list2();
                    try
                    {
                        list2new.product = obj["product"].ToString();
                    }

                    catch
                    {
                        list2new.product = "";
                    }

                    try
                    {
                        list2new.discount = obj["discount"].ToString();
                    }
                    catch
                    {
                        list2new.discount = "";
                    }

                    try
                    {
                        list2new.account = obj["account"].ToString();
                    }

                    catch
                    {
                        list2new.account = "";
                    }

                    try
                    {
                        list2new.quantity_free = obj["quantity_free"].ToString();
                    }

                    catch
                    {
                        list2new.quantity_free = "";
                    }

                    list2db.Add(list2new);
                }
            }


            if (type_list_string != null)
            {
                foreach (JObject obj in type_list_string)
                {
                    type_list type_listnew = new type_list();

                    try
                    {
                        type_listnew.category = obj["category"].ToString();
                    }

                    catch
                    {
                        type_listnew.category = "";
                    }

                    try
                    {
                        type_listnew.discount = obj["discount"].ToString();
                    }

                    catch
                    {
                        type_listnew.discount = "";
                    }

                    try
                    {
                        type_listnew.product = obj["product"].ToString();
                    }

                    catch
                    {
                        type_listnew.product = "";
                    }


                    try
                    {
                        type_listnew.total_price = obj["total_price"].ToString();
                    }

                    catch
                    {
                        type_listnew.total_price = "";
                    }

                    try
                    {
                        type_listnew.minimum_quantity = obj["minimum_quantity"].ToString();
                    }

                    catch
                    {
                        type_listnew.minimum_quantity = "";
                    }

                    try
                    {
                        type_listnew.maximum_quantity = obj["maximum_quantity"].ToString();
                    }

                    catch
                    {
                        type_listnew.maximum_quantity = "";
                    }
                    try
                    {
                        type_listnew.minimum_amount = obj["minimum_amount"].ToString();
                    }

                    catch
                    {
                        type_listnew.minimum_amount = "";
                    }

                    try
                    {
                        type_listnew.list_price = obj["list_price"].ToString();
                    }

                    catch
                    {
                        type_listnew.list_price = "";
                    }

                    type_listdb.Add(type_listnew);
                }
            }

            title.Text          = item.name;
            type_val.Text       = item.type;
            proservice_val.Text = item.product;
            startdate_val.Text  = item.start_date;
            enddate_val.Text    = item.end_date;

            if (item.type == "7_total_price_product_filter_by_quantity")
            {
                sevan_totalpricefilter_stack.IsVisible = true;
                sevan_totalListview.ItemsSource        = type_listdb;

                one_dis_on_totorder_stack.IsVisible     = false;
                two_dis_on_cat_stack.IsVisible          = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                six_unitpricefilter_stack.IsVisible     = false;
            }

            else if (item.type == "6_price_filter_quantity")
            {
                six_unitpricefilter_stack.IsVisible = true;
                six_unitpriceListview.ItemsSource   = type_listdb;

                one_dis_on_totorder_stack.IsVisible     = false;
                two_dis_on_cat_stack.IsVisible          = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else if (item.type == "5_pack_free_gift")
            {
                five_bypackfree_stack.IsVisible     = true;
                fiveaaa_bypackfree2_stack.IsVisible = true;

                five_bypackfreeListview.ItemsSource = list1db;
                bypackfreeListview2.ItemsSource     = list2db;

                five_bypackfreeListview.HeightRequest = list1db.Count * 50;
                bypackfreeListview2.HeightRequest     = list2db.Count * 50;

                one_dis_on_totorder_stack.IsVisible     = false;
                two_dis_on_cat_stack.IsVisible          = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                six_unitpricefilter_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else if (item.type == "4_pack_discount")
            {
                four_bypackdiscount_stack.IsVisible     = true;
                fouraaa_bypackdiscount2_stack.IsVisible = true;



                four_bypackdiscountListview.ItemsSource  = list1db;
                four_bypackdiscountListview2.ItemsSource = list2db;

                four_bypackdiscountListview.HeightRequest  = list1db.Count * 50;
                four_bypackdiscountListview2.HeightRequest = list2db.Count * 50;

                one_dis_on_totorder_stack.IsVisible    = false;
                two_dis_on_cat_stack.IsVisible         = false;
                three_dis_by_quan_stack.IsVisible      = false;
                five_bypackfree_stack.IsVisible        = false;
                fiveaaa_bypackfree2_stack.IsVisible    = false;
                six_unitpricefilter_stack.IsVisible    = false;
                sevan_totalpricefilter_stack.IsVisible = false;
            }

            else if (item.type == "3_discount_by_quantity_of_product")
            {
                three_dis_by_quan_stack.IsVisible = true;

                three_dis_by_quanListview.ItemsSource = type_listdb;

                one_dis_on_totorder_stack.IsVisible = false;
                two_dis_on_cat_stack.IsVisible      = false;

                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                six_unitpricefilter_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else if (item.type == "2_discount_category")
            {
                two_dis_on_cat_stack.IsVisible     = true;
                two_dis_on_catListview.ItemsSource = type_listdb;

                one_dis_on_totorder_stack.IsVisible     = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                six_unitpricefilter_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else if (item.type == "1_discount_total_order")
            {
                one_dis_on_totorder_stack.IsVisible     = true;
                one_dis_on_totorderListview.ItemsSource = type_listdb;

                two_dis_on_cat_stack.IsVisible          = false;
                three_dis_by_quan_stack.IsVisible       = false;
                four_bypackdiscount_stack.IsVisible     = false;
                fouraaa_bypackdiscount2_stack.IsVisible = false;
                five_bypackfree_stack.IsVisible         = false;
                fiveaaa_bypackfree2_stack.IsVisible     = false;
                six_unitpricefilter_stack.IsVisible     = false;
                sevan_totalpricefilter_stack.IsVisible  = false;
            }

            else
            {
            }

            var backRecognizer = new TapGestureRecognizer();

            backRecognizer.Tapped += (s, e) => {
                PopupNavigation.PopAsync();
                //    Navigation.PopAllPopupAsync();
                //   Navigation.PushAsync(new CalendarPage());
                //  App.Current.MainPage = new MasterPage(new CalendarPage());
            };
            backImg.GestureRecognizers.Add(backRecognizer);
        }
示例#42
0
        private StackLayout getLayout()
        {
            // Create menu image button
            Image menuImg = new Image()
            {
                Source = ImageSource.FromResource(ReverieUtils.MENU_ICON)
            };

            menuTGR         = new TapGestureRecognizer();
            menuTGR.Tapped += (o, s) => { view.gotoMenu(); };
            Frame menuFrame = new Frame
            {
                Padding = ReverieUtils.BUTTON_PADDING,
                Content = menuImg,
            };

            menuFrame.GestureRecognizers.Add(menuTGR);

            // Create done Image button
            Image doneImg = new Image()
            {
                Source = ImageSource.FromResource(ReverieUtils.DONE_ICON)
            };

            doneTGR         = new TapGestureRecognizer();
            doneTGR.Tapped += (o, s) => { view.gotoPasswordPage(); };
            Frame doneFrame = new Frame
            {
                Padding = ReverieUtils.BUTTON_PADDING,
                Content = doneImg,
            };

            doneFrame.GestureRecognizers.Add(doneTGR);

            // Layouts for menu and button. They have separate layouts to force them to
            // opposite ends of the screen
            StackLayout menuLayout = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Children          = { menuFrame }
            };

            StackLayout doneLayout = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Children          = { doneFrame }
            };

            // Combine layouts for menu and button
            StackLayout navigationBar = new StackLayout()
            {
                Padding         = ReverieUtils.LAYOUT_PADDING,
                BackgroundColor = ReverieStyles.accentGreen,
                Orientation     = StackOrientation.Horizontal,
                Children        = { menuLayout, doneLayout }
            };

            // StackLayout to attempt to force iOS Listview to expand properly
            StackLayout CPMA = new StackLayout()
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Orientation     = StackOrientation.Vertical,
                Children        =
                {
                    // AccordionLayout
                    new AccordionLayout()
                    {
                        // Set template for items
                        ItemTemplate = new DataTemplate(typeof(QuestionCell)),

                        // Add items to ItemSource
                        ItemsSource = list,

                        HasUnevenRows = true
                    }
                }
            };

            // Overall questionnaire page layout
            StackLayout qLayout = new StackLayout()
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    // Menu
                    navigationBar,
                    // AccordionLayout
                    CPMA
                }
            };

            return(qLayout);
        }