Ejemplo n.º 1
0
 /// <summary>
 /// Solicitar condiciones de operacion con Timer
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void RequestConds(object sender, ElapsedEventArgs e)
 {
     try
     {
         var result = Server.Condiciones();
     }
     catch (Exception ex)
     {
         if (ModeMessage == Modo.defaults)
         {
             throw new Exception(ex.Message);
         }
         else
         {
             throw;// WriteEventLogEntry(System.Diagnostics.EventLogEntryType.Error, 3, ex.Message, ModeMessage);
         }
     }
 }
Ejemplo n.º 2
0
        private void Monitor(object sender, ElapsedEventArgs e)
        {
            try{
                LProcess = Process.GetProcessesByName(NameProcess);
                if (ElapsedCond > 10)
                {
                    Server.Condiciones();

                    ElapsedCond++;
                }
                if (LProcess.Count() == 0)
                {
                    //ProcessStartInfo processStartInfo = new ProcessStartInfo("C:\\Program Files (x86)\\Campos Inteligentes\\Configurador\\MonitorWin.exe");
                    //////processStartInfo.CreateNoWindow = false;
                    //processStartInfo.WindowStyle = ProcessWindowStyle.Minimized;
                    //processStartInfo.LoadUserProfile = true;
                    //processStartInfo.UseShellExecute = false;
                    ////processStartInfo.RedirectStandardError = true;
                    ////processStartInfo.RedirectStandardInput = true;
                    ////processStartInfo.RedirectStandardOutput = true;
                    ////processStartInfo.CreateNoWindow = false;
                    ////processStartInfo.ErrorDialog = false;
                    //processStartInfo.Verb = "runas /user:admin";

                    //Process.Start(processStartInfo);
                    OpenMonitorWin();
                }


                ElapsedCond++;
            }
            catch (Exception ex) {
                WriteEventLogEntry(EventLogEntryType.Error, 30, ex.Message);
            }


            //MMonitor.RequestConds();
        }