public DisposeInHandlerPage()
		{
			var cv = new DisposeInHandlerContentView();

			Log = new Label();
			var syncLbl = new MR.Gestures.Label { Text = "Clear synchronously", HorizontalOptions = LayoutOptions.Start, BackgroundColor = Color.Silver };
			syncLbl.Tapping += (s, e) => { Log.Text = "Sync clear from outside"; cv.ClearContent(); };
			var asyncLbl = new MR.Gestures.Label { Text = "Clear asynchronously", HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.Silver };
			asyncLbl.Tapping += async (s, e) => { Log.Text = "Async clear from outside"; await cv.ClearContent(); };
			var fillLbl = new MR.Gestures.Label { Text = "Set Content", HorizontalOptions = LayoutOptions.End, BackgroundColor = Color.Silver };
			fillLbl.Tapping += (s, e) => { Log.Text = "Set content from outside"; cv.SetContent(); };

			Content = new StackLayout
			{
				Padding = 20,
				Children = {
					cv,
					new StackLayout
					{
						Orientation = StackOrientation.Horizontal,
						Children = {
							syncLbl,
							asyncLbl,
							fillLbl,
						}
					},
					Log,
				}
			};
		}
Example #2
0
        public void SetContent()
        {
            var syncLbl = new MR.Gestures.Label {
                Text = "Clear synchronously", HorizontalOptions = LayoutOptions.Start, BackgroundColor = Color.Silver
            };

#pragma warning disable CS4014
            syncLbl.Tapping += (s, e) => { DisposeInHandlerPage.Log.Text = "Sync clear from inside"; ClearContent(); };
#pragma warning restore CS4014
            var asyncLbl = new MR.Gestures.Label {
                Text = "Clear asynchronously", HorizontalOptions = LayoutOptions.EndAndExpand, BackgroundColor = Color.Silver
            };
            asyncLbl.Tapping += async(s, e) => { DisposeInHandlerPage.Log.Text = "Async clear from inside"; await ClearContent(); };

            Content = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = 20,
                Children    =
                {
                    syncLbl,
                    asyncLbl,
                }
            };
        }
        //Used to shift icons and update while dragging the icon thats intended to get dropped
        void shiftRightAnimation(int initialPoint, int finalPoint, MR.Gestures.Label label)
        {
            Console.WriteLine("Initial Point: " + initialPoint + " Final Point: " + finalPoint);

            int row, column;

            //Now this checks the rest of the items in grid to move to the right if its between the final point and less than the initial point
            foreach (MR.Gestures.Label gridItem in gridBlocks)
            {
                if ((Int32.Parse(gridItem.GetValue(Grid.RowProperty).ToString() + gridItem.GetValue(Grid.ColumnProperty).ToString()) >= finalPoint &&
                     Int32.Parse(gridItem.GetValue(Grid.RowProperty).ToString() + gridItem.GetValue(Grid.ColumnProperty).ToString()) < initialPoint) && gridItem != label)
                {
                    //	If its in the first column we have to move to the previous row and set column to 2, else we just go to the next column
                    if (Int32.Parse(gridItem.GetValue(Grid.ColumnProperty).ToString()) == 2)
                    {
                        row = Int32.Parse(gridItem.GetValue(Grid.RowProperty).ToString());
                        row++;
                        gridItem.SetValue(Grid.RowProperty, row);
                        gridItem.SetValue(Grid.ColumnProperty, 0);
                    }
                    else
                    {
                        column = Int32.Parse(gridItem.GetValue(Grid.ColumnProperty).ToString());
                        row    = Int32.Parse(gridItem.GetValue(Grid.RowProperty).ToString());
                        column++;
                        gridItem.SetValue(Grid.ColumnProperty, column);
                        gridItem.SetValue(Grid.RowProperty, row);
                    }
                }
            }
        }
		public void SetContent()
		{
			var syncLbl = new MR.Gestures.Label { Text = "Clear synchronously", HorizontalOptions = LayoutOptions.Start, BackgroundColor = Color.Silver };
			syncLbl.Tapping += (s, e) => { DisposeInHandlerPage.Log.Text = "Sync clear from inside"; ClearContent(); };
			var asyncLbl = new MR.Gestures.Label { Text = "Clear asynchronously", HorizontalOptions = LayoutOptions.EndAndExpand, BackgroundColor = Color.Silver };
			asyncLbl.Tapping += async (s, e) => { DisposeInHandlerPage.Log.Text = "Async clear from inside"; await ClearContent(); };

			Content = new StackLayout
			{
				Orientation = StackOrientation.Horizontal,
				Padding = 20,
				Children =
				{
					syncLbl,
					asyncLbl,
				}
			};
		}
        //This is an animation used to inform the user when the block is ready to get moved
        async void shakeLabel(object sender, MR.Gestures.Label label)
        {
            uint timeout = 50;

            if (label == null)
            {
                return;
            }

            await label.TranslateTo(-10, 0, timeout);

            await label.TranslateTo(10, 0, timeout);

            await label.TranslateTo(-5, 0, timeout);

            await label.TranslateTo(5, 0, timeout);

            label.TranslationX = 0;
        }
        public DisposeInHandlerPage()
        {
            var cv = new DisposeInHandlerContentView();

            Log = new Label();
            var syncLbl = new MR.Gestures.Label {
                Text = "Clear synchronously", HorizontalOptions = LayoutOptions.Start, BackgroundColor = Color.Silver
            };

#pragma warning disable CS4014
            syncLbl.Tapping += (s, e) => { Log.Text = "Sync clear from outside"; cv.ClearContent(); };
#pragma warning restore CS4014
            var asyncLbl = new MR.Gestures.Label {
                Text = "Clear asynchronously", HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.Silver
            };
            asyncLbl.Tapping += async(s, e) => { Log.Text = "Async clear from outside"; await cv.ClearContent(); };
            var fillLbl = new MR.Gestures.Label {
                Text = "Set Content", HorizontalOptions = LayoutOptions.End, BackgroundColor = Color.Silver
            };
            fillLbl.Tapping += (s, e) => { Log.Text = "Set content from outside"; cv.SetContent(); };

            Content = new StackLayout
            {
                Padding  = 20,
                Children =
                {
                    cv,
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            syncLbl,
                            asyncLbl,
                            fillLbl,
                        }
                    },
                    Log,
                }
            };
        }