Пример #1
0
        public void AddRowToDataGridUsingEvent(DataGridView grid, UiEvent uiEvent)
        {
            DataGridViewRow row = new DataGridViewRow();

            row.CreateCells(grid);
            row.DefaultCellStyle.Font = new Font("Tahoma", 9);

            BllEvent Event = uiEvent.EventData;

            row.Cells[ColumnIndicies[COL_SENDER]].Value      = Event.Sender.Fullname;
            row.Cells[ColumnIndicies[COL_TITLE]].Value       = Event.Name;
            row.Cells[ColumnIndicies[COL_DATE]].Value        = Event.Date.ToString(DATE_FORMAT);
            row.Cells[ColumnIndicies[COL_TIME]].Value        = Event.Date.ToString(TIME_FORMAT);
            row.Cells[ColumnIndicies[COL_DESCTIPTION]].Value = Event.Description;
            row.Cells[ColumnIndicies[COL_NOTE]].Value        = uiEvent.Note;

            SetStatusInRow(row, Event);
            SetAttributeInRow(row, Event);
            SetFileCountInRow(row, Event);

            uiEvent.SetRowStyle(row);

            grid.Rows.Add(row);

            if (uiEvent.MissedStatus)
            {
                RowStyleManager.MakeCellBoldFont(row.Cells[ColumnIndicies[COL_STATUS]]);
            }
        }
        public void TelemetryStopAnEventWithoutStartingItBeforehand()
        {
            var correlationId = Guid.NewGuid().AsMatsCorrelationId();

            try
            {
                var apiEvent = new ApiEvent(_logger, _crypto, correlationId)
                {
                    Authority = new Uri("https://login.microsoftonline.com"), AuthorityType = "Aad"
                };
                _telemetryManager.StartEvent(apiEvent);
                var uiEvent = new UiEvent(correlationId);
                // Forgot to start this event
                // telemetry.StartEvent(reqId, uiEvent);
                // Now attempting to stop a never-started event
                _telemetryManager.StopEvent(uiEvent); // This line will not cause any exception. The implementation simply ignores it.
                _telemetryManager.StopEvent(apiEvent);
            }
            finally
            {
                _telemetryManager.Flush(correlationId);
                Assert.IsTrue(_telemetryManager.CompletedEvents.IsEmpty && _telemetryManager.EventsInProgress.IsEmpty); // No memory leak here
            }
            Assert.IsNull(_myReceiver.EventsReceived.Find(anEvent =>                                                    // Expect NOT finding such an event
                                                          anEvent[EventBase.EventNameKey].EndsWith("ui_event")));
        }
Пример #3
0
 public static void RaiseUiEvent(string messege, UiEvent uiEvent)
 {
     if (onUiEventCalled != null)
     {
         onUiEventCalled(messege, uiEvent);
     }
 }
 private UiEvent AddStatusToUiEvent(UiEvent Event, BllStatus status)
 {
     Event.EventData.StatusLib.SelectedEntities.Add(new BllSelectedStatus {
         Entity = status
     });
     return(EventHelper.CreateEventAccordingToStatusOrUser(Event, ownerForm.GetCurrentUser()));
 }
