/// <summary> /// Khởi tạo một đối tượng TokenAccess cho windows 10 mà không làm mới token key /// </summary> /// <param name="PackageSID"></param> /// <param name="Secret"></param> public WNSTokenAccess(WNSParameter parameter) { this._PackageSID = parameter.WNSPackageSID; this._Secret = parameter.WNSSecretKey; this._SetToken = parameter.SetToken; Token = parameter.GetToken(); TokenRefresher = new ResourceAccessSyncer <string>(new Func <string>(() => { return(GetAccessToken(_Secret, _PackageSID).AccessToken); }), ""); }
public BaseServiceResult SendAllNotification() { try { var wnsParam = new WNSParameter(Settings.WNSPackageSID.Value, Settings.WNSSecretKey.Value, Settings.GetWNSToken, Settings.SetWNSToken); using (var sender = new RawNotificationSender(wnsparameter: wnsParam)) { sender.SendAllNotificationAsync(); return(new BaseServiceResult(ResultStatusCodes.OK, null)); } } catch (Exception ex) { Logger.Error("SendAllNotification", ex); return(BaseServiceResult.InternalErrorResult); } }
private void InitializeForSenders(WNSParameter parameter) { _WNSSender = new RawNotificationSenders.RNSImplements.WNSRNSender(parameter); }
public RawNotificationSender(WNSParameter parameter, IRawNotificationDB db) : base(db) { InitializeForSenders(parameter); }
public RawNotificationSender(WNSParameter wnsparameter) : base() { InitializeForSenders(wnsparameter); }
/// <summary> /// Initialize new instance of WNSRNsender class /// </summary> /// <param name="packageSID">Package of windows phone app</param> /// <param name="secretKey">Secret key of windows phone app</param> /// <param name="logger">an IRNLogger used for logging</param> /// <exception cref="Exception">Renew token may throw various type of exceptions</exception> internal WNSRNSender(WNSParameter parameter) { _Token = new WNSTokenAccess(parameter); }