예제 #1
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.NavigationMode == NavigationMode.Back)
         return;
     var msg = new MainPageMessage();
     msg.CardStack = CardStack;
     Messenger.Default.Send<MainPageMessage>(msg);
     base.OnNavigatedTo(e);
 }
예제 #2
0
        private void ReceiveMessage(MainPageMessage e)
        {
            CardCanvas = e.CardStack;
            ListCard = new List<RestaurantCell>();
            Random rand = new Random();
            var Names = new List<string>()
            {
                "BookCoffee",
                "Bún Cô Ba",
                "KFC",
                "Pizza Hut",
                "Yuyumi"
            };
            for (int i = 1; i <= 5; i++)
            {
                RestaurantCell border = new RestaurantCell();
                var data = new Restaurant();
                data.Name = Names[i - 1];

                data.DealImage = "/Assets/Demo/deal_" + i.ToString() + ".jpg";
                data.FriendRate = rand.Next(9);
                border.DataContext = data;
                border.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch;
                //border.ManipulationMode = Windows.UI.Xaml.Input.ManipulationModes.All;
                border.RenderTransformOrigin = new Windows.Foundation.Point(0.5, 4);
                var transform = new CompositeTransform();
                border.RenderTransform = transform;
                border.IsHitTestVisible = false;
                border.ManipulationDelta += Border_ManipulationDelta;
                border.ManipulationCompleted += Border_ManipulationCompleted;
                transform.TranslateY = (5 - i);
                transform.ScaleX = transform.ScaleY = 1 - ((double)(((5 - i) * 2)) / 100D) / 6;
                //border.Margin = new Windows.UI.Xaml.Thickness(0, (5 - i) * 5, 0, 0);
                //border.SetBackground(new SolidColorBrush(Color.FromArgb(255, (byte)rand.Next(0, 255), (byte)rand.Next(0, 255), (byte)rand.Next(0, 255))));
                Canvas.SetZIndex(border, (int)i);
                ListCard.Add(border);
                CardCanvas.Children.Add(border);
            }

            ListCard.LastOrDefault().IsHitTestVisible = true;
        }