コード例 #1
0
        private void ShowsItemsTree_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            TreeViewItem item = (TreeViewItem)(sender as TreeView).SelectedItem;

            if (item == null)
            {
                return;
            }

            ShowControl sc = item.Tag as ShowControl;

            if (sc != null)
            {
                _currentShows.Clear();
                _currentShows.Add(sc);
                _podcasts.Clear();
                if (e.RightButton == System.Windows.Input.MouseButtonState.Pressed)
                {
                    EditSelectedItem(sc);
                    return;
                }

                ShowAllEpisodesFromShows();
            }
            else
            {
                ShowAllEpisodesForGroup(item.Header.ToString());
            }
        }
コード例 #2
0
        private void TreeView_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            XmlElement node = ((XmlElement)e.NewValue);

            if (node == null)
            {
                return;
            }

            SeriesControlGrid.Children.Clear();

            if (node.Name == "WatchSeries")
            {
                var  shownode     = node.SelectSingleNode("Show");
                Show selectedShow = shownode.ToType <Show>();

                ShowControl seriesctrl = new ShowControl(selectedShow);
                SeriesControlGrid.Children.Add(seriesctrl);
            }
            if (node.Name == "Episode")
            {
                Episode        selectedEpisode = node.ToType <Episode>();
                EpisodeControl episodectrl     = new EpisodeControl(selectedEpisode);
                SeriesControlGrid.Children.Add(episodectrl);
            }
            //seriesctrl.imgPoster.LoadImage();
            //string imdbid = ((XmlElement) e.NewValue).Attributes["Imdbid"]?.Value ?? "";
            //if (imdbid == "") return;
            //OmdbLookup2View(new TvDbRequestBuilder(imdbid, RequestBy.ImdbId, PlotType.Full));
        }
コード例 #3
0
        public void ShouldGetAllCategory()
        {
            IList <ShowControl> shows = new List <ShowControl>();

            ShowControl s = new ShowControl()
            {
                Title   = "My Title A",
                RssFeed = "Somewhere"
            };

            s.ShowOption.Category = "Cat One";

            ShowControl sb = new ShowControl()
            {
                Title   = "My Title B",
                RssFeed = "elseWhere"
            };

            sb.ShowOption.Category = "Cat Two";

            shows.Add(s);
            shows.Add(sb);

            IReadOnlyCollection <string> cats = CategoryHelper.GetAllCategoriesFromShows(shows);

            cats.Should().HaveCount(2);
            cats.Should().Contain("Cat Two");
            cats.Should().Contain("Cat One");
        }
コード例 #4
0
        private void PopulatePodCastsFromShow(ShowControl sc)
        {
            if (sc != null)
            {
                _podcasts.Clear();

                List <EpisodeControl> orderedByDateList = null;
                orderedByDateList = sc.Episodes.OrderByDescending(x => x.PublishedDate.Ticks).ToList();

                foreach (EpisodeControl x in orderedByDateList)
                {
                    if (x.Hidden)
                    {
                        continue;
                    }

                    PodcastEpisodeUC pce = new PodcastEpisodeUC();
                    pce.EpisodeControlData = x;
                    pce.ShowName           = sc.Title;
                    _podcasts.Add(pce);
                }

                EpisodesItems.ItemsSource = _podcasts;
            }
        }
コード例 #5
0
        private void ShowsItems_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var         item = (sender as ListView).SelectedItem;
            ShowControl sc   = item as ShowControl;

            PopulatePodCastsFromShow(sc);
        }
コード例 #6
0
        public void ShouldUpdateNewEpisodes()
        {
            ShowControl sc = new ShowControl();

            List <EpisodeControl> episodes = new List <EpisodeControl>();
            EpisodeControl        episode  = new EpisodeControl()
            {
                Title      = "MyFirstEpisode",
                PodcastURL = "UrlA"
            };

            episodes.Add(episode);

            episode = new EpisodeControl()
            {
                Title      = "MySecondEpisode",
                PodcastURL = "UrlB"
            };

            episodes.Add(episode);

            sc.UpdateEpisode(episodes);

            sc.Episodes.Should().HaveCount(2);
        }
コード例 #7
0
 private void ButtonSubShowClick(object sender, RoutedEventArgs e)
 {
     if (_currentShow != null)
     {
         Shows.GetShowService.RemoveShow(_currentShow);
         _currentShow = null;
         SaveShowsAsync();
         PopulateTree();
     }
 }
