示例#1
0
        private void CreateTravelOffer(int i)
        {
            string[] travelType = { "Flugzeug", "Boot", "Busfahrt" };

            var offer = new TravelOffer()
            {
                BoardType      = GetRandomBool() ? "Vollpension" : "Halbpension",
                DayCount       = GetRandomInteger(1, 14),
                HotelName      = "Hotel " + i,
                Place          = "Place " + 1,
                PricePerPerson = GetRandomInteger(50, 1000),
                TravelType     = travelType[GetRandomInteger(0, travelType.Count() - 1)],
                HotelRating    = GetRandomInteger(1, 5),
                CategoryId     = GetRandomInteger(1, _context.CategorySet.Count()),
                TopOffer       = (GetRandomInteger(1, 4) == 4),
                ImgPath        = "imagepath",
            };

            var count = GetRandomInteger(0, 4);

            for (int j = 0; j < count; j++)
            {
                offer.ExtendedInformation.Add(CreateExtendedInfo(j));
            }
            _context.TravelOfferSet.Add(offer);
        }
示例#2
0
 public void StartDisplay(TravelOffer lastTravel)
 {
     _currentOffer = lastTravel;
     try
     {
         InitializeComponent();
         InitList();
         var helper = KinectHelper.Instance;
         helper.ReadyEvent += (s, _) => HelperReady();
         GreenScreen.Start(helper.Sensor, false);
         SetNewHat();
         Accessories.Start(helper.Sensor);
         RectNavigationControl.Start(helper.Sensor);
         RectNavigationControl.SwipeLeftEvent  += SwipeLeft;
         RectNavigationControl.SwipeRightEvent += SwipeRight;
         RectNavigationControl.SwipeUpEvent    += SwipeUp;
         RectNavigationControl.SwipeDownEvent  += SwipeDown;
         RectNavigationControl.NoSwipe         += NoSwipe;
         string[] texts = MyTextLoopList.GetNeighbourTexts();
         RectNavigationControl.SetTopText(texts[0]);
         RectNavigationControl.SetBottomText(texts[1]);
         InitGenderDetection();
     }
     catch (Exception exc)
     {
         ExceptionTextBlock.Text = exc.Message + "\r\n" + exc.InnerException + "\r\n" + exc.StackTrace;
     }
 }
示例#3
0
 public void Save(TravelOffer offer)
 {
     _offer = offer;
     if (IsNew())
         Insert();
     else
         Update();
 }
示例#4
0
 public void Save(TravelOffer offer)
 {
     _offer = offer;
     if (IsNew())
     {
         Insert();
     }
     else
     {
         Update();
     }
 }
示例#5
0
 /// <summary>
 /// Creates the InfoBox for the current offer
 /// </summary>
 private void BuildInfoBox(Grid grid, TravelOffer offer)
 {
     try
     {
         var infoBanner = new InfoBanner.InfoBanner();
         infoBanner.HorizontalAlignment = HorizontalAlignment.Left;
         infoBanner.Start(offer);
         grid.Children.Add(infoBanner);
     }
     catch
     {
         Console.WriteLine("Error in LocalPictureUiLoader");
     }
 }
