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


C# InvokeOptions类代码示例

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


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


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