Inheritance: BasePage
示例#1
0
        public void Dictionary()
        {
            IClassValidator validator = GetClassValidator(typeof(Tv));

            Tv tv = new Tv();
            tv.name = "France 2";
            Show showOk = new Show();
            showOk.name = "Tout le monde en parle";
            Show showNok = new Show();
            showNok.name = null;
            tv.shows.Add("Midnight", showOk);
            tv.shows.Add("Primetime", showNok);
            tv.shows.Add("Nothing", null);
            var values = validator.GetInvalidValues(tv).ToArray();
            values.Should().Not.Be.Empty();
            values.Single().PropertyPath.Should().Be.EqualTo("shows[Primetime].name");

            //Inverted dictionary
            tv = new Tv();
            tv.name = "France 2";
            tv.validatableInKey = new Dictionary<Simple, string>();
            tv.validatableInKey.Add(new Simple("Exalibur"), "Coll1");
            tv.validatableInKey.Add(new Simple(), "Coll2");
            values = validator.GetInvalidValues(tv).ToArray();
            values.Should().Not.Be.Empty();
            values.Single().PropertyPath.Should().Be.EqualTo("validatableInKey[null].name");
        }
        public void Dictionary()
        {
            IClassValidator validator = GetClassValidator(typeof(Tv));

            Tv tv = new Tv();
            tv.name = "France 2";
            Show showOk = new Show();
            showOk.name = "Tout le monde en parle";
            Show showNok = new Show();
            showNok.name = null;
            tv.shows.Add("Midnight", showOk);
            tv.shows.Add("Primetime", showNok);
            tv.shows.Add("Nothing", null);
            InvalidValue[] values = validator.GetInvalidValues(tv);
            Assert.AreEqual(1, values.Length);
            Assert.AreEqual("shows[Primetime].name", values[0].PropertyPath);

            //Inverted dictionary
            tv = new Tv();
            tv.name = "France 2";
            tv.validatableInKey = new Dictionary<Simple, string>();
            tv.validatableInKey.Add(new Simple("Exalibur"), "Coll1");
            tv.validatableInKey.Add(new Simple(), "Coll2");
            values = validator.GetInvalidValues(tv);
            Assert.AreEqual(1, values.Length);
            Assert.AreEqual("validatableInKey[null].name", values[0].PropertyPath);
        }
        private void UpdateItems(Producer producer)
        {
            var shows = _rssReader.ReadOne(producer.FeedUrl);
            var allLinks = shows.Items.Select(x => x.Link).ToArray();
            var existingLinks = _db.Shows.AsQueryable()
                .Where(x => allLinks.Contains(x.Link))
                .Select(x => x.Link)
                .Distinct()
                .ToArray();

            LoggerService.Info("Received to be updated: " + allLinks);
            shows.Items
                .Where(x => !existingLinks.Contains(x.Link))
                .ToList()
                .ForEach(x =>
                {
                    var show = new Show
                    {
                        Title = x.Title,
                        Description = x.Description,
                        Mp3 = x.Mp3,
                        PublicationDate = x.PublicationDate,
                        Link = x.Link,
                        ProducerName = producer.Name,
                        ProducerUrl = producer.Url
                    };

                    if (x.PublicationDate > DateTime.Now.AddYears(-10))
                        _db.Shows.Save(show);
                });
        }
    protected void btnShow_Click(object sender, EventArgs e)
    {
        int vKey = (int)Session["venueKey"];
        DateTime shDate = Calendar1.SelectedDate;
        Show s = new Show();
        s.ShowName = txtShowName.Text;
        s.ShowDate = shDate;
        s.VenueKey = vKey;
        s.ShowTime = TimeSpan.Parse(txtTime.Text);
        s.ShowTicketInfo = txtInfo.Text;

        ShowDetail sd = new ShowDetail();
        sd.ArtistKey = int.Parse(lblArtistKey.Text);
        sd.ShowDetailArtistStartTime = TimeSpan.Parse(txtArtistStart.Text);
        sd.ShowDetailAdditional = txtAdditional.Text;

        bool result = sdsc.AddShow(s, sd);
        if (!result)
        {
            lblResult.Text = "Show was not entered";
        }
        else
        {
            lblResult.Text = "Show was Saved";
        }


    }
    //Add the show and show details:
    public bool AddShow(Show s, ShowDetail sd)
    {
       // Use these for test client; must already exist in db: 
       // s.VenueKey = 4;
       // sd.Artist = 6;
        bool result = true;
       try
        {
           
            Show show = new Show();
            show.ShowName = s.ShowName;
            show.ShowDate = s.ShowDate;
            show.ShowDateEntered = DateTime.Now;
            show.VenueKey = s.VenueKey;
            show.ShowTime = s.ShowTime;
            show.ShowTicketInfo = s.ShowTicketInfo;
            showTrackerDb.Shows.Add(show);

            ShowDetail showDetail = new ShowDetail();
            showDetail.ArtistKey = sd.ArtistKey;
            showDetail.Show = show;
            showDetail.ShowDetailAdditional = sd.ShowDetailAdditional;
            showDetail.ShowDetailArtistStartTime = sd.ShowDetailArtistStartTime;
            showTrackerDb.ShowDetails.Add(showDetail);

            showTrackerDb.SaveChanges();
  
        }
        catch
        {
            result = false;
        }
        return result;

    }
    public int AddShow(ShowLite sl)
    {
        int result = 1;

        sl.VenueKey = 1;

        Show s = new Show();

        var vk = from v in db.Shows
                 where v.Venue.VenueName.Equals(sl.ShowName)
                 select new { v.VenueKey };

        s.VenueKey = sl.VenueKey;
        s.ShowName = sl.ShowName;
        s.ShowDate = sl.ShowDate;
        s.ShowTime = sl.ShowTime;
        s.ShowTicketInfo = sl.ShowTicket;
        s.ShowDateEntered = DateTime.Now;

        try
        {

            db.Shows.Add(s);
            db.SaveChanges();
        }
        catch (Exception ex)
        {
            result = 0;
            throw ex;
        }
        return result;
    }