示例#6
0
 /// <summary>
 /// Creates a new offer
 /// </summary>
 /// <param name="price"></param>
 /// <param name="place"></param>
 /// <param name="rating"></param>
 /// <param name="hotelname"></param>
 /// <param name="anfahrt"></param>
 /// <param name="daycount"></param>
 /// <param name="futtertyp"></param>
 /// <param name="category"></param>
 /// <param name="image"></param>
 /// <param name="top"></param>
 /// <param name="zusatzinf"></param>
 /// <param name="zusatz2"></param>
 /// <param name="zusatz3"></param>
 public void CreateOffers(int price, String place, int rating, String hotelname, String anfahrt, int daycount, String futtertyp, CategoryEnum category, String image, bool top, String zusatzinf, String zusatz2, String zusatz3)
 {
     try
     {
         var dao   = new TravelOfferDao();
         var offer = new TravelOffer()
         {
             PricePerPerson = price,
             Place          = place,
             ImgPath        = image,
             HotelRating    = rating,
             HotelName      = hotelname,
             TravelType     = anfahrt,
             DayCount       = daycount,
             BoardType      = futtertyp,
             CategoryId     = (int)category,
             TopOffer       = top,
         };
         ExtendedInformation ei = new ExtendedInformation()
         {
             Information = zusatzinf
         };
         offer.ExtendedInformation.Add(ei);
         if (zusatz2 != "")
         {
             ExtendedInformation ei2 = new ExtendedInformation()
             {
                 Information = zusatz2
             };
             offer.ExtendedInformation.Add(ei2);
         }
         if (zusatz3 != "")
         {
             ExtendedInformation ei3 = new ExtendedInformation()
             {
                 Information = zusatz3
             };
             offer.ExtendedInformation.Add(ei3);
         }
         offer.ExtendedInformation.Add(ei);
         dao.Save(offer);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
         Console.WriteLine("Create Offers: Error in entry.");
     }
 }
示例#7
0
        /*Wenn die LoopList vertical gescrollt wurde, wird die TextLoopList gescrollt.*/
        private void MyLoopListOnScrolled(object sender, EventArgs e)
        {
            if (e != null)
            {
                LoopListArgs lla = (LoopListArgs)e;

                if (lla.GetId() != -1) // Wenn Minigame
                {
                    GreenScreen.Opacity    = 1;
                    Accessories.Opacity    = 1;
                    MyTextLoopList.Opacity = 0.7;
                    _isGameActive          = false;
                    _currentOffer          = new TravelOfferDao().SelectById(lla.GetId());
                }
                else
                {
                    _isGameActive          = true;
                    GreenScreen.Opacity    = 0.2;
                    Accessories.Opacity    = 0.2;
                    MyTextLoopList.Opacity = 0;
                }

                SetNewHat();

                switch (lla.GetDirection())
                {
                case Direction.Top:
                    _waitForTextList = MyTextLoopList.Anim(true);
                    break;

                case Direction.Down:
                    _waitForTextList = MyTextLoopList.Anim(false);
                    break;
                }
                ResetDragDirectionObvious();
                if (!_unclicked)
                {
                    _doDrag = true;
                }
            }
        }
示例#8
0
        /// <summary>
        /// Writes the informations given by the object to the info banner screen
        /// </summary>
        /// <param name="offer">Offer which like to show</param>
        public void Start(TravelOffer offer)
        {
            char   star        = '\u2605';
            String bullet      = Convert.ToString('\u2023');
            String euro        = Convert.ToString('\u20AC');
            String ratingStars = "";

            for (int i = 0; i <= offer.HotelRating; i++)
            {
                ratingStars += Convert.ToString(star);
            }
            if (offer.Category.CategoryName == "Wandern")
            {
                Category.Text = "Wanderurlaub";
            }
            else
            {
                Category.Text = offer.Category.CategoryName + "urlaub";
            }
            Stars.Text          = ratingStars;
            HotelName.Text      = offer.HotelName;
            Place.Text          = offer.Place;
            PricePerPerson.Text = offer.PricePerPerson + ",- " + euro + "\npro Person";
            TravelInfo.Text     = offer.DayCount + "-tägige " + offer.TravelType + "\ninkl. " + offer.BoardType;

            string extInfo = "";

            foreach (ExtendedInformation information in offer.ExtendedInformation)
            {
                extInfo += (bullet + " " + information.Information + "\n");
            }
            ExtendetInfo.Text = extInfo;

            //var iterator = offer.ExtendedInformation.GetEnumerator();
            ////ExtendetInfoImg1.Source = new BitmapImage(){ Source = new BitmapImage(new Uri(Directory.GetFiles(Environment.CurrentDirectory + @"\Images\Arrow.png").First(), UriKind.RelativeOrAbsolute)), Stretch = Stretch.Fill };
            //ExtendetInfo1.Text = (iterator.MoveNext()) ? iterator.Current.Information : "";
            //ExtendetInfo2.Text = (iterator.MoveNext()) ? iterator.Current.Information : "";
            //ExtendetInfo3.Text = (iterator.MoveNext()) ? iterator.Current.Information : "";
            //ExtendetInfo4.Text = (iterator.MoveNext()) ? iterator.Current.Information : "";
        }
        public void SetSpashScreenOffer(TravelOffer offer)
        {
            char   star        = '\u2605';
            String bullet      = Convert.ToString('\u2023');
            String euro        = Convert.ToString('\u20AC');
            String ratingStars = "";

            if (offer != null)
            {
                _currentOffer = offer;
                if (_currentOffer.Category.CategoryName == "Wandern")
                {
                    Category.Text = "Wanderurlaub";
                }
                else
                {
                    Category.Text = _currentOffer.Category.CategoryName + "urlaub";
                }

                for (int i = 0; i <= _currentOffer.HotelRating; i++)
                {
                    ratingStars += Convert.ToString(star);
                }


                Stars.Text          = ratingStars;
                HotelName.Text      = _currentOffer.HotelName;
                Place.Text          = _currentOffer.Place;
                PricePerPerson.Text = _currentOffer.PricePerPerson + ",- " + euro + "\npro Person";
                TravelInfo.Text     = _currentOffer.DayCount + "-tägige " + _currentOffer.TravelType + ", inkl. " + _currentOffer.BoardType;
                string extInfo = "";
                foreach (ExtendedInformation information in _currentOffer.ExtendedInformation)
                {
                    extInfo += (bullet + "  " + information.Information + "\n");
                }
                ExtendedInfo.Text = extInfo;
            }
        }
