Example #1
0
        /// <summary>
        /// Функция воспроизведения превью видео
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PlayPreview(object sender, RoutedEventArgs e)
        {
            (sender as Button).Dispatcher.BeginInvoke(new Action(delegate()
            {
                try
                {
                    ListBoxItem el  = (((sender as Button).Parent as Grid).Parent as ListBoxItem);
                    string[] arr    = (sender as Button).Name.Split('_');
                    Hyperlink elemY = Find(el, "lu_" + arr[1]);
                    if (elemY != null)
                    {
                        // Достаем линк
                        string y    = elemY.NavigateUri.AbsoluteUri;
                        string link = y.Remove(0, y.IndexOf("v=") + 2);
                        //link = link.Remove(link.IndexOf("&"));

                        // Выводим юзеру
                        MainWindow.PreviewVideo(link, FindRun(el, "run_" + arr[1]).Text);
                    }
                    else
                    {
                        MainWindow.PreviewVideo("", "", false);
                    }
                }
                catch (Exception ex) { Task.Factory.StartNew(() => Debugging.Save("General.xaml", "PlayPreview()", ex.Message, ex.StackTrace)); }
            }));
        }