/// <summary>
 /// 按钮“停止服务”按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsmiStopService_Click(object sender, EventArgs e)
 {
     try
     {
         selfHost.Close();
         ShowMsgControlText("服务停止。");
         SaveTextLog.WriteOperateLog("服务停止。");
     }
     catch (Exception ex)
     {
         ShowMsgControlText(ex.Message);
         selfHost.Abort();
         SaveTextLog.WriteErrorLog(ex.ToString());
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 保存增量文件夹的设置
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         ToolClass.UpdateAppConfig("five", txtFivePath.Text); //更新five增量文件路径
         ToolClass.UpdateAppConfig("day", txtDayPath.Text);   //更新day增量文件路径
         ToolClass.UpdateAppConfig("ddx", txtDDXPath.Text);   //更新ddx增量文件路径
         ToolClass.ShowHintMsgBox("保存增量文件夹设置成功。");
         ReadPath();
     }
     catch (Exception ex)
     {
         ToolClass.ShowErrorMsgBox(ex.Message);
         SaveTextLog.WriteErrorLog(ex.ToString());
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 读取配置文件中的appSettings节点中的路径配置
 /// </summary>
 private void ReadPath()
 {
     try
     {
         string dayPath  = ToolClass.GetAppConfig("day");
         string fivePath = ToolClass.GetAppConfig("five");
         string ddxPath  = ToolClass.GetAppConfig("ddx");
         string hintMsg  = "";
         if (string.IsNullOrEmpty(dayPath))
         {
             hintMsg += "请在配置文件中添加一个day节点,值为增量文件的路径。\r\n";
         }
         else
         {
             txtDayPath.Text = dayPath;
         }
         if (string.IsNullOrEmpty(fivePath))
         {
             hintMsg += "请在配置文件中添加一个five节点,值为增量文件的路径。\r\n";
         }
         else
         {
             txtFivePath.Text = fivePath;
         }
         if (string.IsNullOrEmpty(ddxPath))
         {
             hintMsg += "请在配置文件中添加一个ddx节点,值为增量文件的路径。";
         }
         else
         {
             txtDDXPath.Text = ddxPath;
         }
         if (!string.IsNullOrEmpty(hintMsg))
         {
             ToolClass.ShowHintMsgBox(hintMsg);
         }
     }
     catch (Exception ex)
     {
         ToolClass.ShowErrorMsgBox("读取配置文件失败。" + ex.Message);
         SaveTextLog.WriteErrorLog(ex.ToString());
     }
 }
 /// <summary>
 /// 在消息框中显示day、five和ddx增量文件的路径
 /// </summary>
 public void ShowPath()
 {
     try
     {
         string dayPath  = ToolClass.GetAppConfig("day");
         string fivePath = ToolClass.GetAppConfig("five");
         string ddxPath  = ToolClass.GetAppConfig("ddx");
         if (string.IsNullOrEmpty(dayPath))
         {
             ShowMsgControlText("请在配置文件中添加一个day节点,值为增量文件的路径。");
         }
         else
         {
             ShowMsgControlText("日线指标增量文件的路径:" + dayPath);
         }
         if (string.IsNullOrEmpty(fivePath))
         {
             ShowMsgControlText("请在配置文件中添加一个five节点,值为增量文件的路径。");
         }
         else
         {
             ShowMsgControlText("五分线指标增量文件的路径:" + ToolClass.GetAppConfig("five"));
         }
         if (string.IsNullOrEmpty(ddxPath))
         {
             ShowMsgControlText("请在配置文件中添加一个ddx节点,值为增量文件的路径。");
         }
         else
         {
             ShowMsgControlText("ddx增量文件的路径:" + ToolClass.GetAppConfig("ddx"));
         }
     }
     catch (Exception ex)
     {
         ShowMsgControlText(ex.Message);
         SaveTextLog.WriteErrorLog(ex.ToString());
     }
 }
 /// <summary>
 /// 按钮“启动服务”按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsmiStartService_Click(object sender, EventArgs e)
 {
     try
     {
         if (selfHost.State == CommunicationState.Created)
         {
             selfHost.Open();
         }
         else
         {
             selfHost = new ServiceHost(typeof(DataRcvService));
             selfHost.Open();
         }
         ShowMsgControlText("服务启动成功。");
         SaveTextLog.WriteOperateLog("服务启动成功。");
     }
     catch (Exception ex)
     {
         ShowMsgControlText(ex.Message);
         selfHost.Abort();
         SaveTextLog.WriteErrorLog(ex.ToString());
     }
 }