示例#7
0
        public static int ReverseChronologicalShowComparison(Show x, Show y)
        {
            if (object.ReferenceEquals(x, y))
            {
                return 0;
            }

            if (x.Year < y.Year)
            {
                return 1;
            }
            if (x.Year > y.Year)
            {
                return -1;
            }

            if ((byte)x.Quarter < (byte)y.Quarter)
            {
                return 1;
            }
            if ((byte)x.Quarter < (byte)y.Quarter)
            {
                return -1;
            }

            return string.Compare(x.Title, y.Title, true);
        }
示例#8
0
 static void InitShows()
 {
     Show show = new Show{ Name = "Breaking Bad"
                         , Description = "Informed he has terminal cancer, an underachieving chemistry genius "  +
                                           "turned high school chemistry teacher turns to using his expertise in " +
                                           "chemistry to provide a legacy for his family..."                       +
                                           " by producing the world's highest quality crystal meth."
                         };
     Season season = new Season
                         {
                            Number = 1
                          , Name = "1"
                          , Debut = new DateTime(2008, 1, 28)
                          , Finale = new DateTime(2008, 3, 10)
                         };
     Episode episode = new Episode
                           {
                                 Title = "Pilot"
                               , Duration = 40
                               , Synopsis =
                                    "Walter White, a 50-year old chemistry teacher, secretly begins making crystal methamphetamine"
                               +    " to support his family when he finds out that he has terminal lung cancer. He teams up with a former student,"
                               +    " Jesse Pinkman, who is a meth dealer. Jesse is trying to sell the meth but the dealers snatch him and make him"
                               +    " show them the lab. Walter knows they intend to kill him so he poisons them while showing them his recipe."
                               , Score = 4
                           };
     ShowService.AddShow(show);
     ShowService.AddSeasonToShow(show.Name, season);
     ShowService.AddEpisodeToSeason(show.Name, 1, episode);
 }
示例#9
0
        public void AddNullSeasonTest()
        {
            Show s = new Show("Lost");

            Season s01 = null;

            s.Add(s01);
        }
示例#10
0
        // ReSharper disable once InconsistentNaming
        public void Episodes_Is_Initialized()
        {
            var show = new Show();

            Assert.NotNull(show.Episodes);

            Assert.IsType<List<Episode>>(show.Episodes);
        }
示例#11
0
 public ShowsView(Show show)
     : base("Show",
           A(ResolveUri.ForNewProposalFromExistingShow(show), "Create a Proposal")
         , Ul(Li(Text("Name: "), Text(show.Name)), 
              Li(Text("Description: "), Text(show.Description)), 
              Li(Text("Seasons: "), Ul(show.Seasons.Select( season => Li(A(ResolveUri.ForSeason(show, ShowService.GetSeason(show.Name, season.Number)), season.Name))).ToArray()))))
 {
 }
示例#12
0
 public void Populate()
 {
     String[] folders = Directory.GetDirectories(this.basedir);
     foreach (String s in folders)
     {
         Show x = new Show(s);
         this.addShow(x);
     }
 }
示例#13
0
 public ProposalForm(Show show)
     : base("New Proposal", H1(Text("New Show"))
                                                     , Form(HttpMethod.Post, ResolveUri.ForNewProposal()
                                                     , Label( "show_name", "Show Name:" )               , InputText( "show_name"       , false, show.Name        )
                                                     , Label( "show_description", "Show Description:" ) , InputText( "show_description", false, show.Description )
                                                     , InputSubmit("submit")
                                                     ))
 {
 }
示例#14
0
        // ReSharper disable once InconsistentNaming
        public void HasActor_Detects_If_Actor_Is_Loaded()
        {
            var actor = new Actor();

            var show = new Show();

            show.ShowsActors.Add(new ShowsActors(actor, null));

            Assert.True(show.HasActor(actor));
        }
示例#15
0
        // ReSharper disable once InconsistentNaming
        public void HasGenre_Detects_If_Genre_Is_Loaded()
        {
            var genre = new Genre();

            var show = new Show();

            show.ShowsGenres.Add(new ShowsGenres(genre));

            Assert.True(show.HasGenre(genre));
        }
示例#16
0
        public void AddExistingSeasonTest()
        {
            Show s = new Show("Lost");

            Season s01 = new Season(1);

            Season s02 = new Season(1);

            s.Add(s01);
            s.Add(s02);
        }
