public RestaurantDetailViewModel()
        {
            if (IsInDesignMode)
            {
                CurrentRestaurant = new Restaurant();
                CurrentRestaurant.Images.Add(new RestaurantImage("ms-appx:///Assets/Demo/deal_1.jpg"));
                CurrentRestaurant.Images.Add(new RestaurantImage("ms-appx:///Assets/Demo/deal_2.jpg"));
                CurrentRestaurant.Images.Add(new RestaurantImage("ms-appx:///Assets/Demo/deal_3.jpg"));
                CurrentRestaurant.Images.Add(new RestaurantImage("ms-appx:///Assets/Demo/deal_4.jpg"));

                CurrentRestaurant.Hashtags.Add("#viewdep");
                CurrentRestaurant.Hashtags.Add("#wifimanh");
                CurrentRestaurant.Hashtags.Add("#tradao");
                CurrentRestaurant.Hashtags.Add("#yentinh");

                CurrentRestaurant.Description = "Prevailed sincerity behaviour to so do principle mr. As departure at no propriety zealously my.";
            }
            GoBackCommand = new RelayCommand(GoBack);
        }
Beispiel #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;
        }