Exemplo n.º 1
0
        private void PrintPythonOutput(Process myProcess)
        {
            // Read the standard output of the app we called.
            StreamReader myStreamReader = myProcess.StandardOutput;

            string myString;

            int user = 0, notUser = 0;

            while ((myString = myStreamReader.ReadLine()) != null)
            {
                Console.WriteLine(myString);
                if (myString.Contains("1"))
                {
                    user++;
                }
                if (myString.Contains("0"))
                {
                    notUser++;
                }

                if (myString.Contains("ModuleNotFoundError"))
                {
                    ShowErrorWindow();
                    break;
                }
            }


            if (health != null)
            {
                int changeInHealth = (user - notUser);
                Console.WriteLine(changeInHealth);
                health.SetValue(health.GetValue() + changeInHealth);
                Console.WriteLine($"User pressed {user} times.");
                Console.WriteLine($"Not user pressed {notUser} times.");
            }
        }
Exemplo n.º 2
0
 public void UpdateView()
 {
     graph.PushValue(healthSubject.GetValue());
 }