Esempio n. 1
0
        private void LoadToursViaWebService()
        {
            Cursor.Current = Cursors.WaitCursor;

            WWTWebService webService = new WWTWebService();


            TerraViewer.org.worldwidetelescope.www.Tour[] results = webService.GetToursForDateRange("", "");


            foreach (TerraViewer.org.worldwidetelescope.www.Tour resultRow in results)
            {
                Tour result = new Tour();
                result.Id          = resultRow.TourGuid.ToString();
                result.Title       = resultRow.TourTitle;
                result.Description = resultRow.TourDescription;
                result.Author      = resultRow.AuthorName;
                result.AuthorUrl   = resultRow.AuthorURL;

                //result.AuthorImageUrl = row["Title"].ToString();
                result.OrganizationUrl = resultRow.OrganizationURL;
                result.OrgName         = resultRow.OrganizationName;

                // Load tour thumbnail
                string filename = result.Id + "_tourThumb.jpg";
                //move tour url

                //todo change tours when web service moves!

                string url = String.Format("http://www.worldwidetelescope.org/wwtweb/GetTourThumbnail.aspx?GUID={0}", result.Id);

                result.ThumbNail = UiTools.LoadThumbnailFromWeb(url, filename);

                filename = result.Id + "_AuthorThumb.jpg";
                url      = String.Format("http://www.worldwidetelescope.org/wwtweb/GetAuthorThumbnail.aspx?GUID={0}", result.Id);

                result.AuthorImage = UiTools.LoadThumbnailFromWeb(url, filename);


                resultsList.Add(result);
            }
            Cursor.Current = Cursors.Default;
        }
Esempio n. 2
0
        private void publishTourMenuItem_Click(object sender, EventArgs e)
        {
            if (tourEdit != null)
            {
                UiTools.ShowMessageBox(Language.GetLocalizedText(114, "Respect Copyright. Please respect the rights of artists and creators. Content such as music is protected by copyright. The music made available to you in WorldWide Telescope is protected by copyright and may be used for the sole purpose of creating tours in WorldWide Telescope. You may not share other people's content unless you own the rights or have permission from the owner."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"));
                WWTWebService webService = new WWTWebService();
                webService.Timeout = 1000000;
                string tempFile = Path.GetTempFileName();
                try
                {
                    tourEdit.Tour.SaveToFile(tempFile);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Language.GetLocalizedText(115, "There was a problem saving the tour.") + ex.Message, Language.GetLocalizedText(116, "Submission Failed"));
                }
                string tourXML = tourEdit.Tour.GetXmlSubmitString();
                byte[] tourBlob = UiTools.LoadBlob(tempFile);
                File.Delete(tempFile);

                byte[] tourThumbBlob = UiTools.LoadBlob(tourEdit.Tour.TourThumbnailFilename);
                byte[] authorThumbBlob = null;
                try
                {

                    authorThumbBlob = UiTools.LoadBlob(tourEdit.Tour.AuthorThumbnailFilename);
                }
                catch
                {
                    MessageBox.Show(Language.GetLocalizedText(117, "There was no author image. Please add one and submit again."), Language.GetLocalizedText(116, "Submission Failed"));
                    return;
                }
                TerraViewer.org.worldwidetelescope.www.Tour[] results = null;
                try
                {
                    results = webService.ImportTour(tourXML, tourBlob, tourThumbBlob, authorThumbBlob);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Language.GetLocalizedText(118, "There was a problem submitting the tour.") + ex.Message, Language.GetLocalizedText(116, "Submission Failed"));
                    return;
                }

                if (results != null && results.Length > 0)
                {
                    MessageBox.Show(Language.GetLocalizedText(119, "The tour was successfully submitted for publication. It must undergo technical review and approval before it will appear on the tour directory."), Language.GetLocalizedText(120, "Submit Tour for Publication"));
                }
                else
                {
                    MessageBox.Show(Language.GetLocalizedText(121, "There was a problem submitting the tour. Please review the tour content and make sure all fields are filled in correctly and that the total content size is below in maximum tour size."), Language.GetLocalizedText(120, "Submit Tour for Publication"));
                }

            }

        }