Example #1
0
        public void setup(string name, string trigger_exe, string run_exe, string args, RESTART_POLICY mode)
        {
            config_name.Value = name;
            trigger_name      = System.IO.Path.GetFileNameWithoutExtension(trigger_exe);
            if (binding_process.StartInfo.FileName != "" && binding_process.StartInfo.FileName != run_exe) // already running something
            {
                binding_process.Kill();
            }
            binding_process.StartInfo.FileName        = run_exe;
            binding_process.StartInfo.Arguments       = args;
            binding_process.StartInfo.UseShellExecute = false;
            try
            {
                binding_process.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(run_exe);
            }
            catch (Exception)
            {
                binding_process.StartInfo.WorkingDirectory = "./";
            }
            restarter = mode;

            PC.process_name = trigger_name;
            PC.cb_up        = trigger_up;
            PC.cb_down      = trigger_down;
            if (PC.get_number_of_process() > 0 && is_enable.Value == true)
            {
                start();
            }
            else
            {
                status.Value = "Waiting Trigger Process...";
            }
        }
Example #2
0
        private void set_restart_radio_button(RESTART_POLICY p)
        {
            switch (p)
            {
            case (RESTART_POLICY.NEVER):
                radioButton_never.IsChecked = true;
                break;

            case (RESTART_POLICY.ON_FAILUER):
                radioButton_failure.IsChecked = true;
                break;

            case (RESTART_POLICY.ALWAYS):
                radioButton_always.IsChecked = true;
                break;
            }
        }