示例#1
0
        private async void SyncRemoteAttributesToLocal(DrawingModel drawingModel)
        {
            if (drawingModel.IsProtected != DrawingModel.IsProtected ||
                drawingModel.IsPublic != DrawingModel.IsPublic)
            {
                if (!IsOffline && drawingModel.Owner != AuthService.CurrentUser.Id)
                {
                    if (!drawingModel.IsPublic)
                    {
                        await RemoveSelection();

                        KickedOut?.Invoke();
                    }
                    else if (drawingModel.IsProtected)
                    {
                        await RemoveSelection();

                        PasswordRequested?.Invoke();
                    }
                }
            }

            DrawingModel = drawingModel;
            SizeChanged?.Invoke(DrawingModel.Width, DrawingModel.Height);
            HighlightSelectedStrokes();
        }
        private void OnPasswordRequested(JupyterRequestContext context, PasswordRequested passwordRequested)
        {
            var passReq           = new InputRequest(passwordRequested.Prompt, password: true);
            var clearTextPassword = context.JupyterMessageSender.Send(passReq);

            passwordRequested.Content = new PasswordString(clearTextPassword);
        }
示例#3
0
        protected override Response OnReceive(Message message)
        {
            switch (message)
            {
            case MessageBoxRequestMessage m:
                MessageBoxRequested?.InvokeAsync(new MessageBoxRequestEventArgs {
                    Action = m.Action, Icon = m.Icon, Message = m.Message, RequestId = m.RequestId, Title = m.Title
                });
                return(new SimpleResponse(SimpleResponsePurport.Acknowledged));

            case PasswordRequestMessage m:
                PasswordRequested?.InvokeAsync(new PasswordRequestEventArgs {
                    Purpose = m.Purpose, RequestId = m.RequestId
                });
                return(new SimpleResponse(SimpleResponsePurport.Acknowledged));

            case ReconfigurationDeniedMessage m:
                ReconfigurationDenied?.InvokeAsync(new ReconfigurationEventArgs {
                    ConfigurationPath = m.FilePath
                });
                return(new SimpleResponse(SimpleResponsePurport.Acknowledged));
            }

            return(new SimpleResponse(SimpleResponsePurport.UnknownMessage));
        }
        public static PasswordString password(string prompt = "")
        {
            var context = KernelInvocationContext.Current;

            if (context?.HandlingKernel is KernelBase kernelBase &&
                kernelBase.FrontendEnvironment.AllowStandardInput)
            {
                var passwordReqEvent = new PasswordRequested(prompt, context.Command);
                context.Publish(passwordReqEvent);
                return(passwordReqEvent.Content);
            }

            throw new NotSupportedException("Password request is not supported. The stdin channel is not allowed by the frontend.");
        }
        public static PasswordString password(string prompt = "")
        {
            var context = KernelInvocationContext.Current;

            if (!StandardInputIsAllowed(context))
            {
                throw new NotSupportedException(
                          "Password request is not supported. The stdin channel is not allowed by the frontend.");
            }

            var passwordReqEvent = new PasswordRequested(prompt, context.Command);

            context.Publish(passwordReqEvent);
            return(passwordReqEvent.Content);
        }
示例#6
0
 internal void onPenPasswordRequest(PasswordRequestedEventArgs args)
 {
     PasswordRequested?.Invoke(PenClient, args);
 }