コード例 #8
0
ファイル: Admin.aspx.cs プロジェクト: Y-Moshe/asp.net_project
    protected void btnUpdateShow_Click(object sender, EventArgs e)
    {
        // Validate all the controls that requaird for UpdateShow
        Validate("DeleteShowGroup");
        Validate("AddShowGroup");

        if (IsValid == false)
        {
            return;
        }

        try
        {
            int showDiscount = 0;
            if (!string.IsNullOrEmpty(txtShowDiscount.Text))
            {
                showDiscount = Convert.ToInt32(txtShowDiscount.Text);
            }

            Show showToUpdate = new Show()
            {
                ShowID        = Convert.ToInt32(txtShowID.Text),
                ShowTitle     = txtShowTitle.Text,
                ShowAddress   = txtShowAddress.Text,
                ShowCardPrice = Convert.ToInt32(txtShowCardPrice.Text),
                ShowDate      = Convert.ToDateTime(txtShowDate.Text),
                ShowDiscount  = showDiscount,
                ShowImageUrl  = fleShowImageUrl.FileName,
                Comments      = txtComments.Text
            };

            // update Cache
            if (Cache["Shows"] != null)
            {
                List <ShowControl> list        = Cache["Shows"] as List <ShowControl>;
                ShowControl        showControl = list.Where(show => show.ShowID == showToUpdate.ShowID).SingleOrDefault();
                showControl.ShowAddress   = showToUpdate.ShowAddress;
                showControl.ShowComments  = showToUpdate.Comments;
                showControl.ShowImageUrl  = showToUpdate.ShowImageUrl;
                showControl.ShowDate      = showToUpdate.ShowDate.ToString();
                showControl.ShowDiscount  = Convert.ToInt32(showToUpdate.ShowDiscount);
                showControl.ShowCardPrice = showToUpdate.ShowCardPrice;
                showControl.ShowTitle     = showToUpdate.ShowTitle;
            }

            // update Database.
            shows.UpdateShow(showToUpdate);

            SetMessageState(State.Success, "ההופעה " + showToUpdate.ShowTitle + " עודכנה בהצלחה!");
        }
        catch (Exception ex)
        {
            SetMessageState(State.Danger, ex.Message);
        }
    }
コード例 #9
0
        private ShowControl CreateShowControl(string name, string feed, string cat)
        {
            ShowControl s = new ShowControl()
            {
                Title     = name,
                RssFeed   = feed,
                Catergery = new eWolfPodcasterCore.Library.CatergeryData(cat)
            };

            return(s);
        }
コード例 #10
0
        private ShowControl CreateShowControl(string name, string feed)
        {
            ShowControl s = new ShowControl()
            {
                Title     = name,
                RssFeed   = feed,
                Catergery = null
            };

            return(s);
        }
コード例 #11
0
        private bool IsShowAllReadyAdded(ShowLibraryData it)
        {
            CatergeryData cd = new CatergeryData(it.Catergery);
            ShowControl   sc = new ShowControl()
            {
                Title     = it.Name,
                RssFeed   = it.URL,
                Catergery = cd
            };

            return(Shows.GetShowService.Contains(sc));
        }
コード例 #12
0
        private ShowControl CreateBasicShowcontrol(string name)
        {
            ShowControl s = new ShowControl()
            {
                Title   = name,
                RssFeed = "Somewhere",
            };

            s.ShowOption.ShowStorage = ShowStorageType.RssFeed;
            s.ShowOption.Category    = "Cat";

            return(s);
        }
コード例 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // take the shows from Cache if exists
        if (Cache["Shows"] != null)
        {
            List <ShowControl> collection = Cache["Shows"] as List <ShowControl>;
            for (int i = 0; i < collection.Count; i++)
            {
                pnlInComeShows.Controls.Add(collection[i]);
                AddOptionToDataList(collection[i].ShowTitle);
            }
            lstDataSearch.DataBind();
            pnlInComeShows.DataBind();
            return;
        }

        ShowsLogic shows = new ShowsLogic();
        // get all shows from DB
        IEnumerable <Show> showsCollection = shows.GetShows();

        // collection to save all Shows
        List <ShowControl> collectionToSave = new List <ShowControl>(showsCollection.Count() + 1);

        foreach (Show show in showsCollection)
        {
            ShowControl showControl = LoadControl("ShowControl.ascx") as ShowControl;

            // setting the showControl
            showControl.ShowTitle     = show.ShowTitle;
            showControl.ShowImageUrl  = show.ShowImageUrl;
            showControl.ShowDate      = show.ShowDate.ToLongDateString();
            showControl.ShowCardPrice = show.ShowCardPrice;
            showControl.ShowAddress   = show.ShowAddress;
            showControl.ShowDiscount  = Convert.ToInt32(show.ShowDiscount);
            showControl.ShowComments  = show.Comments;
            showControl.ShowID        = show.ShowID;

            // add the showControl to the collectionToSave
            collectionToSave.Add(showControl);
            // add to the Panel(div)
            pnlInComeShows.Controls.Add(showControl);

            // adding options to search datalist
            AddOptionToDataList(show.ShowTitle);
        }
        lstDataSearch.DataBind();
        pnlInComeShows.DataBind();
        // save in the Cache to collection that hold all Show Controls. expire time in 30 Minutes
        Cache.Insert("Shows", collectionToSave, null, DateTime.Now.AddMinutes(30), Cache.NoSlidingExpiration);
    }