示例#17
0
        public ActionResult Create(Show show)
        {
            if (ModelState.IsValid)
            {
                db.Shows.Add(show);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(show);
        }
示例#18
0
        public void Show_Instantiate_CreatesObject()
        {
            // Arrange
            Show s = null;

            //Act
            s = new Show();

            // Assert
            Assert.IsInstanceOfType(s, typeof(Show));
        }
示例#19
0
        public void ContainsShowTest()
        {
            Show s = new Show("Lost");

            Season s01 = new Season(1);

            s01.Add(new Episode(1, "Pilot"));

            s.Add(s01);

            Assert.That(s.Contains(s01),Is.True);
        }
示例#20
0
        public void Show_ToString_ReturnsTitle()
        {
            // Arrange
            Show s = null;
            string testTitle = "The Wizard Of Oz";

            // Act
            s = new Show() { Title = testTitle };

            // Assert
            Assert.IsTrue(s.ToString() == testTitle);
        }
示例#21
0
        public IEnumerable<Episode> GetEpisodes(Show show)
        {
            var matches = this.episodes.Where(e => e.Show == show);

            if (matches.Count() == 0)
            {
                matches = this.provider.GetEpisodes(show);
                this.episodes.AddRange(matches);
            }

            return matches;
        }
	void Page_Load(object sender, EventArgs e) 
	{
		Show Show1 = new Show();
		Show1.ImagesShowPath="images/members";
		Show1.Width="180px";
		Show1.Height="180px";
		Show1.ShowType=ShowType.Show;
		Show1.TransitionType=TransitionType.QuickScroll;
		Show1.ID = "Show1";
		
		PlaceHolder1.Controls.Add(Show1);
	}
示例#23
0
        // ReSharper disable once InconsistentNaming
        public void HasActor_Does_Not_Detect_If_ActorId_Is_Zero()
        {
            var actor = new Actor();

            var show = new Show();

            show.ShowsActors.Add(new ShowsActors
                {
                    ActorId = 0
                });

            Assert.False(show.HasActor(actor));
        }
        public EditShowWindow(Show s)
        {
            InitializeComponent();

            selectedShow = s;

            if (s != null)
            {
                Name.Text = s.Name;
                NextEpisode.Text = s.NextEpisode.ToString();
                AirsOn.Text = s.AirsOn.ToString();
                Hour.Text = s.AirsOn.Hour.ToString();
            }
        }
示例#25
0
 public void Update()
 {
     switch (show)
     {
         case Show.Live:
             this.Picture.Pos += velocity;
             this.timer++;
             if (timer > lifetime)
             { this.show = Show.Dead; }
             break;
         case Show.Dead:
             break;
     }
 }
 public DelegatingKeyboardInteractiveUserInfo(
     PromptString promptPassphrase,
     PromptString promptPassword,
     PromptBool promptYesNo,
     Show showMessage,
     KeyboardInteractive promptKeyboardInteractive
     )
 {
     if (promptPassphrase != null) _promptPassphrase = promptPassphrase;
     if (promptPassword != null) _promptPassword = promptPassword;
     if (promptYesNo != null) _promptYesNo = promptYesNo;
     if (showMessage != null) _showMessage = showMessage;
     if (promptKeyboardInteractive != null) _promptKeyboardInteractive = promptKeyboardInteractive;
 }
	void Page_Load(object sender, EventArgs e) 
	{
		Show Show1 = new Show();
		Show1.Width="400px";
		Show1.Height="340px";
		Show1.ShowType=ShowType.Show;
		Show1.ID = "Show1";
		Show1.AddUrlPanel("HTMFiles/1.html");
		Show1.AddUrlPanel("HTMFiles/2.html");
		Show1.AddUrlPanel("HTMFiles/3.html");
		Show1.AddUrlPanel("HTMFiles/4.html");
		
		PlaceHolder1.Controls.Add(Show1);
	}
示例#28
0
    protected void addShow_Click(object sender, EventArgs e)
    {
        Show show = new Show();
        show.setVenue("Enter venue");
        show.setDate("01-01-2000");

        //Add band
        selectedBand.addShow(show);

        //save
        save();

        //Reload the page
        Response.Redirect(String.Format("~/band.aspx?b={0}", selectedBand.getName()));
    }
示例#29
0
        public void ClearCountTest()
        {
            Show s = new Show("Lost");

            Season s01 = new Season(1);

            s01.Add(new Episode(1, "Pilot"));

            s.Add(s01);

            Assert.That(s.Count, Is.EqualTo(1));

            s.Clear();

            Assert.That(s.Count, Is.EqualTo(0));
        }
        public static bool CanEditShow(this ControllerContext controllerContext, Show show)
        {
            #if DEBUG
            if (!controllerContext.HttpContext.Request.Params["edit"].IsNullOrWhiteSpace())
            {
                return true;
            }
            #endif
            if (controllerContext.HttpContext.User == null ||
                !controllerContext.HttpContext.User.Identity.IsAuthenticated)
            {
                return false;
            }

            return controllerContext.HttpContext.User.IsInRole(RoleNames.Archivist);
        }
示例#31
0
 private void label3_Click(object sender, EventArgs e)
 {
     timer1.Start();
     pictureBox1.Show();
     Show.Hide();
 }
 public static async Task <bool> DownloadEpisode(Show show, Episode episode)
 {
     return(await _repository.ShowRepository.DownloadEpisode(show, episode));
 }
示例#33
0
 public static void StealMessage(BadGuy badGuy, GoodGuy goodGuy, double amount)
 {
     Show.Formatted(badGuy.name + " stole " + amount + " from " + goodGuy.name);
     Show.money(badGuy);
     Show.money(goodGuy);
 }
示例#34
0
        public static void GetEpisodeImages(Show show, Dispatcher dispatcher)
        {
            foreach (var episode in show.Seasons.SelectMany(season => season.Episodes))
            {
                episode.IsLoading = true;
            }


            foreach (var season in show.Seasons.OrderByDescending(w => w.SeasonNumber))
            {
                foreach (var episode in season.Episodes.OrderByDescending(w => w.EpisodeNumber))
                {
                    var e = episode;

                    if (episode.ImageUrl != null)
                    {
                        var extension = Path.GetExtension(e.ImageUrl);
                        var file      = $"{show.ShowId}_{season.SeasonNumber}_{e.EpisodeNumber}{extension}";
                        var folder    = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                     ConfigurationManager.AppSettings["IMAGE_CACHE"]);

                        if (!Directory.Exists(folder))
                        {
                            Directory.CreateDirectory(folder);
                        }

                        var filename = Path.Combine(folder, file);

                        if (!File.Exists(filename))
                        {
                            using (var web = new WebClient())
                            {
                                web.DownloadFile(e.ImageUrl, filename);
                            }
                        }

                        dispatcher.InvokeAsync(() =>
                        {
                            try
                            {
                                if (extension?.ToUpper() == ".PNG")
                                {
                                    using (var imageStreamSource = new FileStream(filename, FileMode.Open,
                                                                                  FileAccess.Read, FileShare.Read))
                                    {
                                        var decoder = new PngBitmapDecoder(imageStreamSource,
                                                                           BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
                                        e.ImageSource = decoder.Frames[0];
                                        e.ImageSource.Freeze();
                                    }
                                }
                                else
                                {
                                    try
                                    {
                                        e.ImageSource = new BitmapImage(new Uri(filename));
                                        e.ImageSource.Freeze();
                                    }
                                    catch
                                    {
                                        //File most likely corrupted
                                        File.Delete(filename);
                                    }
                                }
                            }
                            catch
                            {
                                //supress
                            }
                        }, DispatcherPriority.Background);
                    }

                    dispatcher.InvokeAsync(() => { e.IsLoading = false; }, DispatcherPriority.Background);
                }
            }
        }
示例#35
0
 public static void CreationMessage(string name, double amount)
 {
     Show.Formatted(name + " has been created and has " + amount);
 }
示例#36
0
 private static void money(BadGuy badGuy)
 {
     Show.money(badGuy.name, badGuy.money);
 }
示例#37
0
 public static void CaptureMessage(GoodGuy goodGuy, BadGuy badGuy, double amount)
 {
     Show.Formatted(goodGuy.name + " captured " + badGuy.name + " and got " + amount);
     Show.money(goodGuy);
     Show.money(badGuy);
 }
 private string generateMissingIDIndicatorTitle(Show show)
 {
     return(this.MISSING_ID_INDICATOR + show.Title);
 }
        private void generateResults()
        {
            if (this.fileName == "")
            {
                MessageBox.Show("No file loaded. Use the Load button.");
                return;
            }

            if (this.shows.Count == 0)
            {
                XElement missingItems = (XElement)XElement.Load(this.fileName).FirstNode;

                //Create show objects by title
                foreach (var title in missingItems.Descendants("title"))
                {
                    if (this.findShow(title.Value) == null)
                    {
                        Show show = new Show();
                        show.Title = title.Value;
                        var tvShowStoredString = userSettingsTool.GetTVShowStoredStringByTitle(show.Title);

                        if (tvShowStoredString != null)
                        {
                            show.IMDB_ID = tvShowStoredString.IMDB_ID;
                            show.Website = tvShowStoredString.DownloadWebsite;
                        }
                        else
                        {
                            show.Website = this.userSettingsTool.WEBSITE_RARBG;
                        }

                        this.userSettingsTool.
                        AddOrUpdateTVShowStoredString(
                            show.Title,
                            show.IMDB_ID,
                            show.Website
                            );

                        this.shows.Add(show);
                        Console.WriteLine("added: " + show.Title);
                    }
                }

                Show currentShow = shows.First();
                foreach (var missingItem in missingItems.Elements())
                {
                    if (currentShow.Title != missingItem.Element("title").Value)
                    {
                        currentShow = findShow(missingItem.Element("title").Value);
                    }

                    Episode episode = new Episode();
                    episode.Season = missingItem.Element("season").Value;
                    episode.Number = missingItem.Element("episode").Value;
                    episode.Name   = missingItem.Element("episodeName").Value;
                    if (missingItem.Element("pubDate").Value != "")
                    {
                        episode.PubDate = missingItem.Element("pubDate").Value;
                    }

                    if (currentShow.Episodes.ContainsKey(episode.SeasonAndNumber))
                    {
                        logForm.add(currentShow.Title + " " + episode.SeasonAndNumberWithName +
                                    " has identical season and episode numbers as another episode. Try \"Force Refresh\" that show.");

                        btnLog.BackColor = System.Drawing.Color.Red;
                    }
                    else
                    {
                        currentShow.Episodes.Add(
                            episode.SeasonAndNumber,
                            episode
                            );
                    }
                }
            }

            treeResults.BeginUpdate();
            treeResults.Nodes.Clear();

            foreach (Show show in shows)
            {
                string shownTitle = show.IMDB_ID == null?this.generateMissingIDIndicatorTitle(show) : show.Title;

                TreeNode tree = new TreeNode(shownTitle);

                foreach (Episode episode in show.Episodes.Values)
                {
                    int maxAge = -1;
                    maxAge = int.TryParse(txtMaxAge.Text, out maxAge) ? maxAge : 14;

                    if (episode.Age <= maxAge)
                    {
                        tree.Nodes.Add(show.Title + " " + episode.Name, episode.SeasonAndNumber + " - " + episode.Name + " (" + episode.Age + ")");
                    }
                }

                if (tree.Nodes.Count != 0 && (txtSearch.Text != "" ? show.Title.Contains(txtSearch.Text) : true))
                {
                    treeResults.Nodes.Add(tree);
                }
            }

            // Reset the cursor to the default for all controls.
            Cursor.Current = Cursors.Default;

            // Begin repainting the TreeView.
            treeResults.EndUpdate();
        }
示例#40
0
 public static void Main(string[] args)
 {
     Show.loadShowsFromJson();
     CreateHostBuilder(args).Build().Run();
 }
示例#41
0
 public Presence(Show show) : this()
 {
     Show = show;
 }
示例#42
0
        public SearchInfo findTitle(string ShowName)
        {
            SearchInfo TVShowID = new SearchInfo();

            if (ShowName == null)
            {
                return(TVShowID);
            }
            ShowName = ShowName.Replace("Gold Rush Alaska", "Gold Rush");
            ShowName = ShowName.Replace("Tosh 0", "Tosh.0");
            List <SearchInfo> FinalList = new List <SearchInfo>();

            XDocument ShowList = XDocument.Load("http://services.tvrage.com/feeds/search.php?show=" + ShowName);

            var Categorys = from Show in ShowList.Descendants("show")
                            select new
            {
                ShowID = Show.Element("showid").Value,
                Name   = Show.Element("name").Value,
            };

            foreach (var wd in Categorys)
            {
                FinalList.Add(new SearchInfo(wd.Name, Int32.Parse(wd.ShowID)));
            }

            if (FinalList != null && FinalList.Count > 0)
            {
                if (FinalList.Count() == 0)
                {
                    return(TVShowID);                                         //return if nothing found
                }
                int    selectedSeriesId = -1;
                string selectedTitle    = "";
                if (FinalList.Count() == 1)
                {
                    selectedSeriesId = FinalList[0].SelectedValue;
                    selectedTitle    = FinalList[0].Title;
                }
                else
                {
                    if (FinalList.Count() != 0)
                    {
                        SelectMenu SelectMain = new SelectMenu(FinalList, ShowName);
                        if (SelectMain.ShowDialog() == DialogResult.OK)
                        {
                            int selectedid = SelectMain.selected;
                            if (selectedid == -1)
                            {
                                return(TVShowID);
                            }
                            selectedSeriesId = FinalList[selectedid].SelectedValue;
                            selectedTitle    = FinalList[selectedid].Title;
                            SelectMain.Close();
                        }
                        else
                        {
                            int idNumber = -1;
                            foreach (SearchInfo testIdem in selectionList)
                            {
                                if (testIdem.Title == ShowName)
                                {
                                    idNumber = testIdem.SelectedValue;
                                    break;
                                }
                            }
                            if (idNumber == -1)
                            {
                                SelectMenu SelectMain2 = new SelectMenu(FinalList, ShowName);
                                if (SelectMain2.ShowDialog() == DialogResult.OK)
                                {
                                    int selectedid = SelectMain2.selected;
                                    if (selectedid == -1)
                                    {
                                        return(TVShowID);
                                    }
                                    selectionList.Add(new SearchInfo(ShowName, selectedid));
                                    selectedSeriesId = FinalList[selectedid].SelectedValue;
                                    selectedTitle    = FinalList[selectedid].Title;
                                    SelectMain2.Close();
                                }
                            }
                            else
                            {
                                selectedSeriesId = FinalList[idNumber].SelectedValue;
                            }
                        }
                    }
                }

                if (selectedSeriesId == -1)
                {
                    return(TVShowID);                                          //return if nothing is found
                }
                TVShowID.SelectedValue = selectedSeriesId;
                TVShowID.Title         = selectedTitle;
            }
            TVShowID.Title = TVShowID.Title.Replace(":", "").Replace("?", "").Replace("/", "").Replace("<", "").Replace(">", "").Replace("\\", "").Replace("*", "").Replace("|", "").Replace("\"", "");
            return(TVShowID);
        }
示例#43
0
 public Presence(Show show, string status)
     : this(show)
 {
     Status = status;
 }
示例#44
0
 public Presence(Show show, string status, int priority)
     : this(show, status)
 {
     Priority = priority;
 }
示例#45
0
 private void Form1_Load(object sender, EventArgs e)
 {
     pictureBox1.Hide();
     Show.Hide();
 }
示例#46
0
 private Task AddShow(Show show)
 {
     this.showContext.Shows.Add(show);
     return(this.showContext.SaveChangesAsync());
 }
示例#47
0
 private static void money(string name, double amount)
 {
     Show.Formatted(name + " now has a total of " + amount);
 }
示例#48
0
        public static void GetEpisodeImages(Show show)
        {
            foreach (var episode in show.Seasons.SelectMany(season => season.Episodes))
            {
                episode.IsLoading = true;
            }

            Task.Factory.StartNew(() =>
            {
                foreach (var season in show.Seasons.OrderByDescending(w => w.SeasonNumber))
                {
                    foreach (var episode in season.Episodes.OrderByDescending(w => w.EpisodeNumber))
                    {
                        var e = episode;

                        if (episode.ImageUrl != null)
                        {
                            var extension = Path.GetExtension(e.ImageUrl);
                            var file      = string.Format("{0}_{1}_{2}{3}", show.ShowId, season.SeasonNumber,
                                                          e.EpisodeNumber, extension);
                            var folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                      ConfigurationManager.AppSettings["IMAGE_CACHE"]);

                            if (!Directory.Exists(folder))
                            {
                                Directory.CreateDirectory(folder);
                            }

                            var filename = Path.Combine(folder, file);

                            if (!File.Exists(filename))
                            {
                                using (var web = new WebClient())
                                {
                                    web.DownloadFile(e.ImageUrl, filename);
                                }
                            }

                            Execute.BeginOnUIThread(() =>
                            {
                                try
                                {
                                    if (extension.ToUpper() == ".PNG")
                                    {
                                        Stream imageStreamSource = new FileStream(filename, FileMode.Open,
                                                                                  FileAccess.Read, FileShare.Read);
                                        var decoder = new PngBitmapDecoder(imageStreamSource,
                                                                           BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
                                        e.ImageSource = decoder.Frames[0];
                                    }
                                    else
                                    {
                                        try
                                        {
                                            e.ImageSource = new BitmapImage(new Uri(filename));
                                        }
                                        catch
                                        {
                                            //File most likely corrupted
                                            File.Delete(filename);
                                        }
                                    }
                                }
                                catch
                                {
                                    //supress
                                }
                            });
                        }

                        Execute.BeginOnUIThread(() => e.IsLoading = false);
                    }
                }
            });
        }
示例#49
0
 private static void money(GoodGuy goodGuy)
 {
     Show.money(goodGuy.name, goodGuy.money);
 }
示例#50
0
 private static void PrintArray(object[] array)
 {
     Console.WriteLine("Test Array: {0}", Show.Array(array));
 }
示例#51
0
        private void MenuBarGame(object sender, EventArgs args)
        {
            _gameMenu = new GameMenu("MenuBarGame", Palette.Copy());
            _gameMenu.Items.Add("Tax Rate").OnSelect((s, a) => GameTask.Enqueue(Show.TaxRate));
            _gameMenu.Items.Add("Luxuries Rate").OnSelect((s, a) => GameTask.Enqueue(Show.LuxuryRate));
            _gameMenu.Items.Add("FindCity").OnSelect((s, a) => GameTask.Enqueue(Show.Search));
            _gameMenu.Items.Add("Options").OnSelect((s, a) => GameTask.Enqueue(Show.Screen <GameOptions>()));
            _gameMenu.Items.Add("Save Game").SetEnabled(Game.GameTurn > 0 && Common.AllowSaveGame).OnSelect((s, a) => GameTask.Enqueue(Show.Screen <SaveGame>()));
            _gameMenu.Items.Add("REVOLUTION!").OnSelect((s, a) => GameTask.Enqueue(Show.Screen <Revolution>()));
            _gameMenu.Items.Add(null);
            if (Settings.DebugMenu)
            {
                _gameMenu.Items.Add("Debug Options").OnSelect((s, a) => GameTask.Enqueue(Show.Screen <DebugOptions>()));
                _gameMenu.Items.Add(null);
            }
            _gameMenu.Items.Add("Retire").Disable();
            _gameMenu.Items.Add("QUIT to DOS").OnSelect((s, a) => GameTask.Enqueue(Show.Screen <ConfirmQuit>()));

            _menuX = 16;
            _menuY = 8;

            _update = true;
        }
示例#52
0
        public virtual async Task ScrapeData()
        {
            Console.WriteLine("Started TvMazeScrape job");

            var latestShowId = ShowsRepository.GetLatestAddedShowId();
            int nextPage     = 0;

            if (latestShowId > 0)
            {
                decimal pageNr = latestShowId / 250;
                nextPage = (int)Math.Floor(pageNr);
            }

            var shows = await TvMazeApi.GetShows(nextPage);

            Console.WriteLine("Loaded 250 shows");

            foreach (var show in shows)
            {
                var existingShow = DbContext.Shows.Where(s => s.ShowId.Equals(show.Id)).FirstOrDefault();
                if (existingShow != null)
                {
                    continue;
                }

                var castResponse = await TvMazeApi.GetCastMembers((int)show.Id);

                Console.WriteLine("Received cast for show");

                var newShow = new Show()
                {
                    ShowId = (int)show.Id,
                    Name   = show.Name
                };

                await ShowsRepository.AddShow(newShow);

                HashSet <long> AddedPersons = new HashSet <long>();

                foreach (var castMember in castResponse)
                {
                    // Some shows contain dubplicates
                    if (AddedPersons.Contains(castMember.Person.Id))
                    {
                        continue;
                    }

                    var person = PersonRepository.CreateOrGet(new Person()
                    {
                        PersonId = (int)castMember.Person.Id,
                        Name     = castMember.Person.Name,
                        Birthday = castMember.Person.Birthday?.DateTime ?? new DateTime(1970, 1, 1)
                    });

                    var showPerson = new ShowPerson()
                    {
                        PersonId = person.PersonId,
                        ShowId   = newShow.ShowId
                    };
                    Console.WriteLine($"ShowId {newShow.ShowId}, PersonId {person.PersonId}");
                    DbContext.ShowPersons.Add(showPerson);
                    AddedPersons.Add(castMember.Person.Id);
                }
                DbContext.SaveChanges();

                Console.WriteLine($"Added show {newShow.Name}");

                System.Threading.Thread.Sleep(1000);
            }
        }
示例#53
0
 public static void StealMessage2(BadGuy badGuy, BadGuy otherBadGuy, double amount)
 {
     Show.Formatted(badGuy.name + " stole " + amount + " from " + otherBadGuy.name);
     Show.money(badGuy);
     Show.money(otherBadGuy);
 }
示例#54
0
 private IEnumerable <IResult> OpenOutput()
 {
     yield return(Show.Tool <IOutput>());
 }
示例#55
0
 public static void GiveMessage(GoodGuy giver, GoodGuy receiver, double amount)
 {
     Show.Formatted(giver.name + " gave " + amount + " to " + receiver.name);
     Show.money(giver);
     Show.money(receiver);
 }
示例#56
0
        private void FadeStep()
        {
            switch (state)
            {
            case FadingState.Show:
                if (!visible)
                {
                    visible = true;
                    Show?.Invoke();
                    opacity = 0;
                    ChangeOpacity?.Invoke(this, opacity);
                }
                else if (opacity < ShownMinus)
                {
                    opacity += StepIn;
                    ChangeOpacity?.Invoke(this, opacity);
                }
                else if (opacity != Shown)
                {
                    opacity = Shown;
                    ChangeOpacity?.Invoke(this, Shown);
                    StartStopTimer(FadingState.Idle);
                }

                break;

            case FadingState.ShowTransparent:
                if (!visible)
                {
                    visible = true;
                    Show?.Invoke();
                    opacity = 0;
                    ChangeOpacity?.Invoke(this, opacity);
                }
                else if (opacity < TransparentMinus)
                {
                    opacity += StepIn;
                    ChangeOpacity?.Invoke(this, opacity);
                }
                else if (opacity > TransparentPlus)
                {
                    opacity -= StepOut;
                    ChangeOpacity?.Invoke(this, opacity);
                }
                else if (opacity != Transparent)
                {
                    ChangeOpacity?.Invoke(this, Transparent);
                    StartStopTimer(FadingState.Idle);
                }

                break;

            case FadingState.Hide:
                if (opacity > StepOut)
                {
                    opacity -= StepOut;
                    ChangeOpacity?.Invoke(this, opacity);
                }
                else if (visible)
                {
                    opacity = 0;
                    ChangeOpacity?.Invoke(this, opacity);
                    visible = false;
                    Hide?.Invoke();
                    StartStopTimer(FadingState.Idle);
                }

                break;

            case FadingState.Idle:
            default:
                StartStopTimer(FadingState.Idle);
                break;
            }
        }
示例#57
0
        private void showFieldTooltip(Point position)
        {
            var cursorPosition = _view.PointToClient(position);
            var hitInfo        = _view.CalcHitInfo(cursorPosition);

            var dataSource = _view.FindRow(hitInfo.RowHandle);

            if (!hitInfo.AlignButtonDirection.HasValue && (dataSource == null || !hitInfo.FieldBounds.HasValue))
            {
                Hide?.Invoke();
                return;
            }

            if (hitInfo.IsSortButton)
            {
                Show?.Invoke(new TooltipModel
                {
                    Id           = $"{_view.Name}.{hitInfo.RowHandle}.{hitInfo.FieldName}.sort",
                    ObjectBounds = hitInfo.ButtonBounds,
                    Control      = _view,
                    Title        = "Sort by " + hitInfo.FieldName,
                    Text         =
                        "Click to sort by this field.\r\n" +
                        "\r\n" +
                        "Shift+Click to ADD this field to sorting. Currently sorted fields will have higher sort priority.\r\n" +
                        "\r\n" +
                        "Ctrl+Click to REMOVE this field from sorting. Other fields sort order will remain unchanged.\r\n" +
                        "\r\n" +
                        "Repeated click on sort button cycles sort order between Ascending, Descending, None.\r\n" +
                        "\r\n" +
                        "Hold Alt key when hovering to prevent showing this button. Helps selecting text in small fields.",
                    Clickable = false
                });
            }
            else
            {
                if (hitInfo.IsSearchButton)
                {
                    throw new NotSupportedException();
                }

                if (hitInfo.CustomButtonIndex >= 0)
                {
                    var tooltip = new TooltipModel
                    {
                        Id           = $"{_view.Name}.{hitInfo.RowHandle}.{hitInfo.FieldName}.",
                        ObjectBounds = hitInfo.ButtonBounds,
                        Control      = _view,
                        Clickable    = false
                    };

                    if (hitInfo.IsAddButton())
                    {
                        tooltip.Id  += "add";
                        tooltip.Text = "Save this deck";
                    }
                    else if (hitInfo.IsRemoveButton())
                    {
                        tooltip.Id   += "remove";
                        tooltip.Title = "Remove this deck";
                        tooltip.Text  = "Removes this deck from the list.\r\n" +
                                        "NOTE: be careful, you cannot undo this.";
                    }
                    else if (hitInfo.IsRenameButton())
                    {
                        tooltip.Id  += "rename";
                        tooltip.Text = "Rename this deck";
                    }
                    else if (hitInfo.IsOpenButton())
                    {
                        tooltip.Id   += "open";
                        tooltip.Title = "Open deck";
                        tooltip.Text  = "Open the deck in it's original form as it was edited and saved.\r\n\r\n" +
                                        "Left-click to open in this tab, currently opened deck will be replaced.\r\n" +
                                        "Middle-click to open in new tab.\r\n\r\n";
                    }
                    else if (hitInfo.IsOpenTransformedButton())
                    {
                        tooltip.Id   += "open_transformed";
                        tooltip.Title = "Open transformed deck";
                        tooltip.Text  = "In transformed deck card variants from your collection and with known price are used whenever possible.\r\n\r\n" +
                                        "Left-click to open in this tab, currently opened deck will be replaced.\r\n" +
                                        "Middle-click to open in new tab.\r\n\r\n";
                    }
                    else
                    {
                        return;
                    }

                    Show?.Invoke(tooltip);
                }
                else if (hitInfo.AlignButtonDirection.HasValue)
                {
                    Show?.Invoke(new TooltipModel
                    {
                        Id           = $"{_view.Name}.{hitInfo.RowHandle}.{hitInfo.FieldName}.align",
                        ObjectBounds = _view.GetAlignButtonBounds(hitInfo),
                        Control      = _view,
                        Title        = "Viewport alignment",
                        Text         = "Aligns viewport by this corner.\r\n" +
                                       "\r\n" +
                                       "If this corner would be truncated\r\n" +
                                       "viewport will shift to fit it into the screen.",
                        Clickable = false
                    });
                }
                else if (hitInfo.FieldName != null)
                {
                    Show?.Invoke(new TooltipModel
                    {
                        Id               = $"{_view.Name}.{hitInfo.RowHandle}.{hitInfo.FieldName}",
                        ObjectBounds     = hitInfo.FieldBounds.Value,
                        Control          = _view,
                        Title            = hitInfo.FieldName,
                        Text             = _view.GetText(hitInfo.RowHandle, hitInfo.FieldName),
                        HighlightRanges  = _view.GetHighlightTextRanges(hitInfo.RowHandle, hitInfo.FieldName),
                        HighlightOptions = _view.ProbeCard.HighlightOptions,
                        Clickable        = true
                    });
                }
            }
        }
示例#58
0
 public async Task SaveObjectAsync(Show show)
 {
     await _client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId), show);
 }
 public static async Task <List <EztvTorrent> > GetEpisodeTorrentList(Show show, Episode episode)
 {
     return(await _repository.ShowRepository.GetEpisodeTorrentList(show, episode));
 }
