Executing JavaScript from the .NET Side Using CefSharp
Learn how to execute JavaScript from the .NET Side Using CefSharp. You can get the source code of this sample in the GitHub repository:
https://github.com/cefsharptutorials/cefsharptutorials/tree/master/CefSharpTutorials/ExecutingJavaScript
About CefSharp:
https://cefsharp.github.io/
Previous tutorials:
CefSharp Basics: Display an HTML5/CSS3 Webpage:
https://www.youtube.com/watch?v=gphqZTCWoZE&list=PLtnonz7r7xrqI7OS0eWwc4lrwV5zqI4r3
URL Navigation Using CefSharp:
https://www.youtube.com/watch?v=NTlErRwyYRA&list=PLtnonz7r7xrqI7OS0eWwc4lrwV5zqI4r3&index=2
Transcript:
0:01 Executing JavaScript from the .NET Side Using CefSharp
0:08 Create and configure a WPF solution with CefSharp
0:13 We need to create a project. Then add the CefSharp.Wpf
NuGet package and create the x64 or x86 configuration for it
0:22 You can find detailed instructions in the previous tutorials.
(Check the links under this video)
0:26 How to markup the MainWindow
0:28 Lets add the Xml Namespace for the CefSharp.Wpf library in
the MainWindow.xaml
0:38 Then we need to markup the root grid in order to place the
Browser component, the script text box and the execution
button, so let's add two columns and two rows to the root grid
1:04 After that create the ChromiumWebBrowser, define its name
and the initial URL
1:15 Also we need to define its location in the root grid
1:25 Create a TextBox which will contain the JavaScript we are
going to execute, set its name and location
1:39 Create the button which will execute the written JavaScript
and set its name, location and content
1:58 Implementing the MainWindow behaviour
2:00 Create the Click handler for the button
2:12 Mark the ‘ExecuteJavaScriptBtn_Click’ method as ‘async’
2:16 Check that the Browser can execute the JavaScript and that
the TextBox is not empty
2:24 Create the variable which will contain the JavaScript
evaluation result
2:30 Call the ‘Browser.EvaluateScriptAsync’ method and pass the
TextBox content into the method argument
2:37 Check that the ‘Result’ property of the ‘response’ variable is
not null
1:45 And call the ‘MessageBox.Show’ method to display the
evaluated JavaScript result
2:59 Build and launch the application
3:03 Build and launch the project
#JavaScript
#.NET
#CefSharp
#EmbeddedBrowsers
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Executing JavaScript from the .NET Side Using CefSharp», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.