コード例 #14
0
        public AddNewShow(ShowControl sc)
        {
            InitializeComponent();
            DataContext = this;
            PopulateCategory();

            ShowName = sc.Title;
            RSSFeed  = sc.RssFeed;
            CategoryList.SelectedItem = sc.Catergery.Name;

            LocalFiles.IsChecked      = (sc.ShowOption.ShowStorage == ShowStorageType.LocalStorage);
            CheckForUpdates.IsChecked = sc.ShowOption.CheckforUpdates;
            AutoDownload.IsChecked    = sc.ShowOption.AudoDownloadEpisodes;
        }
コード例 #15
0
        private void ShowsItemsTree_ItemInvoked(TreeView sender, TreeViewItemInvokedEventArgs args)
        {
            var node = args.InvokedItem as TreeViewNode;

            if (node.Content is ShowControl sc)
            {
                _currentShow = sc;
                PopulatePodCastsFromShow(sc);
            }
            else
            {
                _currentShow    = null;
                node.IsExpanded = !node.IsExpanded;
            }
        }
コード例 #16
0
        private void ButtonOKClick(object sender, RoutedEventArgs e)
        {
            ShowControl sc = new ShowControl()
            {
                Title   = ShowName,
                RssFeed = RSSFeed
            };

            sc.ShowOption.Category = CategoryList.SelectedValue.ToString();

            _shows.Add(sc);

            _saveShows();

            ClosePage();
        }
コード例 #17
0
        public void ShouldSortEpisodesByDate()
        {
            List <ShowControl> shows = new List <ShowControl>();
            ShowControl        show  = CreateBasicShowcontrol("ShowOne");

            shows.Add(show);

            show.Episodes.Add(CreateEpisode("a", new DateTime(2018, 06, 15)));
            show.Episodes.Add(CreateEpisode("b", new DateTime(2019, 07, 15)));

            List <EpisodeControl> orderEpisodes = ShowHelper.GetOrderEpisodes(shows);

            orderEpisodes.Should().HaveCount(2);
            orderEpisodes[0].PublishedDate.Year.Should().Be(2019);
            orderEpisodes[1].PublishedDate.Year.Should().Be(2018);
        }
コード例 #18
0
ファイル: Desktop.aspx.cs プロジェクト: riyuexing/rms
        private void ShowDeskTop(DataTable dt)
        {
            List <string> list = new List <string>();

            foreach (DataRow dr in dt.Rows)
            {
                Control parent = Page.FindControl(dr["TableID"].ToString());
                if (ControlInDesktop(dr["ControlID"].ToString()))
                {
                    ShowControl newControl = new ShowControl(dr["ControlSrc"], dr["CacheTime"]);//(dr["ControlSrc"],dr["CacheTime"]);
                    parent.Controls.Add(newControl);
                    parent.Controls.Add(new LiteralControl("<" + "br" + ">"));
                    parent.Visible = true;
                }
            }
        }
コード例 #19
0
        private void EditSelectedItem(ShowControl sc)
        {
            AddNewShow addNewShow = new AddNewShow(sc);

            addNewShow.ShowDialog();

            if (addNewShow.Apply)
            {
                bool refresh = UpdateShowDetails(sc, addNewShow);
                Shows.GetShowService.Save();
                if (refresh)
                {
                    PopulateTree();
                }
            }
        }
コード例 #20
0
        private void ButtonSubShowClick(object sender, RoutedEventArgs e)
        {
            TreeViewItem item = (TreeViewItem)ShowsItemsTree.SelectedItem;

            if (item == null)
            {
                return;
            }

            ShowControl selectedItem = item.Tag as ShowControl;

            Shows.GetShowService.RemoveShow(selectedItem);
            Shows.GetShowService.Save();

            PopulateTree();
        }
