TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
prasanth Mani
1.5k
200
18.3k
How to invoke script and html in wpf without using web brows
Mar 28 2018 11:35 PM
Its my Html code:
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html oncontextmenu=
"return false"
;>
<head>
<title>Testing</title>
<meta http-equiv=
"X-UA-Compatible"
content=
"IE=EmulateIE11,IE=9; IE=8; IE=7; IE=EDGE"
/>
<link rel=
"stylesheet"
type=
"text/css"
href=
"style.css"
>
</head>
<body>
<center>
<form>
<fieldset
class
=
"account-info"
>
<label>
Select the FBX File
<input type=
"file"
id=
"inputfile"
onchange=
"ReadFile()"
/>
</label>
</fieldset>
</form>
</center>
<script src=
"three.js"
></script>
<script src=
"system.min.js"
></script>
<script src=
"jszip.min.js"
></script>
<script src=
"Inflate.min.js"
></script>
<script src=
"FBXLoader.js"
></script>
<script>
//Get Sample Function
function
GetSampleFunction() {
return
"Bala"
;
}
//Property Variable
var
rawData = undefined;
var
fr;
//GetData For Select File
function
GetData() {
var
arr = {};
var
obj = undefined;
if
(fr.result !=
null
) {
var
loader =
new
THREE.FBXLoader();
obj = loader.parse(rawData);
}
if
(obj != undefined) {
var
re = {
"Object Name"
: obj.children[0].name,
"Object Positiion"
: obj.children[0].position,
"Object id"
: obj.children[0].id,
"Object ID"
: obj.children[0].ID,
"Object Castshadow"
: obj.children[0].castShadow,
"Object type"
: obj.children[0].type,
"Object userData"
: obj.children[0].userData,
"Object uuid"
: obj.children[0].uuid
};
arr = JSON.stringify(re);
}
else
{
alert(
"Object has no value"
);
}
return
JSON.stringify(arr);
}
//read data for select File
function
ReadFile() {
var
upload = document.getElementById(
'inputfile'
);
var
f = upload.files[0], read =
new
FileReader();
fr =
new
FileReader();
fr.onload =
function
() {
rawData = fr.result;
};
fr.readAsArrayBuffer(f);
}
</script>
</body>
</html>
Its my C# code:
private
void
Window_Loaded(
object
sender, RoutedEventArgs e)
{
string
curdir = Directory.GetCurrentDirectory();
webBrowser.Navigate(String.Format(
"file:///{0}/sample.html"
, curdir));
}
private
void
btngetdatafrombrowser_Click(
object
sender, RoutedEventArgs e)
{
try
{
dynamic objdata = webBrowser.InvokeScript(
"GetData"
);
if
(objdata !=
null
)
MessageBox.Show(objdata);
}
catch
(Exception ex)
{
}
}
private
void
webBrowser_Navigated(
object
sender, NavigationEventArgs e)
{
string
curdir = Directory.GetCurrentDirectory();
var data = Application.GetCookie(
new
Uri(String.Format(
"file:///{0}/sample.html"
, curdir)));
}
private
void
webBrowser_Navigating(
object
sender, NavigatingCancelEventArgs e)
{
}
Attachment:
HtmlScriptToWPF.zip
Reply
Answers (
0
)
String buider . Append
how to implement voice recording play, using asp.net mvc5