예제 #1
0
        KeyPress ToCarnacKeyPress(InterceptKeyEventArgs interceptKeyEventArgs)
        {
            var process = GetAssociatedProcess();

            var isLetter = interceptKeyEventArgs.IsLetter();
            var inputs   = ToInputs(isLetter, winKeyPressed, interceptKeyEventArgs).ToArray();

            try
            {
                string      processFileName = process.MainModule.FileName;
                ImageSource image           = IconUtilities.GetProcessIconAsImageSource(processFileName);
                return(new KeyPress(new ProcessInfo(process.ProcessName, image), interceptKeyEventArgs, winKeyPressed, inputs));
            }
            catch (System.Exception)
            {
                return(new KeyPress(new ProcessInfo(process.ProcessName), interceptKeyEventArgs, winKeyPressed, inputs));;
            }
        }