コード例 #21
0
        private void ButtonStarShowClick(object sender, RoutedEventArgs e)
        {
            TreeViewItem item = (TreeViewItem)ShowsItemsTree.SelectedItem;

            if (item == null)
            {
                return;
            }

            ShowControl selectedItem = item.Tag as ShowControl;

            selectedItem.ShowOption.Starred = !selectedItem.ShowOption.Starred;

            Shows.GetShowService.Save();
            PopulateTree();
        }
コード例 #22
0
        public async Task <MsgBoxButton> Show()
        {
            ((Grid)this.Parent).SizeChanged += OnMainpage_SizeChanged;

            GridMain.RowDefinitions[1].Height = new GridLength(BoxHeight);
            this.Visibility = Visibility.Visible;

            ShowControl.Begin();
            _stopWating = false;
            do        // В цикле с интервалом 100 миллисекунд проверяем статус процесса поиска пока он не закончится
            {
                await Task.Delay(TimeSpan.FromMilliseconds(100));
            }while (!_stopWating);

            this.Visibility = Visibility.Collapsed;
            return(_pressedButton);
        }
コード例 #23
0
        public void ShouldGetAllShowsForCat()
        {
            IList <ShowControl> shows = new List <ShowControl>();

            ShowControl s = new ShowControl()
            {
                Title   = "My Title A",
                RssFeed = "Somewhere"
            };

            s.ShowOption.Category = "Cat One";

            ShowControl sb = new ShowControl()
            {
                Title   = "My Title B",
                RssFeed = "elseWhere"
            };

            sb.ShowOption.Category = "Cat Two";

            ShowControl sc = new ShowControl()
            {
                Title   = "My Title C",
                RssFeed = "elseWhere new"
            };

            sc.ShowOption.Category = "Cat Two";

            shows.Add(s);
            shows.Add(sb);
            shows.Add(sc);

            IReadOnlyCollection <ShowControl> cats = CategoryHelper.GetAllShowsForCategory(shows, "Cat Two");

            cats.Should().HaveCount(2);

            var showTest = cats.First(x => x.Title == "My Title B");

            showTest.Should().NotBeNull();

            showTest = cats.First(x => x.Title == "My Title C");
            showTest.Should().NotBeNull();
        }
コード例 #24
0
        public void ShouldSortLocalFilesEpisodesByUrl()
        {
            List <ShowControl> shows = new List <ShowControl>();
            ShowControl        show  = CreateBasicShowcontrol("ShowOne");

            show.ShowOption.ShowStorage = ShowStorageType.LocalStorage;
            shows.Add(show);

            show.Episodes.Add(CreateEpisode("b", new DateTime(2018, 06, 15)));
            show.Episodes.Add(CreateEpisode("a", new DateTime(2019, 07, 15)));

            List <EpisodeControl> orderEpisodes = ShowHelper.GetOrderEpisodes(shows);

            orderEpisodes.Should().HaveCount(2);
            orderEpisodes[0].PodcastURL.Should().Be("a");
            orderEpisodes[0].PublishedDate.Year.Should().Be(2019);
            orderEpisodes[1].PodcastURL.Should().Be("b");
            orderEpisodes[1].PublishedDate.Year.Should().Be(2018);
        }
コード例 #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string showName = Request.QueryString.Get("q");

        if (string.IsNullOrEmpty(showName))
        {
            Response.Redirect("HomePage");
        }
        else
        {
            ShowsLogic shows = new ShowsLogic();

            IEnumerable <Show> searchResult = shows.SearchShow(showName);

            if (searchResult.Count() == 0)
            {
                msgSearchResult.State = State.Danger;
                msgSearchResult.Message
                    = "התאמה לא נימצא, לחץ <a href='HomePage' class='alert-link'>כאן</a> לחזרה לדף הבית.";
            }
            else
            {
                foreach (Show item in searchResult)
                {
                    ShowControl show = LoadControl("ShowControl.ascx") as ShowControl;
                    show.ShowTitle     = item.ShowTitle;
                    show.ShowImageUrl  = item.ShowImageUrl;
                    show.ShowComments  = item.Comments;
                    show.ShowDate      = item.ShowDate.ToLongDateString();
                    show.ShowCardPrice = item.ShowCardPrice;
                    show.ShowDiscount  = Convert.ToInt32(item.ShowDiscount);
                    show.ShowID        = item.ShowID;
                    show.ShowAddress   = item.ShowAddress;

                    pnlSearchShows.Controls.Add(show);
                }

                msgSearchResult.State   = State.Success;
                msgSearchResult.Message = string.Format("נמצאו <strong>{0}</strong> התאמות!", searchResult.Count());
            }
        }
    }