Пример #5
0
        public void TelemetryStopAnEventWithoutStartingItBeforehand()
        {
            Telemetry telemetry = new Telemetry()
            {
                ClientId = "a1b2c3d4"
            };                                                                // To isolate the test environment, we do not use a singleton here
            var myReceiver = new MyReceiver();

            telemetry.RegisterReceiver(myReceiver.OnEvents);

            var reqId = telemetry.GenerateNewRequestId();

            try
            {
                var apiEvent = new ApiEvent()
                {
                    Authority = new Uri("https://login.microsoftonline.com"), AuthorityType = "Aad"
                };
                telemetry.StartEvent(reqId, apiEvent);
                var uiEvent = new UiEvent();
                // Forgot to start this event
                //telemetry.StartEvent(reqId, uiEvent);
                // Now attempting to stop a never-started event
                telemetry.StopEvent(reqId, uiEvent); // This line will not cause any exception. The implementation simply ignores it.
                telemetry.StopEvent(reqId, apiEvent);
            }
            finally
            {
                telemetry.Flush(reqId);
                Assert.IsTrue(telemetry.CompletedEvents.IsEmpty && telemetry.EventsInProgress.IsEmpty); // No memory leak here
            }
            Assert.IsNull(myReceiver.EventsReceived.Find(anEvent =>                                     // Expect NOT finding such an event
                                                         anEvent[EventBase.EventNameKey].EndsWith("ui_event")));
        }
        private async Task <Tuple <AuthorizationResult, string> > FetchAuthCodeAndPkceInternalAsync(
            IWebUI webUi,
            CancellationToken cancellationToken)
        {
            RedirectUriHelper.Validate(_requestParams.RedirectUri);

            _requestParams.RedirectUri = webUi.UpdateRedirectUri(_requestParams.RedirectUri);

            Tuple <Uri, string, string> authorizationTuple = CreateAuthorizationUri(true);
            Uri    authorizationUri = authorizationTuple.Item1;
            string state            = authorizationTuple.Item2;
            string codeVerifier     = authorizationTuple.Item3;

            var uiEvent = new UiEvent(_requestParams.RequestContext.CorrelationId.AsMatsCorrelationId());

            using (_requestParams.RequestContext.CreateTelemetryHelper(uiEvent))
            {
                var authorizationResult = await webUi.AcquireAuthorizationAsync(
                    authorizationUri,
                    _requestParams.RedirectUri,
                    _requestParams.RequestContext,
                    cancellationToken).ConfigureAwait(false);

                uiEvent.UserCancelled = authorizationResult.Status == AuthorizationStatus.UserCancel;
                uiEvent.AccessDenied  = authorizationResult.Status == AuthorizationStatus.ProtocolError;

                VerifyAuthorizationResult(authorizationResult, state);

                return(new Tuple <AuthorizationResult, string>(authorizationResult, codeVerifier));
            }
        }
        private void HandleUiEvent(UiEvent uiEvent)
        {
            switch (uiEvent.Info)
            {
            case UiEvent.EventInfo.QuickGame:
                EnterSubstate(OfflineSubstate.QuickConfig);
                break;

            case UiEvent.EventInfo.Campaign:
                EnterSubstate(OfflineSubstate.CampaignConfig);
                break;

            case UiEvent.EventInfo.Back:
                if (_currentSubState == OfflineSubstate.OfflineMenu)
                {
                    EventManager.Instance.Notice(new ChangeStateEvent()
                    {
                        NextState = Enums.States.GameMenu
                    });
                }
                else
                {
                    EnterSubstate(OfflineSubstate.OfflineMenu);
                }
                break;
            }
        }
Пример #8
0
 public void RemoveListener(UiEvent type, Action <UiEvent, BaseUi> callBack)
 {
     if (listeners.ContainsKey(type))
     {
         listeners[type].Remove(callBack);
     }
 }
Пример #9
0
        public void TelemetrySkipEventsIfApiEventWasSuccessful()
        {
            Telemetry telemetry = new Telemetry();  // To isolate the test environment, we do not use a singleton here

            telemetry.TelemetryOnFailureOnly = true;
            var myReceiver = new MyReceiver();

            telemetry.RegisterReceiver(myReceiver.OnEvents);

            var reqId = telemetry.GenerateNewRequestId();

            try
            {
                var e1 = new ApiEvent()
                {
                    Authority = new Uri("https://login.microsoftonline.com"), AuthorityType = "Aad"
                };
                telemetry.StartEvent(reqId, e1);
                // do some stuff...
                e1.WasSuccessful = true;
                telemetry.StopEvent(reqId, e1);

                var e2 = new UiEvent()
                {
                    UserCancelled = false
                };
                telemetry.StartEvent(reqId, e2);
                telemetry.StopEvent(reqId, e2);
            }
            finally
            {
                telemetry.Flush(reqId);
            }
            Assert.AreEqual(0, myReceiver.EventsReceived.Count);

            reqId = telemetry.GenerateNewRequestId();
            try
            {
                var e1 = new ApiEvent()
                {
                    Authority = new Uri("https://login.microsoftonline.com"), AuthorityType = "Aad"
                };
                telemetry.StartEvent(reqId, e1);
                // do some stuff...
                e1.WasSuccessful = false;  // mimic an unsuccessful event, so that this batch should be dispatched
                telemetry.StopEvent(reqId, e1);

                var e2 = new UiEvent()
                {
                    UserCancelled = true
                };
                telemetry.StartEvent(reqId, e2);
                telemetry.StopEvent(reqId, e2);
            }
            finally
            {
                telemetry.Flush(reqId);
            }
            Assert.IsTrue(myReceiver.EventsReceived.Count > 0);
        }
