当前位置: 首页>>代码示例>>C#>>正文


C# OperationResult类代码示例

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


OperationResult类属于命名空间,在下文中一共展示了OperationResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDetailedConfiguration

        public OperationResult<DetailedConfiguration> GetDetailedConfiguration()
        {
            OperationResult<DetailedConfiguration> opResult = new OperationResult<DetailedConfiguration>();
            var configOpResult = GetConfiguration();
            if (configOpResult.Success)
            {
                List<ConfigurationParameterDetail> details = new List<ConfigurationParameterDetail>();
                foreach (var param in configOpResult.Result.Parameters)
                {

                    var detailOpResult = _connectionManager.SendMessage<ConfigDetailResponseMessage>(new RequestMessageWithParam
                    {
                        MessageId = (int)MessageTypeId.ConfigurationGet,
                        Param = param.Name,
                    });

                    if (detailOpResult.Success)
                    {
                        details.Add(Helpers.GetParameterDetailFromMessage(detailOpResult.Result));
                        details.Last().Value = param.Value;
                    }
                    else
                    {
                        return opResult.SetFail(detailOpResult.ResultMessage);
                        //return OperationResult<List<ConfigParameterDetail>>.GetFail(detailOpResult.ResultMessage);
                    }
                }

                //return OperationResult<List<ConfigParameterDetail>>.GetSucces(details);
                return opResult.SetSucces(new DetailedConfiguration { Parameters = details });
            }

            return opResult.SetFail(configOpResult.ResultMessage);
            //return OperationResult<List<ConfigParameterDetail>>.GetFail(configOpResult.ResultMessage);
        }
开发者ID:b85,项目名称:XiaomiYiApp,代码行数:35,代码来源:CameraConfigurationService.cs

示例2: GetUArticles

        /// <summary>
        /// 获取用户作品列表
        /// </summary>
        /// <param name="otherUserId"></param>
        /// <param name="type"></param>
        /// <param name="tag"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public async Task<OperationResult<List<UArticle>>> GetUArticles(string otherUserId, string type, string tag, int pageIndex, int pageSize)
        {
            FormData.Clear();

            FormData["userid"] = otherUserId;
            FormData["sid"] = LocalSetting.Current.GetValue<string>("sessionid") ?? "";
            FormData["deviceId"] = DeviceHelper.GetDeviceId().ToString();
            FormData["type"] = type;
            FormData["tag"] = tag;
            FormData["pindex"] = pageIndex.ToString();
            FormData["psize"] = pageSize.ToString();

            var result = new OperationResult<List<UArticle>>();

            var response = await GetResponse(ServiceURL.UArticle_UArticleList);
            result.Retcode = response?.GetNamedString("retcode");

            if (response != null && result.Retcode?.CheckSuccess() == true)
            {
                var data = response.GetNamedValue("data");

                result.Data = JsonConvert.DeserializeObject<List<UArticle>>(data.ToString());
            }

            return result;
        }
开发者ID:BiaoLiu,项目名称:YLP.UWP,代码行数:35,代码来源:UArticleService.cs

示例3: Check

        public IOperationResult Check(MutationContext context)
        {
            var result = new OperationResult();

              CheckNoClassesInheritFromRole(context, result);

              CheckNoInstancesAreCreatedForRole(context, result);

              CheckRoleDoesntComposeItself(result);

              CheckRoleDoesntImplementInterfacesExplicitly(result);

              CheckRoleHasNoPInvokeMethods(result);

              CheckRoleHasNoPlaceholders(result);

              /* TODO Checks:
            * a role can't be a struct
            * static members? right now it's being checked in the wrong class!
            * cannot have parameterized constructors - where is this being checked?
              * only a single parameterless constructor is supported
            * cannot have base classes (other than object), but can have base interfaces
            */

              return result;
        }
开发者ID:cessationoftime,项目名称:nroles,代码行数:26,代码来源:RoleConstraintsValidator.cs

示例4: MinusMatrixInverseMatrixMultiply_MAPLE_Test2

        public void MinusMatrixInverseMatrixMultiply_MAPLE_Test2()
        {
            var tileSize = 5;
            var delta = 0.000000001;

            var a = new Matrix<double>(new double[,] { { -32, 9, 25, 50, -40, 3, 66, -11, 73 }, { -92, 71, 80, 26, 95, 31, -23, -70, -88 }, { -60, -59, 87, 16, 63, -45, -78, 25, -69 }, { 19, 57, -34, 22, -64, 75, -53, -61, -98 }, { 43, 64, -59, 51, -24, -84, -35, -79, -9 }, { -16, -74, -77, 91, 32, -88, -28, 39, -16 }, { -49, -91, -11, 78, 40, -21, -32, -98, 11 }, { 95, -30, -39, 90, -6, -65, 86, -76, 49 }, { 29, 17, 72, -90, -10, 41, 56, -14, -52 } });
            var b = new Matrix<double>(new double[,] { { 77, 63, -62, -66, -6, -56, 80, -14, -65 }, { 4, -53, -65, -36, 42, 15, 34, 78, -5 }, { -30, 82, -1, 68, -62, 3, 17, -75, -10 }, { 84, 60, 16, 63, 67, 45, 53, -42, 2 }, { 87, 95, 92, 79, -63, 64, -36, 62, -1 }, { -8, -41, 82, -89, -54, 51, 96, -61, -73 }, { -38, -38, -45, 40, -75, 86, 75, 68, 28 }, { -7, 37, -36, 65, -88, -61, -6, -99, -79 }, { 98, 8, -37, 39, 91, 86, -27, -63, -72 } });

            // MinusMatrixInverseMatrix expects its second argument to be LU Factorized
            b = b.GetLU();

            var expected = MatrixHelpers.Tile(new Matrix<double>(new[,] { { 0.01984508466, 0.9042399904, 0.3995515772, -0.7745771722, 0.2994725178, 0.1084556411, -0.6575886106, -0.05301668731, 0.5444903099 }, { 1.855372611, -5.371281536, -4.104553393, -0.1121640216, -0.7296221045, -1.180498074, 3.045677622, 0.1386335471, 0.2821013684 }, { 1.929588849, -4.235913487, -1.189842573, -0.4245090055, -0.7875419486, -0.8542334129, 2.365695716, -1.087624087, 0.7376953336 }, { -0.3015200144, 0.06444804897, -1.093050084, 1.295819257, -0.3278095393, -0.09936130892, -0.08586242003, 0.2752136949, -1.135640896 }, { -0.6678456488, 1.635971997, 0.7408829678, -0.03480275626, 0.3196134418, 0.6555494623, -0.4839099415, -0.3891630982, -0.1698423028 }, { 0.9195999547, -1.811264799, 0.7645929720, -0.9267010695, -0.04031193539, 0.2576350183, 0.4513746375, -1.641684280, 0.6576041476 }, { 0.8358290298, 0.4796609017, 0.9546484769, -0.7810311114, 0.6595774182, 0.08541865288, -0.1904549301, -0.9345738811, 0.06621834781 }, { -0.6369792740, 3.263015949, 3.301792682, -1.825297016, 0.8801089887, 0.6821136696, -1.785435645, -1.226781234, 0.4676272889 }, { -0.2239907182, -0.3318901401, -0.4804214610, 0.2182583930, -0.2667527668, -0.6941578781, 0.3641733215, 0.4656006742, -0.08591310567 } }), tileSize);

            var opData1 = new OperationResult<double>(MatrixHelpers.Tile(a, tileSize));
            var opData2 = new OperationResult<double>(MatrixHelpers.Tile(b, tileSize));

            OperationResult<double> actual;
            var nmimmProducer = new MinusMatrixInverseMatrixMultiply<double>(opData1, opData2, out actual);
            var pm = new Manager(nmimmProducer);
            pm.Start();
            pm.Join();

            MatrixHelpers.IsDone(actual);
            MatrixHelpers.Diff(expected, actual.Data, delta);
            MatrixHelpers.Compare(expected, actual.Data, delta);
        }
开发者ID:egil,项目名称:Inversion-of-Block-Tridiagonal-Matrices,代码行数:26,代码来源:MinusMatrixInverseMatrixMultiplyTest.cs

示例5: InvokeMethod

        public OperationResult<Message> InvokeMethod(Phrase phrase)
        {
            var res = new OperationResult<Message>();
            var msg = new Message();

            try
            {
                object mres = phrase.Method.Invoke("dummy", phrase.Params != null? phrase.Params.ToArray():null);

                var mStream = new MemoryStream();
                var formatter = new BinaryFormatter();
                formatter.Serialize(mStream, mres);
                mStream.Close();

                //var marshall = new XmlSerializer(mres.GetType());
                //var mStream = new MemoryStream();

                //marshall.Serialize(mStream, mres);

                using (var reader = new StreamReader(mStream))
                {
                    msg.Value = reader.ReadToEnd();
                }
            }
            catch (Exception ex)
            {
                res.HasError = true;
                res.Message = ex.Message;
            }

            res.Result = msg;

            return res;
        }
开发者ID:Codellion,项目名称:Verso,代码行数:34,代码来源:DataCommunication.cs

示例6: OnInit

		public void OnInit(OperationResult status)
		{
			if (_speakerSpeech == null)
			{
				Task.Run(() =>
				{
					_initMutex.WaitOne();
					LazyResolver<IDispatcherService>.Service.InvokeOnUIThread(() => OnInit(status));
				});

				return;
			}
			_speakerSpeech.SetLanguage(Locale.Default);
			_speakerSpeech.SetOnUtteranceCompletedListener(this);

			Dictionary<string, string> speakParameters = new Dictionary<string, string>
			{
				{TextToSpeech.Engine.KeyParamUtteranceId, INITIALIZE_UTTERANCE_ID}
			};

			string word = "india rose";
#if __ANDROID_11__
			if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb)
			{
				word = "a";
				speakParameters.Add(TextToSpeech.Engine.KeyParamVolume, "0");
			}
#endif
			_speakerSpeech.Speak(word, QueueMode.Add, speakParameters);
			Log.Error("TTS", "Engine initialized");
		}
开发者ID:india-rose,项目名称:xamarin-indiarose,代码行数:31,代码来源:TextToSpeechService.cs

示例7: Test

        // Testing Instance
        // Input: AddonTestRequest request
        // Output: OperationResult
        public override OperationResult Test(AddonTestRequest request)
        {
            var testResult = new OperationResult {IsSuccess = false};
            var apr = new AddonProvisionRequest
            {
                DeveloperParameters = request.DeveloperParameters,
                Manifest = request.Manifest
            };

            var dpr = new AddonDeprovisionRequest
            {
                DeveloperParameters = request.DeveloperParameters,
                Manifest = request.Manifest
            };
            var provisionTest = Provision(apr);
            if (!provisionTest.IsSuccess)
            {
                return provisionTest;
            }
            var testProgress = provisionTest.EndUserMessage;
            var deprovisionTest = Deprovision(dpr);
            if (!deprovisionTest.IsSuccess)
            {
                return deprovisionTest;
            }
            testProgress += deprovisionTest.EndUserMessage;
            testResult.IsSuccess = true;
            testResult.EndUserMessage = testProgress;
            return testResult;
        }
开发者ID:apprenda,项目名称:Apprenda-NetApp-Integration,代码行数:33,代码来源:NetAppAddon.cs