コード例 #26
0
        public void ShouldShowNameCount()
        {
            ShowControl sc = new ShowControl
            {
                Title = "MyShow"
            };

            List <EpisodeControl> episodes = new List <EpisodeControl>();
            EpisodeControl        episode  = new EpisodeControl()
            {
                Title      = "MyFirstEpisode",
                PodcastURL = "UrlA"
            };

            episodes.Add(episode);

            sc.UpdateEpisode(episodes);
            sc.ToString().Should().StartWith("MyShow");
            sc.ToString().Should().Contain("1");
        }
コード例 #27
0
        private bool UpdateShowDetails(ShowControl sc, AddNewShow addNewShow)
        {
            sc.Modifyed = true;
            sc.Title    = addNewShow.ShowName;
            sc.RssFeed  = addNewShow.RSSFeed;
            if (addNewShow.LocalFiles.IsChecked.Value)
            {
                sc.ShowOption.ShowStorage = ShowStorageType.LocalStorage;
            }
            sc.ShowOption.CheckforUpdates      = addNewShow.CheckForUpdates.IsChecked.Value;
            sc.ShowOption.AudoDownloadEpisodes = addNewShow.AutoDownload.IsChecked.Value;
            bool refresh = false;

            if (sc.Catergery.Name != addNewShow.CategoryList.SelectedItem.ToString())
            {
                sc.Catergery = new eWolfPodcasterCore.Library.CatergeryData(addNewShow.CategoryList.SelectedItem.ToString());
                refresh      = true;
            }
            return(refresh);
        }
コード例 #28
0
        private void ButtonAddShowClick(object sender, RoutedEventArgs e)
        {
            AddNewShow addNewShow = new AddNewShow
            {
                ShowName = "new show name"
            };

            addNewShow.ShowDialog();

            if (addNewShow.Apply)
            {
                ShowControl sc = new ShowControl();

                UpdateShowDetails(sc, addNewShow);

                Shows.GetShowService.Add(sc);
                Shows.GetShowService.Save();
                PopulateTree();
            }
        }
コード例 #29
0
        public void butttonAddShow_Click(object sender, RoutedEventArgs e)
        {
            CatergeryData cd = new CatergeryData(ShowLibraryData.Catergery);
            ShowControl   sc = new ShowControl()
            {
                Title     = ShowLibraryData.Name,
                RssFeed   = ShowLibraryData.URL,
                Catergery = cd
            };

            if (Shows.GetShowService.Add(sc))
            {
                System.Console.WriteLine($"Add {ShowLibraryData.Name} to main list");
                Shows.GetShowService.Save();
            }
            else
            {
                System.Console.WriteLine($"{ShowLibraryData.Name} All ready in list");
            }
            LibraryMain.RedrawList();
        }
コード例 #30
0
ファイル: WinFormsForm.cs プロジェクト: lddd99/guiatuomation
        private void loadControl <T>(T control, string _controlType)
        {
            try {
                (control as Control).GetType()
                .GetProperty("Text")
                .SetValue(control, ControlName != string.Empty ? ControlName : _controlType, null);

                /*
                 * if (this.ControlName != string.Empty){
                 *  (control as System.Windows.Forms.Control).GetType().GetProperty("Text").SetValue(control, this.ControlName, null);
                 * } else {
                 *  (control as System.Windows.Forms.Control).GetType().GetProperty("Text").SetValue(control, _controlType, null);
                 * }
                 */
                (control as Control).GetType()
                .GetProperty("Name")
                .SetValue(control,
                          ControlAutomationId != string.Empty ? ControlAutomationId : _controlType, null);

                /*
                 * if (this.ControlAutomationId != string.Empty){
                 *  (control as System.Windows.Forms.Control).GetType().GetProperty("Name").SetValue(control, this.ControlAutomationId, null);
                 * } else {
                 *  (control as System.Windows.Forms.Control).GetType().GetProperty("Name").SetValue(control, _controlType, null);
                 * }
                 */
                (control as Control).Visible = false;
                var r = new Random();
                (control as Control).Left =
                    r.Next(0, this.Width - 20);
                (control as Control).Top =
                    r.Next(0, this.Height - 20);
                ChildForm.Controls.Add(control as Control);

                var showControlDelegate = new ShowControl(runTimeout);
                showControlDelegate(ControlDelay, control as Control);
            } catch {
            }
        }