Пример #1
0
        static void SetupTrigger(Process process, CustomProfile profile)
        {
            //So we don't keep triggering it....
            if (Trigger.ActiveTriggers.Contains(profile.Triggers))
            {
                return;
            }

            profile.Triggers.ShowProfile(true);
            process.EnableRaisingEvents = true;
            process.Exited += (o, args) =>
            {
                profile.Triggers.StopShowingProfile();
                ActiveProcesses.Remove(profile.Triggers.Process);
            };
        }
Пример #2
0
        static bool CheckProcesses(CustomProfile profile)
        {
            if (ActiveProcesses.Contains(profile.Triggers.Process))
            {
                return(false);
            }

            var openProcesses = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(profile.Triggers.Process));

            if (openProcesses.Length > 0)
            {
                SetupTrigger(openProcesses[0], profile);
                ActiveProcesses.Add(profile.Triggers.Process);
                return(true);
            }

            return(false);
        }