private void notifyIcon1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
System.Reflection.MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
mi.Invoke(notifyIcon1, null);
}
}
var NonValueArray = new Dictionary<string, double>();
for (int i = 0, cnt = c.Count; i < cnt; i++)
{
logger.Trace(c[i].id + " " + c[i].value + " " + c[i].server);
if (Double.IsNaN((c[i].value)))
{
//NonValueArray.Add(c[i].service, c[i].id);
NonValueArray[c[i].service] = c[i].id;
}
}
foreach (var pair in NonValueArray)
{
Console.WriteLine(pair.Key);
}
string sql = @"SELECT ""ID_TagName"",
""F_ComPort"",
""F_ComPortBaudRate"",
""F_ComQuery"",
""F_ParseFunction"",
""F_TagReadTime"",
""F_AnswerLenght"",
""F_AnswerKey"",
""F_AnswerKeyPosition"",
""F_ComPortIPAdress"",
""F_ComPortParity"",
""F_ComPortDataBits"",
""F_ComPortStopBit"",
""F_ComPortFlowControl"",
""F_ComPortTimeOut""
FROM ""SC_Tag"".""T_TagName"" AS tn,
""SC_Tag"".""T_HardWareTag"" AS hw,
""SC_Tag"".""T_RealHardWare"" AS rh
WHERE rh.""ID_RealHardWare"" = hw.""F_RealHardWare_ID""
AND tn.""F_HardWare_ID"" = hw.""F_TagName_ID""
AND ""F_ComPortIPAdress"" = '127.0.0.1'
AND lower(""F_ServerName"") =lower('" + Name + "')";
private void atimer_Elapsed(object sender, EventArgs e)
{
try
{
//logger.Debug(DateTime.Now);
Process proc = null;
string targetDir = string.Format(AppDomain.CurrentDomain.BaseDirectory);//текущая папка AppDomain.CurrentDomain.BaseDirectory
logger.Debug(targetDir);
proc = new Process();
proc.StartInfo.WorkingDirectory = targetDir;
proc.StartInfo.FileName = "restart.bat";
proc.StartInfo.Arguments = string.Format("10");//this is argument
proc.StartInfo.CreateNoWindow = false;
proc.Start();
proc.WaitForExit();
}
catch (Exception msg)
{
logger.Trace(msg);
return;
}
}
net stop "SrvcMOF_Stav";
sc start "SrvcMOF_Stav"