Пример #10
0
        private void Workspace_Changed(Events.Abstract e)
        {
            Changed = true;

            switch (e.type)
            {
            case Blockly.Events.CREATE:
                var cre = (Events.Create)e;
                BlockCreated?.Invoke(this, cre);
                break;

            case Blockly.Events.DELETE:
                var del = (Events.Delete)e;
                BlockDeleted?.Invoke(this, del);
                break;

            case Blockly.Events.CHANGE:
                var chg = (Events.Change)e;
                BlockChanged?.Invoke(this, chg);
                break;

            case Blockly.Events.MOVE:
                var mov = (Events.Move)e;
                BlockMoveed?.Invoke(this, mov);
                break;

            case Blockly.Events.UI:
                var ui = (Events.Ui)e;
                UiEvent?.Invoke(this, ui);
                break;
            }
        }
Пример #11
0
        private void dataGridView1_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
        {
            DisableSendOnEventButton();
            if (e.StateChanged != DataGridViewElementStates.Selected)
            {
                return;
            }
            if (dataGridView1.SelectedRows.Count == 0)
            {
                ClearDataControls();
                return;
            }
            SelectedRowIndex = dataGridView1.SelectedRows[0].Index;
            EnableSendOnEventButton();
            SelectedEvent     = eventManager.GetSelectedEvent(SelectedRowIndex);
            checkBox1.Checked = false;

            if (SelectedEvent.EventState == EventStates.DeletedEvent || SelectedEvent.EventState == EventStates.ClosedEvent)
            {
                EnableDeleteEventButton();
            }
            else
            {
                DisableDeleteEventButton();
            }

            SetSelectedEventToControls();

            PopulateRecievers();
            HandleStatusChanging();
        }
        public void TelemetryStartAnEventWithoutStoppingItLater() // Such event(s) becomes an orphaned event
        {
            var correlationId = Guid.NewGuid().AsMatsCorrelationId();

            try
            {
                var apiEvent = new ApiEvent(_logger, _crypto, correlationId)
                {
                    Authority = new Uri("https://login.microsoftonline.com"), AuthorityType = "Aad"
                };
                _telemetryManager.StartEvent(apiEvent);
                var uiEvent = new UiEvent(correlationId);
                _telemetryManager.StartEvent(uiEvent);
                // Forgot to stop this event. A started event which never got stopped, becomes an orphan.
                // telemetry.StopEvent(reqId, uiEvent);
                _telemetryManager.StopEvent(apiEvent);
            }
            finally
            {
                Assert.IsFalse(_telemetryManager.CompletedEvents.IsEmpty);  // There are completed event(s) inside
                Assert.IsFalse(_telemetryManager.EventsInProgress.IsEmpty); // There is an orphaned event inside
                _telemetryManager.Flush(correlationId);
                Assert.IsTrue(_telemetryManager.CompletedEvents.IsEmpty);   // Completed event(s) have been dispatched
                Assert.IsTrue(_telemetryManager.EventsInProgress.IsEmpty);  // The orphaned event is also dispatched, so there is no memory leak here.
            }
            Assert.IsNotNull(_myReceiver.EventsReceived.Find(anEvent =>     // Expect finding such an event
                                                             anEvent[EventBase.EventNameKey].EndsWith("ui_event") && anEvent[EventBase.ElapsedTimeKey] == "-1"));
        }
Пример #13
0
        protected override void OnMessage(MessageEventArgs e)
        {
            Console.WriteLine("Got command from ui: " + e.Data);

            var command   = JsonConvert.DeserializeObject <TerminalCommand>(e.Data);
            var eventArgs = new UIEventArgs();

            switch (command.Action)
            {
            case "ConfirmTransaction":
                eventArgs.UIEvent = UIEvent.ConfirmTransaction;
                break;

            case "DeclineTransaction":
                eventArgs.UIEvent = UIEvent.DeclineTransaction;
                break;

            case "ConfirmPayment":
                eventArgs.UIEvent = UIEvent.ConfirmPayment;
                break;

            case "DeclinePayment":
                eventArgs.UIEvent = UIEvent.DeclinePayment;
                break;

            case "ConfirmAll":
                eventArgs.UIEvent = UIEvent.ConfirmAll;
                break;

            default:
                break;
            }

            UiEvent?.Invoke(this, eventArgs);
        }
