本文整理汇总了C#中IResult类的典型用法代码示例。如果您正苦于以下问题:C# IResult类的具体用法?C# IResult怎么用?C# IResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IResult类属于命名空间,在下文中一共展示了IResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleResult
public bool HandleResult( IResult result, IFormatInfo outputFormat, HttpRequestBase request, HttpResponseBase response )
{
response.AddHeader("Accept-Ranges", "bytes");
Range range;
if ( !TryGetRequestedRange( request, out range ) )
{
return false;
}
if (!ValidateIfRangeHeader(request, result))
{
return false;
}
var offset = range.Start ?? 0;
var end = range.End.HasValue ? range.End.Value : result.ContentLength - 1;
var length = end - offset + 1;
response.AddHeader( "Content-Range", "bytes " + offset + "-" + end + "/" + result.ContentLength );
response.StatusCode = 206;
result.Serve( response, offset, length );
return true;
}
示例2: AuthCallBack
void AuthCallBack(IResult result)
{
if (result.Error != null)
{
// display error popup
popup.SetActive(true);
newGame.enabled = true;
loadGame.enabled = true;
rulesButton.enabled = true;
}
else
{
if (FB.IsLoggedIn)
{
FB.API("/me?fields=first_name,last_name", HttpMethod.GET, DisplayUsername);
FB.API("/me/friends?fields=first_name,last_name", HttpMethod.GET, DisplayFriends);
//FB.API("me/picture?type=square&height=128&width=128", HttpMethod.GET, DisplayProfilePic);
FB.GetAppLink(GetAppLink);
}
else
{
// display error popup
popup.SetActive(true);
newGame.enabled = true;
loadGame.enabled = true;
rulesButton.enabled = true;
}
}
}
示例3: ContinueResultDecorator
public ContinueResultDecorator(IResult inner, Func<IEnumerable<IResult>> coroutine)
: base(inner)
{
if (coroutine == null) throw new ArgumentNullException("coroutine");
_coroutine = coroutine;
}
示例4: Execute
public override IResult Execute(IResult previousResults)
{
try
{
var request =
EndpointManager.GetContract<AbstractIdentityQueryContract>(EndPointFunctions.IdentityQuery);
request.LoginId = SettingsManager.GetTemporarySettingString(UsernameKey);
request.Credential1 = SettingsManager.GetTemporarySettingString(PassphraseKey);
request.Credential2 = SettingsManager.GetTemporarySettingString(Credential2Key);
request.Credential3 = SettingsManager.GetTemporarySettingString(Credential3Key);
request.Credential4 = SettingsManager.GetTemporarySettingString(Credential4Key);
request.Provider = CertificateProvider;
request.Properties = _properties;
request.GroupPaths = _groupPaths;
var result = request.MakeRequest<IdentityQueryResult>();
if (result == null)
return request.GetErrorResult();
SettingsManager.SetTemporaryObject(UserPropertiesKey, result.Properties);
SettingsManager.SetTemporaryObject(GroupPathsKey, result.Groups);
return new NextResult();
}
catch (Exception e)
{
return new ExceptionOccurred(e);
}
}
示例5: Execute
public override IResult Execute(IResult previousResults)
{
try
{
if (string.IsNullOrWhiteSpace(SettingKey))
throw new Exception("No settings key specified");
var info = SettingsManager.GetTemporaryObject(SettingKey) as FileInfoWrapper;
if (info == null)
throw new Exception("Data object is invalid");
var result = info.VerifyFile(PathUtilities.DownloadFolder);
if (!result.Result)
{
Log.Warn(result.Reason);
return new CouldNotVerifyFile { Target = info.FileName, Issue = result.Reason };
}
return new NextResult();
}
catch (Exception e)
{
return new ExceptionOccurred(e);
}
}
示例6: Execute
public override IResult Execute(IResult previousResults)
{
try
{
var startTime = DateTime.UtcNow;
TimeSpan elapsed;
do
{
DialogsManager.WaitForDurationOrCancel(DateTime.UtcNow, new TimeSpan(0,0,0,Interval));
if (DialogsManager.CancelRequested)
break;
if (SecurityUtilities.SecurityProviderHealth.Good ==
SecurityUtilities.QuerySecurityProviderHealth(Provider))
break;
elapsed = DateTime.UtcNow.Subtract(startTime);
} while (elapsed.Duration().TotalSeconds < Duration);
return new NextResult();
}
catch (Exception e)
{
return new ExceptionOccurred(e);
}
}
示例7: HandleResult
public void HandleResult(IResult result)
{
if (result == null)
{
print ( "Null Response\n");
return;
}
// Some platforms return the empty string instead of null.
if (!string.IsNullOrEmpty(result.Error))
{
print("Error Response:\n" + result.Error);
}
else if (result.Cancelled)
{
print("Cancelled Response:\n" + result.RawResult);
}
else if (!string.IsNullOrEmpty(result.RawResult))
{
print("Success Response:\n" + result.RawResult);
getUserData();
}
else
{
print("Empty Response\n");
}
}
示例8: IteratePartsKNN
public IEnumerable<Bitmap> IteratePartsKNN(IResult res, double dqp, float stddev, float mean, Sequence seq)
{
var sym = this.Discretize(dqp, stddev, mean);
yield return seq.Unravel(sym);
var left = sym - 1;
var right = sym + 1;
bool do_next = true;
while (do_next) {
do_next = false;
var __left = this.Discretize(dqp - res.CoveringRadius, stddev, mean);
if (0 <= left && __left <= left) {
yield return seq.Unravel(left);
--left;
do_next = true;
}
var __right = this.Discretize(dqp + res.CoveringRadius, stddev, mean);
if (right <= __right && right < seq.Sigma) {
yield return seq.Unravel(right);
++right;
do_next = true;
}
/*Console.WriteLine ("left: {0}, right: {1}, __left: {2}, __right: {3}",
left, right, __left, __right);*/
}
}
示例9: Execute
public override IResult Execute(IResult previousResults)
{
try
{
if (string.IsNullOrWhiteSpace(ChildDialog))
throw new Exception("Child dialog key cannot be null or empty");
if (string.IsNullOrWhiteSpace(Banner))
throw new Exception("Banner key cannot be null or empty");
var dialog = DialogsManager.GetExistingDialog(ParentDialog);
if (dialog == null)
return new DialogInstanceNotFound { Dialog = ParentDialog };
var childManager = DialogsManager.GetDialog<BorderedChildDialogModel>(ChildDialog);
if (childManager == null)
{
return new DialogInstanceNotFound { Dialog = ChildDialog };
}
return dialog.ShowChildBannerModal(childManager, Banner);
}
catch (Exception e)
{
return new ExceptionOccurred(e);
}
}
示例10: GreedySearchGlobalMinima
//, Result C)
protected void GreedySearchGlobalMinima(int parent, object q, IResult res)
{
var rs = this.SEQ.Unravel (parent);
var children_count = rs.Count1;
var closer_dist = double.MaxValue;
var closer_objID = -1;
for (int rank = 1; rank <= children_count; ++rank) {
var objID = rs.Select1(rank);
var dist = this.DB.Dist(q, this.DB[objID]);
res.Push (objID, dist);
if (dist < closer_dist) {
closer_dist = dist;
closer_objID = objID;
}
//if (C != null) C.Push (objID, dist);
}
if (closer_objID >= 0) {
this.GreedySearchGlobalMinima (closer_objID, q, res); //, C);
}
// for (int childID = 0; childID < children_count; ++childID) {
// var child_objID = C[childID];
// var child_dist = D[childID];
// var radius = res.CoveringRadius;
// //Console.WriteLine ("---- cov: {0}", this.COV[child_objID]);
// if (child_dist <= radius + this.GetCOV(child_objID) && child_dist <= closer_dist + radius + radius) {
// this.SearchKNNNode(child_objID, q, res);
// }
// }
}
示例11: Execute
public override IResult Execute(IResult previousResults)
{
try
{
if (string.IsNullOrWhiteSpace(Target))
throw new InvalidOperationException("The target path cannot be empty");
if (!File.Exists(Target))
Target = Path.Combine(PathUtilities.DownloadFolder, Target);
if (!File.Exists(Target))
return new FileNotFound { Target = Target };
var result = CertificateUtilities.ImportUserCertificateFromFile(
Target,
SettingsManager.GetSecureTemporarySettingString(CredentialsKey));
if (!result.Result)
return new CouldNotImportContent{Issue = result.Reason};
return new NextResult();
}
catch (Exception e)
{
return new ExceptionOccurred(e);
}
}
示例12: Execute
public override IResult Execute(IResult previousResults)
{
try
{
foreach (var setter in _setters)
{
var key = setter.Key;
var value = setter.Value;
if (string.IsNullOrWhiteSpace(key))
{
Log.Warn("Cannot retrieve settings value to user settings; settings key not specified");
continue;
}
var settingsPropertyName = value;
if (string.IsNullOrWhiteSpace(settingsPropertyName))
settingsPropertyName = key;
var settingsValue = Properties.Settings.Default.GetKeyedProperty(settingsPropertyName);
SettingsManager.SetTemporarySettingString(key, settingsValue);
}
return new NextResult();
}
catch (Exception e)
{
Log.Warn(e);
return new NextResult();
}
}
示例13: Execute
public override IResult Execute(IResult previousResults)
{
try
{
if (string.IsNullOrWhiteSpace(SettingKey))
throw new Exception("Setting key not specified");
var request =
EndpointManager.GetContract<AbstractLocationQueryContract>(EndPointFunctions.LocationQuery);
request.IgnoreCertificateErrors = true;
var result = request.MakeRequest<LocationQueryResult>();
if (result == null)
{
Log.WarnFormat("An issue occurred while querying server for location data: {0}",
request.GetErrorResult().GetDetails());
return null;
}
SettingsManager.SetTemporarySettingString(SettingKey, result.Location);
return new NextResult();
}
catch (Exception e)
{
return new ExceptionOccurred(e);
}
}
示例14: ContinueResultDecorator
/// <summary>
/// Initializes a new instance of the <see cref="ContinueResultDecorator"/> class.
/// </summary>
/// <param name="result">The result to decorate.</param>
/// <param name="coroutine">The coroutine to execute when <paramref name="result"/> was canceled.</param>
public ContinueResultDecorator(IResult result, Func<IEnumerable<IResult>> coroutine)
: base(result) {
if (coroutine == null)
throw new ArgumentNullException("coroutine");
this.coroutine = coroutine;
}
示例15: NegotiatedResult
public async Task<IResult> NegotiatedResult(IRequestContext context, IResult result)
{
foreach (var interceptor in _interceptors) {
result = await interceptor.NegotiatedResult(context, result);
}
return result;
}