예제 #1
0
        public async Task <ActionResult> Logout(String returnUrl, CancellationToken cancel)
        {
            var cookie = Request.Cookies[FormsAuthentication.FormsCookieName];

            if (cookie != null && !String.IsNullOrWhiteSpace(cookie.Value))
            {
                var sessionId = FormsAuthentication.Decrypt(cookie.Value).UserData;
                var command   = new EndSessionCommand(cookie.Value);

                await _mediator.ExecuteAsync <EndSessionCommand, EndSessionCommandResult>(command, User.GetAppIdentity(), cancel);

                Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, String.Empty));
                if (Url.IsLocalUrl(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
            }

            return(RedirectToRoute("Default"));
        }
예제 #2
0
        public async Task NewSessionCommandImpl()
        {
            if (Session != null)
            {
                if (Session.IsRunning)
                {
                    bool result =
                        await DialogService.ShowYesOrNoDialogAsync(
                            "There is already an open session.\n\nDo you really want to end the current session?",
                            "End session");

                    if (result)
                    {
                        EndSessionCommand.Execute(null);
                    }
                    else
                    {
                        return;
                    }
                }
            }

            if (WindowService.ShowDialog("SessionSetupWindow").GetValueOrDefault())
            {
                Session = new Session(ConsoleService, SerialPortService, SettingsService, DialogService);

                Session.Started += ConsoleViewModel_SessionStarted;
                Session.Ended   += OnSessionEnded;

                Session.StartSessionCommand.Execute(null);

                IsSessionOpen = true;

                Title = $"{SerialPortService.SerialPort} - Serial Port Utility";
            }
        }