Ejemplo n.º 1
0
        static public DialogResult ShowEndTourPopupModal(TourDocument tour)
        {
            CloseTourPopups();
            if (endTour != null)
            {
                endTour.Close();
                endTour = null;
            }

            endTour           = new TourPopup();
            endTour.PopupType = TourPopup.PopupTypes.TourOver;
            Tour tourResult = FolderBrowser.GetRelatedTour(tour.Id);

            if (tourResult == null)
            {
                tourResult = FolderBrowser.GetRelatedTour(tour.TagId);
            }

            if (tourResult == null)
            {
                tourResult                   = new Tour();
                tourResult.Author            = tour.Author;
                tourResult.Id                = tour.Id;
                tourResult.AuthorUrl         = tour.AuthorUrl;
                tourResult.Description       = tour.Description;
                tourResult.AuthorImage       = tour.AuthorImage;
                tourResult.OrgName           = tour.OrgName;
                tourResult.OrganizationUrl   = tour.OrgUrl;
                tourResult.Title             = tour.Title;
                tourResult.AverageUserRating = 3;
            }
            Cursor.Show();
            endTour.TourResult = tourResult;
            return(endTour.ShowDialog());
        }
Ejemplo n.º 2
0
        private void TourPopup_Load(object sender, EventArgs e)
        {
            if (popupType == PopupTypes.Popup)
            {
                Height = 335;

                Preview.Visible        = true;
                CloseTour.Visible      = false;
                WatchAgain.Visible     = false;
                tourWrapPanel.Visible  = false;
                averageStars.Visible   = true;
                ratingLabel.Visible    = true;
                runLengthLabel.Visible = true;
                runLength.Visible      = true;
            }
            else
            {
                Height                 = 405;
                TourTitle.Left        -= 53;
                TourTitle.Width        = 430;
                Preview.Visible        = false;
                CloseTour.Visible      = true;
                WatchAgain.Visible     = true;
                tourWrapPanel.Visible  = true;
                averageStars.Visible   = false;
                ratingLabel.Visible    = false;
                runLengthLabel.Visible = false;
                runLength.Visible      = false;

                Left = (Earth3d.MainWindow.RenderWindow.ClientRectangle.Width - this.Width) / 2;
                Top  = (Earth3d.MainWindow.RenderWindow.ClientRectangle.Height - this.Height) / 2;

                MyRating.Stars = GetMyRating(tourResult.Id);
            };

            averageStars.Stars = tourResult.AverageUserRating;


            TourTitle.Text = tourResult.Title;

            if (TourTitle.Text.Length < 23)
            {
                TourTitle.Font = UiTools.StandardGargantuan;
            }
            else if (TourTitle.Text.Length < 30)
            {
                TourTitle.Font = UiTools.StandardHuge;
            }
            else if (TourTitle.Text.Length < 40)
            {
                TourTitle.Font = UiTools.StandardLarge;
            }
            else if (TourTitle.Text.Length < 50)
            {
                TourTitle.Font = UiTools.StandardRegular;
            }
            else
            {
                TourTitle.Font = UiTools.StandardSmall;
            }

            TourDescription.Text = tourResult.Description;
            authorImage.Image    = tourResult.AuthorImage;
            authorUrl.Text       = tourResult.Author;
            if (tourResult.OrgName != "None")
            {
                orgUrl.Text = tourResult.OrgName;
            }
            this.ttTourPopup.SetToolTip(TourTitle, tourResult.Title);


            Rectangle rect = Screen.GetWorkingArea(this);

            if (this.Left + this.Width > rect.Width)
            {
                this.Left -= (this.Left + this.Width) - rect.Width;
            }

            TimeSpan ts = new TimeSpan(0, 0, (int)tourResult.LengthInSeconds);

            this.runLength.Text = String.Format("{0:00}:{1:00}:{2:00}", ts.Hours, ts.Minutes, ts.Seconds);

            fadein             = new BlendState(false, 500);
            fadein.TargetState = true;
            if (!string.IsNullOrEmpty(tourResult.RelatedTours))
            {
                string[] relatedList = tourResult.RelatedTours.Split(new char[] { ';' });
                foreach (string id in relatedList)
                {
                    Tour relatedItem = FolderBrowser.GetRelatedTour(id);
                    if (relatedItem != null)
                    {
                        relatedTours.Add(relatedItem);
                    }
                }
            }
        }