本文整理汇总了C#中ScriptObject.ConvertTo方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptObject.ConvertTo方法的具体用法?C# ScriptObject.ConvertTo怎么用?C# ScriptObject.ConvertTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScriptObject
的用法示例。
在下文中一共展示了ScriptObject.ConvertTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NavigateTo
public void NavigateTo(string controlName, ScriptObject parameterList)
{
var paramList = parameterList.ConvertTo<List<object>>();
var launcher = pageLaunchers[controlName];
LayoutRoot.Children.Clear();
var form = launcher(paramList);
LayoutRoot.Children.Add(form);
}
示例2: ProcessPhotosCallback
public void ProcessPhotosCallback(ScriptObject json)
{
OnPhotoCollectionCompleted(new PhotoCollectionEventArgs(json.ConvertTo<PhotoCollection>()));
}
示例3: readAsArrayBufferSync
internal void readAsArrayBufferSync(ScriptObject scriptBlob)
{
Blob blob = scriptBlob.ConvertTo<Blob>();
if (readyState == LOADING) {
throw new OperationNotAllowedException();
}
try
{
ConstrainedStreamWrapper s = blob.GetStream();
this.readyState = LOADING;
if(this.onloadstart != null){
this.onloadstart(this,new ProgressEvent(0,s.Length));
}
byte[] buf = new byte[(int)s.Length];
int bytesRead = 0;
int offset = 0;
s.Seek(0, SeekOrigin.Begin); //rewinding stream to read from the start
while ((bytesRead = s.Read(buf, offset, 1024)) > 0)
{
offset += bytesRead;
this.onprogress.FireAsync(this, new ProgressEvent(offset, s.Length));
//TODO: 6.4.5.2 violation! A .result should be populated with partial blob data while it's being read
//prolly methods, using this impl shoud subscribe to onprogress and modify result as we go
}
this.readyState = DONE;
if (this.onloadend != null)
{
this.onloadend.FireAsync(this, new ProgressEvent(offset, s.Length));
}
this.result = buf;
}
catch (Exception e) {
this.readyState = DONE;
this.result = null;
switch (e.GetType().Name){
default:
case "IOException":
this.error = FileError.NOT_READABLE_ERR;
break;
case "FileNotFoundException":
this.error = FileError.NOT_FOUND_ERR;
break;
case "SecurityException":
this.error = FileError.SECURITY_ERR;
break;
}
if (this.onerror != null) {
this.onerror.FireAsync(this, null);
}
if (this.onloadend != null)
{
this.onloadend.FireAsync(this, new ProgressEvent(0));
}
return;
}
}