コード例 #1
0
        void GenerateSessionEndEvent(SessionTimestamp timestamp)
        {
            Task.Run(async() =>
            {
                var baseEvent = _eventSaver.GetWorkstationEvent();

                baseEvent.WorkstationSessionId = timestamp.SessionId;
                baseEvent.UserSession          = timestamp.SessionName;
                baseEvent.Date    = timestamp.Time;
                baseEvent.Note    = "Unexpected Shutdown";
                baseEvent.EventId = WorkstationEventType.ComputerLock; // TODO: Maybe, add another event for Unexpected Shutdown

                await _eventSaver.AddNewAsync(baseEvent, true);
            });
        }
コード例 #2
0
        async Task OnWorkstationUnlock(int sessionId, WorkstationEventType eventType)
        {
            if (eventType != WorkstationEventType.ComputerUnlock &&
                eventType != WorkstationEventType.ComputerLogon)
            {
                return;
            }

            var time = DateTime.UtcNow;

            var procedure = _sessionUnlockMethodMonitor.UnlockProcedure;

            if (procedure != null)
            {
                WriteLine("Wait for unlock procedure");
                await procedure.Run(UNLOCK_EVENT_TIMEOUT);
            }

            WriteLine("Generating unlock event");
            var we = _eventSaver.GetWorkstationEvent();

            we.EventId = eventType;
            we.Note    = SessionSwitchSubject.NonHideez.ToString();
            we.Date    = time;

            if (procedure != null &&
                procedure.FlowUnlockResult != null &&
                procedure.FlowUnlockResult.IsSuccessful)
            {
                we.Note         = _sessionUnlockMethodMonitor.GetUnlockMethod().ToString();
                we.DeviceId     = _bleDeviceManager.Find(procedure.FlowUnlockResult.DeviceMac, 1)?.SerialNo;
                we.AccountLogin = procedure.FlowUnlockResult.AccountLogin;
                we.AccountName  = procedure.FlowUnlockResult.AccountName;
                WriteLine($"Procedure successful ({we.DeviceId}, method: {we.Note})");
            }

            //_unlockProcedure = null;

            await _eventSaver.AddNewAsync(we, true);
        }