Beispiel #1
0
        void DetectSessionState(object obj)
        {
            // Check whether the current session is locked.
            bool isCurrentLocked = session.IsLocked();

            var state = isCurrentLocked
                        ? SessionSwitchReason.SessionLock
                        : SessionSwitchReason.SessionUnlock;

            InformationModel info = new InformationModel();

            string line = string.Format("Current State: {0}    Time: {1}    " +
                                        "User Name: {2}    Domain: {3}    ",
                                        state,
                                        DateTime.Now,
                                        info.UserInfo.LoginName,
                                        info.UserInfo.DomainName
                                        );

            StreamWriter file = new StreamWriter(Path.GetTempPath() + "\\Debugfile.log", true);

            file.WriteLine(line);

            file.Close();
        }
Beispiel #2
0
        public VkmApplicationContext()
        {
            _trayIcon = InitTrayIcon();

            using (WindowsSession session = new WindowsSession())
            {
                while (session.IsLocked())
                {
                    Thread.Sleep(5000);
                }
            }

            _coreContext = new VkmKernel();

            SystemEvents.SessionSwitch += SystemEventsOnSessionSwitch;
            SystemEvents.SessionEnding += SystemEventsOnSessionEnding;
        }