示例#60
0
        static void Opcao(string categoria)
        {
            int opcao = 0;

            do
            {
                Console.WriteLine("\nDigite a opção:\n ");
                System.Console.WriteLine("1 - Cadastrar " + categoria + " ");
                System.Console.WriteLine("2 - Pesquisar " + categoria + " por TITULO");
                System.Console.WriteLine("3 - Pesquisar " + categoria + " por DATA");
                System.Console.WriteLine("9 - Voltar\n");

                opcao = Convert.ToInt16(Console.ReadLine());

                switch (opcao)
                {
                case 1:
                {
                    bool cadastrosucesso = false;

                    System.Console.Write("\nTítulo: ");
                    string titulo = Console.ReadLine();
                    System.Console.Write("Local: ");
                    string local = Console.ReadLine();
                    System.Console.Write("Lotação: ");
                    int lotacao = Convert.ToInt16(Console.ReadLine());
                    System.Console.Write("Duração: ");
                    string duracao = Console.ReadLine();
                    System.Console.Write("Data (dd/mm/aaaa): ");
                    DateTime data = Convert.ToDateTime(Console.ReadLine());
                    System.Console.Write("Classificação: ");
                    int classificacao = Convert.ToInt16(Console.ReadLine());

                    switch (categoria)
                    {
                    case "Show":
                    {
                        System.Console.Write("Artista: ");
                        string artista = Console.ReadLine();
                        System.Console.Write("Gênero: ");
                        string generomusical = Console.ReadLine();

                        Show show = new Show(titulo, local, lotacao, duracao, classificacao,
                                             data, artista, generomusical);

                        cadastrosucesso = show.Cadastrar();
                        break;
                    }

                    case "Teatro":
                    {
                        System.Console.Write("Diretor: ");
                        string diretor = Console.ReadLine();
                        System.Console.Write("Elenco (Digite o nome +Enter ou 0 +Enter para concluir): ");
                        string        pessoa = Console.ReadLine();
                        List <string> elenco = new List <string>();
                        elenco.Add(pessoa);

                        while (pessoa != "0")
                        {
                            System.Console.Write("Nome: ");
                            pessoa = Console.ReadLine();
                            if (pessoa != "0")
                            {
                                elenco.Add(pessoa);
                            }
                        }

                        Teatro teatro = new Teatro(titulo, local, lotacao, duracao, classificacao,
                                                   data, diretor, elenco.ToArray());

                        cadastrosucesso = teatro.Cadastrar();
                        break;
                    }

                    case "Cinema":
                    {
                        System.Console.Write("Gênero: ");
                        string genero = Console.ReadLine();
                        System.Console.Write("Sessão (hh:mm:ss): ");
                        string     stringSessao = (Console.ReadLine());
                        DateTime[] sessao       = new DateTime[1];

                        int i = 0;
                        while (stringSessao != "0")
                        {
                            sessao[i] = Convert.ToDateTime(stringSessao);
                            sessao[i].ToShortTimeString();
                            i++;

                            System.Console.Write("Sessão (hh:mm:ss) ou 0+Enter para concluir: ");
                            stringSessao = (Console.ReadLine());

                            if (stringSessao != "0")
                            {
                                Array.Resize(ref sessao, sessao.Length + 1);
                            }
                        }

                        Cinema cinema = new Cinema(titulo, local, lotacao, duracao, classificacao, data, sessao, genero);

                        cadastrosucesso = cinema.Cadastrar();
                        break;
                    }
                    }

                    if (cadastrosucesso)
                    {
                        System.Console.WriteLine("\nCadastrado com sucesso.");
                    }
                    else
                    {
                        System.Console.WriteLine("\nErro.");
                    }

                    break;
                }

                case 2:
                {
                    System.Console.Write("\n" + categoria + " Título: ");
                    string titulo    = Console.ReadLine();
                    string resultado = "";

                    if (categoria == "Show")
                    {
                        Show show = new Show();
                        resultado = show.Pesquisar(titulo);
                    }
                    else if (categoria == "Teatro")
                    {
                        Teatro teatro = new Teatro();
                        resultado = teatro.Pesquisar(titulo);
                    }
                    else
                    {
                        Cinema cinema = new Cinema();
                        resultado = cinema.Pesquisar(titulo);
                    }

                    System.Console.WriteLine("\n" + resultado);
                    break;
                }

                case 3:
                {
                    System.Console.Write("\n" + categoria + " Data (dd/mm/aaaa): ");
                    string   stringData = Console.ReadLine();
                    DateTime data       = Convert.ToDateTime(stringData);
                    string   resultado  = "";

                    if (categoria == "Show")
                    {
                        Show show = new Show();
                        resultado = show.Pesquisar(data);
                    }
                    else if (categoria == "Teatro")
                    {
                        Teatro teatro = new Teatro();
                        resultado = teatro.Pesquisar(data);
                    }
                    else
                    {
                        Cinema cinema = new Cinema();
                        resultado = cinema.Pesquisar(data);
                    }

                    System.Console.WriteLine("\n" + resultado);
                    break;
                }

                case 9:
                    break;

                default:
                    break;
                }
            }while(opcao != 9);
        }