Example #1
0
        private void MainBtnFilms_Click(object sender, RoutedEventArgs e)
        {
            InfoScrollWrapper.Visibility          = Visibility.Visible;
            CommentReviewScrollWrapper.Visibility = Visibility.Collapsed;

            GridSpaceInfo.Children.Clear();
            flagForumOpen = false;
            List <CardItem> list = new List <CardItem>(AsyncClient.films.Count);

            foreach (Film a in AsyncClient.films)
            {
                CardItem cardItem = new CardItem(win, this, a);
                cardItem.Details.Click += new RoutedEventHandler(HandlerFilm);
                list.Add(cardItem);
                GridSpaceInfo.Children.Add(cardItem);
                grid = GridSpaceInfo;
                if (cardItem.flagFavorite)
                {
                    cardItem.AddFavOn.Visibility  = Visibility.Collapsed;
                    cardItem.AddFavOff.Visibility = Visibility.Visible;
                }
                else
                {
                    cardItem.AddFavOn.Visibility  = Visibility.Visible;
                    cardItem.AddFavOff.Visibility = Visibility.Collapsed;
                }
            }
        }
Example #2
0
 private void OpenFavorite(object sender, RoutedEventArgs e)
 {
     flagForumOpen = false;
     if (win.flagautoriz)
     {
         GridSpaceInfo.Children.Clear();
         if (card.flagFavorite)
         {
             card = new CardItem(win, this, film);
         }
     }
     else
     {
         MessageBox.Show("Sorry, please to register");
     }
 }
Example #3
0
        private void OnSearchWords(object sender, TextChangedEventArgs e)
        {
            try
            {
                if (!SearchQuery.Text.Equals(string.Empty))
                {
                    var query = from t in AsyncClient.films
                                where t.Name.ToLower().Contains(SearchQuery.Text) || t.Name.Contains(SearchQuery.Text) || t.Name.ToUpper().Contains(SearchQuery.Text)
                                orderby t.Name
                                select t;

                    if (query.Count() > 0)
                    {
                        if (flag)
                        {
                            win.GridSpaceInfo.Children.RemoveRange(1, win.GridSpaceInfo.Children.Count);
                        }
                        else
                        {
                            win.GridSpaceInfo.Children.RemoveRange(1, win.GridSpaceInfo.Children.Count - 1);
                        }
                        foreach (Film t in query)
                        {
                            CardItem cardItem = new CardItem(mwin, win, t);
                            win.GridSpaceInfo.Children.Add(new CardItem(mwin, win, t));
                            cardItem.Details.Click += new RoutedEventHandler(Handler);
                            flag = true;
                        }
                    }
                    else if (query.Count() <= 0)
                    {
                        win.GridSpaceInfo.Children.RemoveRange(1, win.GridSpaceInfo.Children.Count - 1);
                        win.GridSpaceInfo.Children.Add(new NotFound(win));
                        flag = false;
                    }
                }
                else
                {
                    win.GridSpaceInfo.Children.RemoveRange(1, win.GridSpaceInfo.Children.Count);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.Source + ex.Data);
            }
        }
Example #4
0
        public MainMenuxaml(MainWindow win)
        {
            InitializeComponent();
            this.win = win;
            for (int i = 1; i < 8; i++)
            {
                AsyncClient.SetTypeInfo((TypeOfInfo)i);
                AsyncClient.StartClient();
            }
            List <CardItem> list = new List <CardItem>(AsyncClient.films.Count);

            foreach (Film a in AsyncClient.films)
            {
                CardItem cardItem = new CardItem(win, this, a);
                cardItem.Details.Click += new RoutedEventHandler(HandlerFilm);
                list.Add(cardItem);
                GridSpaceInfo.Children.Add(cardItem);
                grid = GridSpaceInfo;
            }
            //List<Comment> listcomments = new List<Comment>(AsyncClient.comment.Id);
        }
Example #5
0
 private void Serching(object sender, RoutedEventArgs e)
 {
     try
     {
         Regex           regex   = new Regex(@"[А-Я][а-я\ ]+", RegexOptions.IgnoreCase);
         MatchCollection matches = regex.Matches(SearchQuery.Text);
         if (matches.Count < 0)
         {
             win.GridSpaceInfo.Children.Add(new NotFound(win));
         }
         if (matches.Count > 0 && SearchQuery.Text.Length != 0)
         {
             foreach (Match match in matches)
             {
                 List <CardItem> list = new List <CardItem>(AsyncClient.films.Count);
                 foreach (Film t in AsyncClient.films)
                 {
                     if (t.Name.Contains(SearchQuery.Text))
                     {
                         win.GridSpaceInfo.Children.Clear();
                         CardItem cardItem = new CardItem(mwin, win, t);
                         win.GridSpaceInfo.Children.Add(new CardItem(mwin, win, t));
                         cardItem.Details.Click += new RoutedEventHandler(Handler);
                     }
                 }
             }
         }
         else
         {
             win.GridSpaceInfo.Children.Clear();
             SearchQuery.Text = "Wrong symbols";
             win.GridSpaceInfo.Children.Add(new Search(win));
             win.GridSpaceInfo.Children.Add(new NotFound(win));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }