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

C# InvokeOptions类代码示例

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

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



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

示例1: AuthorizeAsync

        public async Task<AuthorizeResult> AuthorizeAsync(bool trySilent = false, object extraParameters = null)
        {
            InvokeResult wviResult;
            AuthorizeResult result = new AuthorizeResult
            {
                IsError = true,
            };

            // todo: replace with CryptoRandom
            result.Nonce = Guid.NewGuid().ToString("N");
            result.RedirectUri = _options.RedirectUri;
            string codeChallenge = CreateCodeChallenge(result);
            var url = await CreateUrlAsync(result, codeChallenge, extraParameters);
            var webViewOptions = new InvokeOptions(url, _options.RedirectUri);
            if (trySilent)
            {
                webViewOptions.InitialDisplayMode = DisplayMode.Hidden;
            }
            if (_options.UseFormPost)
            {
                webViewOptions.ResponseMode = ResponseMode.FormPost;
            }

            // try silent mode if requested
            wviResult = await _options.WebView.InvokeAsync(webViewOptions);

            if (wviResult.ResultType == InvokeResultType.Success)
            {
                return await ParseResponse(wviResult.Response, result);
            }

            result.Error = wviResult.ResultType.ToString();
            return result;
        }
开发者ID:IdentityModel,项目名称:UwpOidcClient,代码行数:34,代码来源:AuthorizeClient.cs


示例2: InvokeMethod

        public IStrongValueHandle<IValue> InvokeMethod(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments)
        {
            Contract.Requires<ArgumentNullException>(method != null, "method");
            Contract.Requires<VirtualMachineMismatchException>(thread == null || this.GetVirtualMachine().Equals(thread.GetVirtualMachine()));
            Contract.Requires<VirtualMachineMismatchException>(method.GetVirtualMachine().Equals(this.GetVirtualMachine()));
#if CONTRACTS_FORALL
            Contract.Requires<VirtualMachineMismatchException>(arguments == null || Contract.ForAll(arguments, argument => argument == null || this.GetVirtualMachine().Equals(argument.GetVirtualMachine())));
#endif
            Contract.Ensures(Contract.Result<IStrongValueHandle<IValue>>() == null || this.GetVirtualMachine().Equals(Contract.Result<IStrongValueHandle<IValue>>().GetVirtualMachine()));

            throw new NotImplementedException();
        }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:12,代码来源:IObjectReferenceContracts.cs


示例3: InvokeMethodInternal

        private void InvokeMethodInternal(InvokeParams invokeParams)
        {
            var invokeOptions = new InvokeOptions()
            {
                ClassName = invokeParams.TypeName,
                MethodName = invokeParams.MethodName,
                Async = true
            };

            var compilerOptions = new CompilerOptions()
            {
                FilePath = invokeParams.FilePath,
                ReferencedAssemblyPaths = BuildManager.GetReferencedAssemblies().OfType<Assembly>().Select(x => x.Location).ToArray(),
                SignKeyPath = invokeParams.KeyPath,
                OutputAssemblyName = invokeParams.AsmName
            };

            MethodInvoker.Execute(invokeOptions, compilerOptions);
        }
开发者ID:Gebov,项目名称:no-compile,代码行数:19,代码来源:MethodInvokerService.cs


示例4: EndSessionAsync

        public async Task EndSessionAsync(string identityToken = null, bool trySilent = true)
        {
            string url = (await _options.GetEndpointsAsync()).EndSession;

            if (!string.IsNullOrWhiteSpace(identityToken))
            {
                url += $"?{OidcConstants.EndSessionRequest.IdTokenHint}={identityToken}" +
                       $"&{OidcConstants.EndSessionRequest.PostLogoutRedirectUri}={_options.RedirectUri}";
            }

            var webViewOptions = new InvokeOptions(url, _options.RedirectUri)
            {
                ResponseMode = ResponseMode.Redirect
            };

            if (trySilent)
            {
                webViewOptions.InitialDisplayMode = DisplayMode.Hidden;
            }

            var result = await _options.WebView.InvokeAsync(webViewOptions);
        }
开发者ID:IdentityModel,项目名称:UwpOidcClient,代码行数:22,代码来源:AuthorizeClient.cs


示例5: InvokeMethodAsyncWithResult

		public Task<InvokeResult> InvokeMethodAsyncWithResult (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options = InvokeOptions.None) {
			var tcs = new TaskCompletionSource<InvokeResult> ();
			BeginInvokeMethod (thread, method, arguments, options, iar =>
					{
						try {
							tcs.SetResult (EndInvokeMethodInternalWithResult (iar));
						} catch (OperationCanceledException) {
							tcs.TrySetCanceled ();
						} catch (Exception ex) {
							tcs.TrySetException (ex);
						}
					}, null);
			return tcs.Task;
		}
开发者ID:xzkmxd,项目名称:mono,代码行数:14,代码来源:ObjectMirror.cs


示例6: BeginInvokeMethod

		public IAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
			return BeginInvokeMethod (vm, thread, method, this, arguments, options, callback, state);
		}
开发者ID:xzkmxd,项目名称:mono,代码行数:3,代码来源:ObjectMirror.cs


示例7: InvokeMethod

		public Value InvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options) {
			return InvokeMethod (vm, thread, method, this, arguments, options);
		}
开发者ID:xzkmxd,项目名称:mono,代码行数:3,代码来源:ObjectMirror.cs


示例8: NewInstance

		public Value NewInstance (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options) {
			if (method == null)
				throw new ArgumentNullException ("method");

			if (!method.IsConstructor)
				throw new ArgumentException ("The method must be a constructor.", "method");

			return ObjectMirror.InvokeMethod (vm, thread, method, null, arguments, options);
		}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:9,代码来源:TypeMirror.cs


示例9: BeginInvokeMethod

		public IAsyncResult BeginInvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
			return ObjectMirror.BeginInvokeMethod (vm, thread, method, null, arguments, options, callback, state);
		}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:3,代码来源:TypeMirror.cs


示例10: InvokeAsync

        public async Task<InvokeResult> InvokeAsync(InvokeOptions options)
        {
            using (var form = _formFactory.Invoke())
            using (var browser = new ExtendedWebBrowser()
            {
                Dock = DockStyle.Fill
            })
            {
                var signal = new SemaphoreSlim(0, 1);

                var result = new InvokeResult
                {
                    ResultType = InvokeResultType.UserCancel
                };

                form.FormClosed += (o, e) =>
                {
                    signal.Release();
                };

                browser.NavigateError += (o, e) =>
                {
                    e.Cancel = true;
                    result.ResultType = InvokeResultType.HttpError;
                    result.Error = e.StatusCode.ToString();
                    signal.Release();
                };

                browser.BeforeNavigate2 += (o, e) =>
                {
                    if (e.Url.StartsWith(options.EndUrl))
                    {
                        e.Cancel = true;
                        result.ResultType = InvokeResultType.Success;
                        if (options.ResponseMode == ResponseMode.FormPost)
                        {
                            result.Response = Encoding.UTF8.GetString(e.PostData ?? new byte[] { });
                        }
                        else
                        {
                            result.Response = e.Url;
                        }
                        signal.Release();
                    }
                };

                form.Controls.Add(browser);
                browser.Show();

                System.Threading.Timer timer = null;
                if (options.InitialDisplayMode != DisplayMode.Visible)
                {
                    result.ResultType = InvokeResultType.Timeout;
                    timer = new System.Threading.Timer((o) =>
                    {
                        var args = new HiddenModeFailedEventArgs(result);
                        HiddenModeFailed?.Invoke(this, args);
                        if (args.Cancel)
                        {
                            browser.Stop();
                            form.Invoke(new Action(() => form.Close()));
                        }
                        else
                        {
                            form.Invoke(new Action(() => form.Show()));
                        }
                    }, null, (int)options.InvisibleModeTimeout.TotalSeconds * 1000, Timeout.Infinite);
                }
                else
                {
                    form.Show();
                }

                browser.Navigate(options.StartUrl);

                await signal.WaitAsync();
                if (timer != null) timer.Change(Timeout.Infinite, Timeout.Infinite);

                form.Hide();
                browser.Hide();

                return result;
            }
        }
开发者ID:joaomello,项目名称:IdentityModel.OidcClient.Samples,代码行数:84,代码来源:WinFormsWebView.cs


示例11: NewInstance

		public Value NewInstance (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options) {
			return ObjectMirror.InvokeMethod (vm, thread, method, null, arguments, options);
		}
开发者ID:nestalk,项目名称:mono,代码行数:3,代码来源:TypeMirror.cs


示例12: InvokeAsyncCore

        private async Task<InvokeResult> InvokeAsyncCore(InvokeOptions options, bool silentMode)
        {
            var wabOptions = WebAuthenticationOptions.None;

            if (options.ResponseMode == ResponseMode.FormPost)
            {
                wabOptions |= WebAuthenticationOptions.UseHttpPost;
            }
            if (_enableWindowsAuthentication)
            {
                wabOptions |= WebAuthenticationOptions.UseCorporateNetwork;
            }
            if (silentMode)
            {
                wabOptions |= WebAuthenticationOptions.SilentMode;
            }

            WebAuthenticationResult wabResult;

            try
            {
                if (string.Equals(options.EndUrl, WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri, StringComparison.Ordinal))
                {
                    wabResult = await WebAuthenticationBroker.AuthenticateAsync(
                        wabOptions, new Uri(options.StartUrl));
                }
                else
                {
                    wabResult = await WebAuthenticationBroker.AuthenticateAsync(
                        wabOptions, new Uri(options.StartUrl), new Uri(options.EndUrl));
                }
            }
            catch (Exception ex)
            {
                return new InvokeResult
                {
                    ResultType = InvokeResultType.UnknownError,
                    Error = ex.ToString()
                };
            }

            if (wabResult.ResponseStatus == WebAuthenticationStatus.Success)
            {
                return new InvokeResult
                {
                    ResultType = InvokeResultType.Success,
                    Response = wabResult.ResponseData
                };
            }
            else if (wabResult.ResponseStatus == WebAuthenticationStatus.ErrorHttp)
            {
                return new InvokeResult
                {
                    ResultType = InvokeResultType.HttpError,
                    Error = string.Concat(wabResult.ResponseErrorDetail.ToString())
                };
            }
            else if (wabResult.ResponseStatus == WebAuthenticationStatus.UserCancel)
            {
                return new InvokeResult
                {
                    ResultType = InvokeResultType.UserCancel
                };
            }
            else
            {
                return new InvokeResult
                {
                    ResultType = InvokeResultType.UnknownError,
                    Error = "Invalid response from WebAuthenticationBroker"
                };
            }
        }
开发者ID:IdentityModel,项目名称:UwpOidcClient,代码行数:73,代码来源:UwpWebView.cs


示例13: BeginInvokeMultiple

		//
		// Invoke the members of METHODS one-by-one, calling CALLBACK after each invoke was finished. The IAsyncResult will be marked as completed after all invokes have
		// finished. The callback will be called with a different IAsyncResult that represents one method invocation.
		// From protocol version 2.22.
		//
		public IAsyncResult BeginInvokeMultiple (ThreadMirror thread, MethodMirror[] methods, IList<IList<Value>> arguments, InvokeOptions options, AsyncCallback callback, object state) {
			return BeginInvokeMultiple (vm, thread, methods, this, arguments, options, callback, state);
		}
开发者ID:xzkmxd,项目名称:mono,代码行数:8,代码来源:ObjectMirror.cs


示例14: InvokeObjectMethod

        public Error InvokeObjectMethod(out Value returnValue, out TaggedObjectId thrownException, ObjectId @object, ThreadId thread, ClassId @class, MethodId method, InvokeOptions options, Value[] arguments)
        {
            if (thread == default(ThreadId))
                throw new ArgumentException();

            byte[] packet = new byte[HeaderSize + ObjectIdSize + ThreadIdSize + ClassIdSize + MethodIdSize + sizeof(int)];
            WriteObjectId(packet, HeaderSize, @object);
            WriteObjectId(packet, HeaderSize + ObjectIdSize, thread);
            WriteReferenceTypeId(packet, HeaderSize + ObjectIdSize + ThreadIdSize, @class);
            WriteMethodId(packet, HeaderSize + ObjectIdSize + ThreadIdSize + ClassIdSize, method);
            WriteInt32(packet, HeaderSize + ObjectIdSize + ThreadIdSize + ClassIdSize + MethodIdSize, arguments.Length);

            List<byte> packetData = new List<byte>(packet);
            foreach (Value argument in arguments)
            {
                switch (argument.Tag)
                {
                case Tag.Byte:
                    throw new NotImplementedException();

                case Tag.Char:
                    throw new NotImplementedException();

                case Tag.Float:
                    throw new NotImplementedException();

                case Tag.Double:
                    throw new NotImplementedException();

                case Tag.Int:
                    throw new NotImplementedException();

                case Tag.Long:
                    throw new NotImplementedException();

                case Tag.Short:
                    throw new NotImplementedException();

                case Tag.Boolean:
                    throw new NotImplementedException();

                case Tag.Array:
                case Tag.Object:
                case Tag.String:
                case Tag.Thread:
                case Tag.ThreadGroup:
                case Tag.ClassLoader:
                case Tag.ClassObject:
                    throw new NotImplementedException();

                case Tag.Void:
                    throw new NotImplementedException();

                case Tag.Invalid:
                default:
                    throw new InvalidOperationException();
                }
            }

            byte[] optionsData = new byte[sizeof(int)];
            WriteInt32(optionsData, 0, (int)options);
            packetData.AddRange(optionsData);

            packet = packetData.ToArray();
            int id = GetMessageId();
            SerializeHeader(packet, id, ObjectReferenceCommand.InvokeMethod);

            byte[] response = SendPacket(id, packet);
            Error errorCode = ReadErrorCode(response);
            if (errorCode != Error.None)
            {
                returnValue = default(Value);
                thrownException = default(TaggedObjectId);
                return errorCode;
            }

            int offset = HeaderSize;
            returnValue = ReadValue(response, ref offset);
            thrownException = ReadTaggedObjectId(response, ref offset);
            return Error.None;
        }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:81,代码来源:JdwpDebugProtocolService.cs


示例15: CreateClassInstance

 public Error CreateClassInstance(out TaggedObjectId newObject, out TaggedObjectId thrownException, ClassId @class, ThreadId thread, MethodId method, InvokeOptions options, Value[] arguments)
 {
     throw new NotImplementedException();
 }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:4,代码来源:JdwpDebugProtocolService.cs


示例16: InvokeClassMethod

 public Error InvokeClassMethod(out Value returnValue, out TaggedObjectId thrownException, ClassId @class, ThreadId thread, MethodId method, InvokeOptions options, Value[] arguments)
 {
     throw new NotImplementedException();
 }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:4,代码来源:JdwpDebugProtocolService.cs


示例17: InvokeAsync

        public async Task<InvokeResult> InvokeAsync(InvokeOptions options)
        {
            if (string.IsNullOrWhiteSpace(options.StartUrl)) throw new ArgumentException("Missing StartUrl", nameof(options));
            if (string.IsNullOrWhiteSpace(options.EndUrl)) throw new ArgumentException("Missing EndUrl", nameof(options));

            switch (options.InitialDisplayMode)
            {
                case DisplayMode.Visible:
                    return await InvokeAsyncCore(options, false);

                case DisplayMode.Hidden:
                    var result = await InvokeAsyncCore(options, true);
                    if (result.ResultType != InvokeResultType.Success)
                    {
                        var args = new HiddenModeFailedEventArgs(result);
                        HiddenModeFailed?.Invoke(this, args);
                        if (!args.Cancel)
                        {
                            result = await InvokeAsyncCore(options, false);
                        }
                    }
                    return result;
            }

            throw new ArgumentException("Invalid DisplayMode", nameof(options));
        }
开发者ID:IdentityModel,项目名称:UwpOidcClient,代码行数:26,代码来源:UwpWebView.cs


示例18: InvokeClassMethod

        public Error InvokeClassMethod(ClassId @class, ThreadId thread, MethodId method, InvokeOptions options, Value[] arguments, out Value returnValue, out TaggedObjectId thrownException)
        {
            returnValue = default(Value);
            thrownException = default(TaggedObjectId);

            JniEnvironment nativeEnvironment;
            JvmtiEnvironment environment;
            jvmtiError error = GetEnvironment(out environment, out nativeEnvironment);
            if (error != jvmtiError.None)
                return GetStandardError(error);

            string name;
            string signature;
            string genericSignature;
            error = environment.GetMethodName(method, out name, out signature, out genericSignature);
            if (error != jvmtiError.None)
                return GetStandardError(error);

            if (thread != default(ThreadId))
                throw new NotImplementedException();

            List<string> argumentTypeSignatures;
            string returnTypeSignature;
            SignatureHelper.ParseMethodSignature(signature, out argumentTypeSignatures, out returnTypeSignature);

            using (var classHandle = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, @class))
            {
                if (!classHandle.IsAlive)
                    return Error.InvalidClass;

                // don't do argument conversion if the signature is invalid
                switch (returnTypeSignature[0])
                {
                case 'Z':
                case 'B':
                case 'C':
                case 'D':
                case 'F':
                case 'I':
                case 'J':
                case 'S':
                case '[':
                case 'L':
                    break;

                case 'V':
                default:
                    return Error.InvalidMethodid;
                }

                jvalue[] args = arguments.Select(value => new jvalue(VirtualMachine, environment, nativeEnvironment, value)).ToArray();

                switch (returnTypeSignature[0])
                {
                case 'Z':
                    returnValue = nativeEnvironment.CallStaticBooleanMethodA(classHandle.Value, method, args);
                    break;

                case 'B':
                    returnValue = nativeEnvironment.CallStaticByteMethodA(classHandle.Value, method, args);
                    break;

                case 'C':
                    returnValue = nativeEnvironment.CallStaticCharMethodA(classHandle.Value, method, args);
                    break;

                case 'D':
                    returnValue = nativeEnvironment.CallStaticDoubleMethodA(classHandle.Value, method, args);
                    break;

                case 'F':
                    returnValue = nativeEnvironment.CallStaticFloatMethodA(classHandle.Value, method, args);
                    break;

                case 'I':
                    returnValue = nativeEnvironment.CallStaticIntMethodA(classHandle.Value, method, args);
                    break;

                case 'J':
                    returnValue = nativeEnvironment.CallStaticLongMethodA(classHandle.Value, method, args);
                    break;

                case 'S':
                    returnValue = nativeEnvironment.CallStaticShortMethodA(classHandle.Value, method, args);
                    break;

                case '[':
                case 'L':
                    jobject result = nativeEnvironment.CallStaticObjectMethodA(classHandle.Value, method, args);
                    returnValue = VirtualMachine.TrackLocalObjectReference(result, environment, nativeEnvironment, false);
                    VirtualMachine.AddGlobalReference(environment, nativeEnvironment, result);
                    nativeEnvironment.DeleteLocalReference(result);
                    break;

                case 'V':
                default:
                    Contract.Assert(false, "not reachable");
                    break;
                }

//.........这里部分代码省略.........
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:101,代码来源:DebugProtocolService.cs


示例19: InvokeMethod

 public IStrongValueHandle<IValue> InvokeMethod(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments)
 {
     throw new NotImplementedException();
 }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:4,代码来源:IThreadGroupReferenceContracts.cs


示例20: StartInvokeAsync

 public Task StartInvokeAsync(InvokeOptions options)
 {
     throw new NotImplementedException();
 }
开发者ID:joaomello,项目名称:IdentityModel.OidcClient.Samples,代码行数:4,代码来源:UwpWebView.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IoSession类代码示例发布时间:2022-05-24
下一篇:
C# InvokeOperation类代码示例发布时间: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