• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IResult的典型用法代码示例。如果您正苦于以下问题:C# IResult类的具体用法?C# IResult怎么用?C# IResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IResult类属于命名空间,在下文中一共展示了IResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
        }
开发者ID:bmbsqd,项目名称:dynamic-media,代码行数:25,代码来源:BytesRangeResultHandler.cs


示例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;
         }
     }
 }
开发者ID:andrewdavis1995,项目名称:Cinema-Game,代码行数:29,代码来源:FBScript.cs


示例3: ContinueResultDecorator

        public ContinueResultDecorator(IResult inner, Func<IEnumerable<IResult>> coroutine)
            : base(inner)
        {
            if (coroutine == null) throw new ArgumentNullException("coroutine");

            _coroutine = coroutine;
        }
开发者ID:hispafox,项目名称:CMContrib,代码行数:7,代码来源:ContinueResultDecorator.cs


示例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);
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:30,代码来源:IdentifyUser.cs


示例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);
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:25,代码来源:VerifyDownloadedFile.cs


示例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);
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:26,代码来源:WaitForProviderHealthy.cs


示例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");
        }
    }
开发者ID:rdenubila,项目名称:Uberland,代码行数:27,代码来源:FacebookCallbacks.cs


示例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);*/
     }
 }
开发者ID:KeithNel,项目名称:natix,代码行数:25,代码来源:CompactPivotsSEQINTSvS.cs


示例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);
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:27,代码来源:ShowChildBannerModal.cs


示例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);
     //                }
     //            }
 }
开发者ID:sadit,项目名称:natix,代码行数:30,代码来源:SATSEQ_ApproxSearch.cs


示例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);
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:27,代码来源:ImportUserCertificateFromFile.cs


示例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();
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:31,代码来源:RetrieveSettingsString.cs


示例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);
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:27,代码来源:GetCurrentLocation.cs


示例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;
        }
开发者ID:Geminior,项目名称:Caliburn.Micro.Extras,代码行数:12,代码来源:ContinueResultDecorator.cs


示例15: NegotiatedResult

 public async Task<IResult> NegotiatedResult(IRequestContext context, IResult result)
 {
     foreach (var interceptor in _interceptors) {
         result = await interceptor.NegotiatedResult(context, result);
     }
     return result;
 }
开发者ID:jammycakes,项目名称:dolstagis.web,代码行数:7,代码来源:Interceptors.cs


示例16: Execute

        public override IResult Execute(IResult previousResults)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(Value))
                    throw new Exception("Cannot truncate value; value is empty.");

                if (string.IsNullOrWhiteSpace(SettingKey))
                    throw  new Exception("Setting key cannot be empty");

                if (Length<=0)
                    throw new Exception("Length must be greater than zero");

                var newValue = Value;
                if (Length < Value.Length)
                    newValue = Value.Substring(0, Length);

                SettingsManager.SetTemporarySettingString(SettingKey, newValue);

                return new NextResult();

            }
            catch (Exception e)
            {
                Log.WarnFormat("An exception occurred while attempting to truncate a string: {0}", e.Message);
                return new NextResult();
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:28,代码来源:TruncateStringLeft.cs


示例17: Execute

        public override IResult Execute(IResult previousResults)
        {
            try
            {
                using (var controller = ServiceUtilities.GetServiceInstance("LanmanServer"))
                {
                    if (controller == null)
                    {
                        if (!ServiceUtilities.IsServiceInfoInRegistry("LanmanServer"))
                            return new ServiceInfoNotInRegistry { ServiceName = "LanmanServer"};

                        return new ServiceInstanceNotAvailable { ServiceName = "LanmanServer" };
                    }

                    var result = Enabled ? EnableService(controller) : DisableService(controller);
                    if (!result.Result)
                        throw  new Exception(result.Reason);

                    return new NextResult();
                }
            }
            catch (Exception e)
            {
                return new ExceptionOccurred(e);
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:26,代码来源:Configure.cs


示例18: Execute

 public override IResult Execute(IResult previousResults)
 {
     try
     {
         var result = SecurityUtilities.QuerySecurityProviderHealth(SecurityUtilities.SecurityProviders.AntiVirus);
         switch (result)
         {
             case SecurityUtilities.SecurityProviderHealth.Good:
                 Log.Info("Windows reports that this computer's anti-virus software is in good health.");
                 return new NextResult();
             case SecurityUtilities.SecurityProviderHealth.NotMonitored:
                 Log.Warn("Windows reports that this computer's anti-virus software is not monitored.");
                 return new AntiVirusHealthNotMonitored();
             case SecurityUtilities.SecurityProviderHealth.Poor:
                 Log.Warn("Windows reports that this computer's anti-virus software is in poor health.");
                 return new AntiVirusHealthPoor();
             case SecurityUtilities.SecurityProviderHealth.Snooze:
                 Log.Warn("Windows reports that this computer's security center is not active.");
                 return new SecurityCenterNotActive();
              default:
                 throw new Exception(string.Format("Could not evaluate anti-virus health: Windows returned unexpected result ({0})",result));
         }
     }
     catch (Exception e)
     {
         return new ExceptionOccurred(e);
     }
 }
开发者ID:jardrake03,项目名称:incert,代码行数:28,代码来源:VerifyAntiVirusSoftware.cs


示例19: Execute

        public override IResult Execute(IResult previousResults)
        {
            try
            {
                var eventData = new LoggingEventData
                    {
                        Level = Event.GetAssociatedLevel(),
                        Message = Message,
                        TimeStamp = DateTime.Now
                    };

                if (eventData.Level == null)
                {
                    Log.Warn("Cannot upload log event; Level is null");
                    return new NextResult();
                }

                if (string.IsNullOrWhiteSpace(eventData.Message))
                    eventData.Message = "[no content]";

                var eventEntry = Asynchronous
                    ? new LoggingEvent(eventData)
                    : new BlockingLoggingEvent(eventData);

                Log.Logger.Log(eventEntry);

                return new NextResult();
            }
            catch (Exception e)
            {
                Log.WarnFormat("An exception occurred while attempting to record a log event: {0}", e.Message);
                return new NextResult();
            }
        }
开发者ID:jardrake03,项目名称:incert,代码行数:34,代码来源:LogEvent.cs


示例20: ChildCompleted

        private void ChildCompleted(IResult previous, Exception exception)
        {
            if(exception != null)
            {
                if (exception is CancelResult)
                    OnComplete(null);
                else OnComplete(exception);

                return;
            }

            if(previous != null)
                previous.Completed -= ChildCompleted;

            if(_enumerator.MoveNext())
            {
                try
                {
                    var next = _enumerator.Current;
                    next.Completed += ChildCompleted;
                    next.Execute(_message, _handlingNode);
                }
                catch(Exception ex)
                {
                    OnComplete(ex);
                    return;
                }
            }
            else OnComplete(null);
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:30,代码来源:SequentialResult.cs



注:本文中的IResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IResultHandler类代码示例发布时间:2022-05-24
下一篇:
C# IRestResponse类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap