本文整理汇总了C#中WPCordovaClassLib.Cordova.PluginResult类的典型用法代码示例。如果您正苦于以下问题:C# PluginResult类的具体用法?C# PluginResult怎么用?C# PluginResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginResult类属于WPCordovaClassLib.Cordova命名空间,在下文中一共展示了PluginResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: close
public void close(string options = "")
{
if (browser != null)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
if (frame != null)
{
PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
if (page != null)
{
Grid grid = page.FindName("LayoutRoot") as Grid;
if (grid != null)
{
grid.Children.Remove(browser);
}
page.ApplicationBar = null;
}
}
browser = null;
string message = "{\"type\":\"exit\"}";
PluginResult result = new PluginResult(PluginResult.Status.OK, message);
result.KeepCallback = false;
this.DispatchCommandResult(result);
});
}
}
示例2: readSecret
public async void readSecret(string ignored)
{
var token = await new Repository().ReadToken();
PluginResult result = new PluginResult(PluginResult.Status.OK, token);
DispatchCommandResult(result);
}
示例3: greet
public void greet(string args)
{
string name = JsonHelper.Deserialize<string[]>(args)[0];
string message = "Hello " + name;
PluginResult result = new PluginResult(PluginResult.Status.OK, message);
DispatchCommandResult(result);
}
示例4: HandleNotification
void HandleNotification(Event pushEvent)
{
PluginResult result = new PluginResult(PluginResult.Status.OK, pushEvent);
result.KeepCallback = true;
DispatchCommandResult(result);
}
示例5: init
public void init(string args)
{
var pr = new PluginResult(PluginResult.Status.OK);
pr.KeepCallback = true;
try
{
if (string.IsNullOrEmpty(args))
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "You must supply Facebook Application Key"));
return;
}
var _args = WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize<string[]>(args);
FacebookSessionClient = new FacebookSessionClient(_args[0]);
DateTime access_expires;
Settings.TryGetValue<string>("fb_access_token", out AccessToken);
Settings.TryGetValue<DateTime>("fb_access_expires", out access_expires);
if (AccessToken != null)
this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
else
DispatchCommandResult(new PluginResult(PluginResult.Status.NO_RESULT));
}
catch (Exception ex)
{
RemoveLocalData();
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, ex.Message));
}
}
示例6: registerWPEventDispatcher
public void registerWPEventDispatcher(string parameters)
{
this.eventDispatcherCallbackId = this.CurrentCommandCallbackId;
PluginResult result = new PluginResult(PluginResult.Status.OK);
result.KeepCallback = true;
DispatchCommandResult(result, this.eventDispatcherCallbackId);
}
示例7: getMeanings
void getMeanings(object sender, DefineCompletedEventArgs e)
{
//System.Diagnostics.Debug.WriteLine(e.Result.ToString());
try
{
List<Definition> defList = e.Result.Definitions.ToList();
List<string> definitions = new List<string>();
//string jsonArray = JsonConvert.SerializeObject(defList, Formatting.Indented);
Dictionary<string, List<Definition>> obj = new Dictionary<string, List<Definition>>();
obj.Add("Definitions", defList);
Dictionary<string, Dictionary<string, List<Definition>>> jsonDic = new Dictionary<string, Dictionary<string, List<Definition>>>();
jsonDic.Add("DATA", obj);
string jsonObj = JsonConvert.SerializeObject(jsonDic, Formatting.Indented);
System.Diagnostics.Debug.WriteLine(jsonObj);
PluginResult result = new PluginResult(PluginResult.Status.OK,jsonObj);
result.KeepCallback=false;
DispatchCommandResult(result);
}
catch (Exception ex)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Service Error: Did not get proper response from the server, Please check network connectivity"));
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
示例8: OnSuccess
/// <summary>
/// 安装成功回调
/// </summary>
/// <param name="type">类型标识:安装/卸载</param>
/// <param name="appId">应用id</param>
public override void OnSuccess(AMS_OPERATION_TYPE type, String appId)
{
string res = String.Format("\"appid\":\"{0}\",\"type\":\"{1}\"", appId, ((int)type).ToString());
res = "{" + res + "}";
xFaceLib.Log.XLog.WriteInfo("--------------AMS OnSuccess result: " + res);
PluginResult result = new PluginResult(PluginResult.Status.OK, res);
DispatchPluginResult(this, result);
}
示例9: getInstallationObjectId
public void getInstallationObjectId(string args)
{
String objectId = ParseInstallation.CurrentInstallation.ObjectId.ToString();
var result = new PluginResult(PluginResult.Status.OK, objectId);
DispatchCommandResult(result);
}
示例10: OnError
/// <summary>
/// 安装错误回调
/// </summary>
/// <param name="type">类型标识:安装/卸载</param>
/// <param name="appId">应用id</param>
/// /// <param name="errorState">错误码</param>
public override void OnError(AMS_OPERATION_TYPE type, String appId, AMS_ERROR errorState)
{
string res = String.Format("\"errorcode\":\"{0}\",\"appid\":\"{1}\",\"type\":\"{2}\"",
((int)errorState).ToString(), appId, ((int)type).ToString());
res = "{" + res + "}";
xFaceLib.Log.XLog.WriteInfo("-------------------AMS OnError result: " + res);
PluginResult result = new PluginResult(PluginResult.Status.ERROR, res);
DispatchPluginResult(this, result);
}
示例11: generateOTP
public void generateOTP(string unparsed)
{
var secret = JsonHelper.Deserialize<string[]>(unparsed)[0];
Totp generator = new Totp(secret);
PluginResult result = new PluginResult(PluginResult.Status.OK, generator.now());
DispatchCommandResult(result);
}
示例12: authenticate
/// <summary>
/// Native implementation for "authenticate" action
/// </summary>
public void authenticate(object jsVersion)
{
PhoneHybridMainPage.GetInstance().Authenticate(this);
// Done
PluginResult noop = new PluginResult(PluginResult.Status.NO_RESULT);
noop.KeepCallback = true;
DispatchCommandResult(noop);
}
示例13: getSubscriptions
public void getSubscriptions(string args)
{
var installation = ParseInstallation.CurrentInstallation;
IEnumerable<string> subscribedChannels = installation.Channels;
var result = new PluginResult(PluginResult.Status.OK, subscribedChannels);
DispatchCommandResult(result);
}
示例14: OnProgressUpdated
/// <summary>
/// 更新安装进度
/// </summary>
/// <param name="type">类型标识:安装/卸载</param>
/// <param name="progressState">进度状态</param>
public override void OnProgressUpdated(AMS_OPERATION_TYPE type, InstallStatus progressState)
{
string res = String.Format("\"progress\":\"{0}\",\"type\":\"{1}\"", ((int)progressState).ToString(), ((int)type).ToString());
res = "{" + res + "}";
xFaceLib.Log.XLog.WriteInfo("-------------------AMS OnProgressUpdated result: " + res);
//TODO: ams install progress
PluginResult result = new PluginResult(PluginResult.Status.OK, res);
result.KeepCallback = true;
DispatchPluginResult(this, result);
}
示例15: requestAccess
public async void requestAccess(string unparsed)
{
var accountId = JsonHelper.Deserialize<string[]>(unparsed)[0];
var module = AccountManager.GetAccountByName(accountId);
AccountManager.SaveSate();
IsolatedStorageSettings.ApplicationSettings["module"] = accountId;
await module.RequestAccessAndContinue();
PluginResult result = new PluginResult(PluginResult.Status.OK, module.GetAccessToken());
DispatchCommandResult(result);
}