示例#10
0
        /// <summary>
        /// Loads offers from db and add it to loop list
        /// </summary>
        /// <param name="kinectProjectUiBuilder"></param>
        /// <param name="firstShownOffer">offer which should shown first</param>
        public void LoadElementsIntoList(KinectProjectUiBuilder kinectProjectUiBuilder, TravelOffer firstShownOffer)
        {
            var offerDao = new TravelOfferDao();
            List <LoopListEntry> list   = new List <LoopListEntry> ();
            List <TravelOffer>   dbList = offerDao.SelectAllTopOffers();

            foreach (var offer in dbList)
            {
                Grid grid = new Grid();
                BuildBackground(grid, offer.ImgPath);
                BuildInfoBox(grid, offer);

                LoopListEntry entry = new LoopListEntry {
                    FrameworkElement = grid, Id = offer.OfferId
                };

                if (offer.OfferId == firstShownOffer.OfferId)
                {
                    list.Insert(0, entry);
                }
                else
                {
                    list.Add(entry);
                }
            }
            try
            {
                MiniGame.MiniGameControl mg = new MiniGame.MiniGameControl();
                mg.Start(KinectHelper.Instance.Sensor);
                KinectHelper.Instance.ReadyEvent += (sender, _) => Instance_ReadyEvent(mg, kinectProjectUiBuilder.GetLoopList());

                LoopListEntry entry = new LoopListEntry {
                    FrameworkElement = mg, Id = -1
                };
                list.Add(entry);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            kinectProjectUiBuilder.AddRow("Top", list);

            //todo maybe ask db for categories and not enum
            foreach (CategoryEnum category in Enum.GetValues(typeof(CategoryEnum)).Cast <CategoryEnum>())
            {
                list   = new List <LoopListEntry>();
                dbList = offerDao.SelectOfferyByCategory(category);
                foreach (var offer in dbList)
                {
                    Grid grid = new Grid();
                    BuildBackground(grid, offer.ImgPath);
                    BuildInfoBox(grid, offer);
                    LoopListEntry entry = new LoopListEntry {
                        FrameworkElement = grid, Id = offer.OfferId
                    };
                    list.Add(entry);
                }
                kinectProjectUiBuilder.AddRow(dbList.First().Category.CategoryName, list);
            }
        }
示例#11
0
 public void StartDisplay(Database.TravelOffer lastTravel)
 {
     _currentOffer = lastTravel;
     PaintImage(_currentOffer.ImgPath);
     StartGreenScreenAndHat();
 }