Пример #14
0
 private void AddNewEvent(UiEvent Event)
 {
     Events.Add(Event);
     dataGridManager.AddRowToDataGridUsingEvent(dataGridView, Event);
     ownerForm.indication.IncNewEventsCount();
     SortEventsUsingLastOrderFromCache();
 }
Пример #15
0
        public void TelemetryContainsDefaultEventAsFirstEvent()
        {
            Telemetry telemetry = new Telemetry()
            {
                ClientId = "a1b2c3d4"
            };                                                                // To isolate the test environment, we do not use a singleton here
            var myReceiver = new MyReceiver();

            telemetry.RegisterReceiver(myReceiver.OnEvents);
            var reqId = telemetry.GenerateNewRequestId();

            try
            {
                var anEvent = new UiEvent();
                telemetry.StartEvent(reqId, anEvent);
                telemetry.StopEvent(reqId, anEvent);
            }
            finally
            {
                telemetry.Flush(reqId);
            }
            Assert.IsTrue(myReceiver.EventsReceived[0][EventBase.EventNameKey].EndsWith("default_event"));
            Assert.IsTrue(myReceiver.EventsReceived[1][EventBase.EventNameKey].EndsWith("ui_event"));
            Assert.AreNotEqual(myReceiver.EventsReceived[1][EventBase.ElapsedTimeKey], "-1");
        }
        private void HandleUiEvent(UiEvent uiEvent)
        {
            switch (uiEvent.Info)
            {
            case UiEvent.EventInfo.LaunchGame:
                if (_currentGame.IsHost)
                {
                    GameAccess.Instance.StartGame(_currentGame.Model.HashId);
                    EventManager.Instance.Notice(new StartGameEvent());
                }
                else
                {
                    MessageHelper.ShowMessage("Je suis désolé Dave, je ne crois pas pouvoir faire ça!", "Seul la princesse de place peut ouvrir le bal");
                }
                break;

            case UiEvent.EventInfo.OnlineBoard:
                EnterSubstate(OnlineSubstate.OnlineBoard);
                break;

            case UiEvent.EventInfo.HostGame:
                EnterSubstate(OnlineSubstate.GameCreation);
                break;

            case UiEvent.EventInfo.Back:
                if (_currentSubState == OnlineSubstate.OnlineMenu)
                {
                    EventManager.Instance.Notice(new ChangeStateEvent()
                    {
                        NextState = Enums.States.GameMenu
                    });
                }
                else if (_currentSubState == OnlineSubstate.WaitingRoom)
                {
                    if (_currentGame.IsHost)
                    {
                        EventManager.Instance.Interrupt(new TerminateSessionEvent()
                        {
                            Cause = TerminateSessionEvent.TerminationCause.PrematureQuit
                        });
                    }

                    ExitGame();
                    EnterSubstate(OnlineSubstate.OnlineBoard);
                }
                else
                {
                    EnterSubstate(OnlineSubstate.OnlineMenu);
                }

                break;

            case UiEvent.EventInfo.MatchMaking:
                var context = new MatchMakingViewModel();
                var popup   = new MatchMakingPopup(context);
                popup.ShowDialog();
                break;
            }
        }
Пример #17
0
 public static void OnUiEvent(bool isUi)
 {
     UiEvent handler = OnUi;
     if (handler != null)
     {
         handler(isUi);
     }
 }
