コード例 #1
0
        private void CheckRegValveSteamExePid()
        {
            try
            {
                // Example of using this awesome library
                var activeProcess = SteamPathsUtil.GetActiveProcessSteamData();
                var text          = (activeProcess != null ? activeProcess.PID : 0).ToString();

                checkBoxVavleSteamPID.Checked    = true;
                checkBoxVavleSteamPID.ForeColor  = Color.Green;
                checkBoxVavleSteamPID.CheckState = CheckState.Checked;
                txtBoxVavleSteamPID.Text         = text;

                if (txtBoxVavleSteamPID.Text == @"0")
                {
                    checkBoxVavleSteamPID.ForeColor  = Color.OrangeRed;
                    checkBoxVavleSteamPID.CheckState = CheckState.Indeterminate;
                    toolTip.SetToolTip(checkBoxVavleSteamPID, "Steam installed but not running");
                }
            }
            catch (Exception ex)
            {
                checkBoxVavleSteamPID.Checked     = checkBoxVavleSteamPID.Checked = false;
                checkBoxVavleSteamPID.ForeColor   = checkBoxVavleSteamPID.ForeColor = Color.Red;
                checkBoxVavleSteamPath.CheckState = CheckState.Unchecked;
                txtBoxVavleSteamPID.Text          = @"Not found";
                Console.WriteLine(ex);
            }
        }