示例8: btnSim_Click

    protected void btnSim_Click(object sender, EventArgs e)
    {
        DataFieldCollection lFields = new DataFieldCollection();
        OperationResult lreturn = new OperationResult();

        try
        {
            lFields.Add(DEFENSORITINERANCIAQD._DEF_ID, ddlDefensores.SelectedValue);
            lFields.Add(DEFENSORITINERANCIAQD._DEFI_DISPOSICAO, rblItinerancia.SelectedValue);
            lFields.Add(DEFENSORITINERANCIAQD._DEFI_USUARIOS, Session["_SessionUser"].ToString());
            lFields.Add(DEFENSORITINERANCIAQD._DEFI_REGDATE, DateTime.Now);
            lFields.Add(DEFENSORITINERANCIAQD._DEFI_STATUS, "A");

            lreturn = DEFENSORITINERANCIADo.Insert(lFields, LocalInstance.ConnectionInfo);

            if (!lreturn.IsValid)
            {
                Exception exc = new Exception(lreturn.OperationException.Message.ToString());
                throw exc;
            }
            else
            {
                MessageBox1.wuc_ShowMessage("Registro efetuado com sucesso!", 1);
                LoadDefensor();
            }

        }
        catch (Exception err)
        {
            (new UnknownException(err)).TratarExcecao(true);
        }
    }
开发者ID:andreibaptista,项目名称:DEF_PUB_DEFNET_PORTAL,代码行数:32,代码来源:Itinerancia.aspx.cs

示例9: ConnectResult

        public ConnectResult(OperationResult operationResult)
            : base(operationResult.IsSuccessful,
			operationResult.StatusCode,
			operationResult.StatusName,
			operationResult.StatusDescription)
        {
        }
开发者ID:Patapum,项目名称:Lando,代码行数:7,代码来源:ConnectResult.cs

示例10: WaitForResultOfRequest

        protected void WaitForResultOfRequest(ILog logger, string workerTypeName, IOperation operation, Guid subscriptionId, string certificateThumbprint, string requestId)
        {
            OperationResult operationResult = new OperationResult();
            operationResult.Status = OperationStatus.InProgress;
            bool done = false;
            while (!done)
            {
                operationResult = operation.StatusCheck(subscriptionId, certificateThumbprint, requestId);
                if (operationResult.Status == OperationStatus.InProgress)
                {
                    string logMessage = string.Format(CultureInfo.CurrentCulture, "{0} '{1}' submitted a deployment request with ID '{2}', the operation was found to be in process, waiting for '{3}' seconds.", workerTypeName, this.Id, requestId, FiveSecondsInMilliseconds / 1000);
                    logger.Info(logMessage);
                    Thread.Sleep(FiveSecondsInMilliseconds);
                }
                else
                {
                    done = true;
                }
            }

            if (operationResult.Status == OperationStatus.Failed)
            {
                string logMessage = string.Format(CultureInfo.CurrentCulture, "{0} '{1}' submitted a deployment request with ID '{2}' and it failed. The code was '{3}' and message '{4}'.", workerTypeName, this.Id, requestId, operationResult.Code, operationResult.Message);
                logger.Error(logMessage);
            }
            else if (operationResult.Status == OperationStatus.Succeeded)
            {
                string logMessage = string.Format(CultureInfo.CurrentCulture, "{0} '{1}' submitted a deployment request with ID '{2}' and it succeeded. The code was '{3}' and message '{4}'.", workerTypeName, this.Id, requestId, operationResult.Code, operationResult.Message);
                logger.Info(logMessage);
            }
        }
开发者ID:StealFocus,项目名称:Forecast,代码行数:31,代码来源:HostedServiceForecastWorker.cs

示例11: Execute

        public override bool Execute()
        {
            var timer = new Stopwatch();
              timer.Start();
              Log.LogMessage("NRoles v" + _Metadata.Version);

              if (ShowTrace) {
            SetUpTraceListener();
              }

              IOperationResult result;
              try {
            result = new RoleEngine().Execute(
              new RoleEngineParameters(AssemblyPath) {
            TreatWarningsAsErrors = TreatWarningsAsErrors,
            RunPEVerify = false,
            References = References.Split(';')
              });
            LogMessages(result);
              }
              catch (Exception ex) {
            result = new OperationResult();
            result.AddMessage(Error.InternalError());
            LogMessages(result);
            Log.LogErrorFromException(ex);
              }

              timer.Stop();
              Log.LogMessage("NRoles done, took {0}s", (timer.ElapsedMilliseconds / 1000f));
              return result.Success;
        }
开发者ID:cessationoftime,项目名称:nroles,代码行数:31,代码来源:RoleTask.cs