Пример #18
0
        public UiEvent GetSelectedEvent(int row)
        {
            SelectedEventNum = row;
            SelectedEvent    = Events[row];
            RemoveMissedStatus();

            return(SelectedEvent);
        }
        private async Task RegisterAccountAsync()
        {
            var uiEvent = new UiEvent();

            using (ServiceBundle.TelemetryManager.CreateTelemetryHelper(
                       AuthenticationRequestParameters.RequestContext.TelemetryRequestId,
                       AuthenticationRequestParameters.ClientId,
                       uiEvent))
            {
                var requestContext = AuthenticationRequestParameters.RequestContext;
                var verifyEmailUri = CreateRegisterAccountUri(_transId, _policy);
                var postData       = new Dictionary <string, string>
                {
                    ["request_type"]    = "RESPONSE",
                    ["email"]           = Email,
                    ["email_ver_input"] = VerificationCode,
                    ["newPassword"]     = Password,
                    ["reenterPassword"] = Password,
                    ["givenName"]       = FirstName,
                    ["surname"]         = LastName
                };
                var response = await _httpManager.SendPostAsync(verifyEmailUri, new Dictionary <string, string> {
                    ["X-CSRF-TOKEN"] = _csrf
                }, postData, requestContext).ConfigureAwait(false);

                if (response != null &&
                    response.StatusCode == HttpStatusCode.OK)
                {
                    var res = JsonHelper.DeserializeFromJson <ResponseStatus>(response.Body);

                    if (res.Status == "200" &&
                        (!res.Result.HasValue ||
                         res.Result == 0))
                    {
                        var confirmedUri = CreateConfirmedUri(_csrf, _transId, _policy);
                        var response2    = await _httpManager.SendGetAsync(confirmedUri, new Dictionary <string, string>(), requestContext).ConfigureAwait(false);

                        if (response2 != null &&
                            (response2.StatusCode == HttpStatusCode.Found ||
                             response2.StatusCode == HttpStatusCode.OK))
                        {
                            AuthorizationResult = new AuthorizationResult(AuthorizationStatus.Success, response2.Headers?.Location);
                        }
                        else
                        {
                            AuthorizationResult = new AuthorizationResult(AuthorizationStatus.ErrorHttp);
                        }
                    }
                    else
                    {
                        AuthorizationResult = new AuthorizationResult(AuthorizationStatus.ErrorHttp);
                    }
                }
                uiEvent.UserCancelled = AuthorizationResult.Status == AuthorizationStatus.UserCancel;
                uiEvent.AccessDenied  = AuthorizationResult.Status == AuthorizationStatus.ProtocolError;
            }
        }
Пример #20
0
        private void HandleSwitchNewEventToRemoved(UiEvent currentEvent, EventStates prevState)
        {
            var currentStatus = EventHelper.GetCurrentEventStatus(currentEvent.EventData);

            if (StatusesForOwner.IsStatusForOwner(currentStatus) && (prevState == EventStates.NewEvent))
            {
                ownerForm.indication.DecNewEventsCount();
            }
        }
Пример #21
0
 protected void ExecuteEvent(UiEvent type)
 {
     if (listeners.ContainsKey(type))
     {
         for (int i = 0; i < listeners[type].Count; i++)
         {
             listeners[type][i](type, this);
         }
     }
 }
Пример #22
0
 private void UiEventHandler(UiEvent evt)
 {
     if (evt.State == BaseUICanvas.CanvasState.close)
     {
         OnUICanvasClose(evt.UiCanvas);
     }
     else if (evt.State == BaseUICanvas.CanvasState.open)
     {
         OnUICanvasOpen(evt.UiCanvas);
     }
 }
Пример #23
0
 public void AddListener(UiEvent type, Action <UiEvent, BaseUi> callBack)
 {
     if (!listeners.ContainsKey(type))
     {
         listeners.Add(type, new List <Action <UiEvent, BaseUi> >());
     }
     if (!listeners[type].Contains(callBack))
     {
         listeners[type].Add(callBack);
     }
 }
Пример #24
0
        public void AdmitEventAsAcquainted()
        {
            IEventCRUD crud = new EventCRUD(client.GetServerInstance().server);

            SelectedEvent.EventData  = crud.UpdateAcceptedUsersAndSendOutEvent(SelectedEvent.EventData, ownerForm.GetCurrentUser());
            SelectedEvent            = new RegularEvent(SelectedEvent);
            Events[SelectedEventNum] = SelectedEvent;
            SelectedEvent.SetRowStyle(dataGridView.Rows[SelectedEventNum]);
            ownerForm.indication.DecNewEventsCount();
            SerializeEvents();
        }
Пример #25
0
 private void HandleMissedStatusIndication(UiEvent Event)
 {
     if (Event.MissedStatus)
     {
         ownerForm.indication.InvokeMissedStatusIndication();
     }
     else
     {
         ownerForm.indication.IncNewStatusesCount();
     }
 }
Пример #26
0
 private void UIManager_onUiEventCalled(string messege, UiEvent uiEvent)
 {
     if (uiEvent == UiEvent.EnableCharacterStat)
     {
         statDisplayer.Init(unitController.allCharacterDictionary[messege]);
     }
     if (uiEvent == UiEvent.DisableCharacterStat)
     {
         statDisplayer.Close();
     }
 }
Пример #27
0
 private void RemoveMissedStatus()
 {
     if (SelectedEvent.MissedStatus)
     {
         ownerForm.indication.DecNewStatusesCount();
         SelectedEvent = new RegularEvent(SelectedEvent);
         SelectedEvent.SetRegularStatus(dataGridView.Rows[SelectedEventNum], dataGridManager.GetStatusColumnNum());
         Events[SelectedEventNum] = SelectedEvent;
         SerializeEvents();
     }
 }
Пример #28
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (checkBox1.Checked)
     {
         ShowChecklist();
         MarkRecieverInLib(SelectedEvent.EventData.RecieverLib);
         eventManager.AdmitEventAsAcquainted();
         SelectedEvent = eventManager.GetSelectedEvent(SelectedRowIndex);
         FillUserChecklist(SelectedEvent.EventData.RecieverLib.SelectedEntities);
         EnableStatusControls();
     }
 }
Пример #29
0
        private void UpdateEventAccordingToCurrentStatus(UiEvent Event, int rowNum)
        {
            dataGridManager.SetStatusInRow(dataGridView.Rows[rowNum], Event.EventData);
            var previousState = Events[rowNum].EventState;

            Events[rowNum] = EventHelper.CreateEventAccordingToStatusOrUser(Event, ownerForm.GetCurrentUser());
            HandleSwitchNewEventToRemoved(Events[rowNum], previousState);
            Events[rowNum].SetRowStyle(dataGridView.Rows[rowNum]);
            HandleMissedStatusIndication(Events[rowNum]);
            Events[rowNum].SetMissedStatus(dataGridView.Rows[rowNum], dataGridManager.GetStatusColumnNum());
            Signal.PlaySignalAccordingToStatusConfigValue();
        }
        private async Task SendEmailVerificationCodeAsync()
        {
            var authorizationUri = CreateAuthorizationUri(true, true);
            var uiEvent          = new UiEvent();

            using (ServiceBundle.TelemetryManager.CreateTelemetryHelper(
                       AuthenticationRequestParameters.RequestContext.TelemetryRequestId,
                       AuthenticationRequestParameters.ClientId,
                       uiEvent))
            {
                var requestContext = AuthenticationRequestParameters.RequestContext;
                var response       = await _httpManager.SendGetAsync(authorizationUri, new Dictionary <string, string>(), requestContext).ConfigureAwait(false);

                if (response != null &&
                    response.StatusCode == HttpStatusCode.OK &&
                    !string.IsNullOrEmpty(response.Body))
                {
                    _csrf       = GetField(response.Body, "csrf");
                    _transId    = GetField(response.Body, "transId");
                    _policy     = GetField(response.Body, "policy"); // B2C_1_password_reset
                    _pageViewId = GetField(response.Body, "pageViewId");
                    var verifyEmailUri = CreateResetPasswordUri(_transId, _policy);
                    var postData       = new Dictionary <string, string>
                    {
                        ["request_type"] = "VERIFICATION_REQUEST",
                        ["claim_id"]     = "email",
                        ["claim_value"]  = Email
                    };
                    var response2 = await _httpManager.SendPostAsync(verifyEmailUri, new Dictionary <string, string> {
                        ["X-CSRF-TOKEN"] = _csrf
                    }, postData, requestContext).ConfigureAwait(false);

                    if (response2 != null &&
                        response2.StatusCode == HttpStatusCode.OK)
                    {
                        AuthorizationResult = new AuthorizationResult(AuthorizationStatus.Success);
                    }
                    else
                    {
                        AuthorizationResult = new AuthorizationResult(AuthorizationStatus.ErrorHttp);
                    }
                }
                else
                {
                    AuthorizationResult = new AuthorizationResult(AuthorizationStatus.ErrorHttp);
                }
                uiEvent.UserCancelled = AuthorizationResult.Status == AuthorizationStatus.UserCancel;
                uiEvent.AccessDenied  = AuthorizationResult.Status == AuthorizationStatus.ProtocolError;
            }
        }