示例12: GetUArticles

        public async Task<OperationResult<List<UArticle>>> GetUArticles(Dictionary<string, string> dict, int pageIndex, int pageSize)
        {
            FormData.Clear();

            foreach (var item in dict.Keys)
            {
                FormData[item] = dict[item];
            }
            //FormData["pindex"] = pageIndex.ToString();
            //FormData["psize"] = pageSize.ToString();

            FormData["pindex"] = pageIndex.ToString();
            FormData["psize"] = pageSize.ToString();

            var result = new OperationResult<List<UArticle>>();

            var response = await GetResponse(ServiceURL.UArticle_UArticleList);
            result.Retcode = response?.GetNamedString("retcode");

            if (response != null && result.Retcode?.CheckSuccess() == true)
            {
                var data = response.GetNamedValue("data");

                result.Data = JsonConvert.DeserializeObject<List<UArticle>>(data.ToString());
            }

            return result;
        }
开发者ID:BiaoLiu,项目名称:YLP.UWP.TOOLS,代码行数:28,代码来源:UArticleService.cs

示例13: ArithmeticValidateCodeBuilder

 static ArithmeticValidateCodeBuilder()
 {
     // 定义加减法
     Operations = new Tuple<string, Func<int, int, OperationResult>>[2];
     Operations[0] = new Tuple<string, Func<int, int, OperationResult>>(Plus, (x, y) =>
     {
         var result = new OperationResult
         {
             X = x,
             Y = y,
             Result = x + y
         };
         return result;
     });
     Operations[1] = new Tuple<string, Func<int, int, OperationResult>>(Subtract, (x, y) =>
     {
         // 如果 x 小于 y,则将 x 和 y 值互换,以免出现负数的情况
         if (y > x)
         {
             int tempX = y;
             y = x;
             x = tempX;
         }
         var result = new OperationResult
         {
             X = x,
             Y = y,
             Result = x - y
         };
         return result;
     });
 }
开发者ID:ChuHaiQuan,项目名称:SSO_SITE,代码行数:32,代码来源:CommValidateCode.cs

示例14: ValidateManifest

        public bool ValidateManifest(AddonManifest manifest, out OperationResult testResult)
        {
            testResult = new OperationResult();

            var prop =
                    manifest.Properties.FirstOrDefault(
                        p => p.Key.Equals("requireDevCredentials", StringComparison.InvariantCultureIgnoreCase));

            if (prop == null || !prop.HasValue)
            {
                testResult.IsSuccess = false;
                testResult.EndUserMessage = "Missing required property 'requireDevCredentials'. This property needs to be provided as part of the manifest";
                return false;
            }

            if (string.IsNullOrWhiteSpace(manifest.ProvisioningUsername) ||
                string.IsNullOrWhiteSpace(manifest.ProvisioningPassword))
            {
                testResult.IsSuccess = false;
                testResult.EndUserMessage = "Missing credentials 'provisioningUsername' & 'provisioningPassword' . These values needs to be provided as part of the manifest";
                return false;
            }

            return true;
        }
开发者ID:ernestohs,项目名称:Apprenda-AWS-Integration,代码行数:25,代码来源:Addon.cs

示例15: Create

        public ActionResult Create(Banka model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    using (ButceTakipContext context = new ButceTakipContext())
                    {
                        var count = context.Bankalar.Count();
                        context.Bankalar.Add(model);
                        context.SaveChanges();
                    }
                    TempData["OperationResult"] = new OperationResult()
                    {
                        Message = string.Format("{0} {1} başarıyla yaratıldı.", model.Aciklama, model.Sube),
                        Success = true,
                    };
                    return RedirectToAction("Index");
                }
                catch (Exception)
                {

                    TempData["OperationResult"] = new OperationResult()
                    {
                        Message = string.Format("{0} {1} hata oluştu.", model.Aciklama, model.Sube),
                        Success = false,
                    };
                }

            }
            return View(model);
        }
开发者ID:tolahs,项目名称:ButceTakip,代码行数:32,代码来源:BankaController.cs


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