using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using Net.Common;
using System.Net;
using System.IO;
using System.Net.Json;
namespace MobilePushCheckAgent
{
public partial class MobilePushCheckAgent : Form
{
bool bStart = false;
System.Windows.Forms.Timer timer;
public MobilePushCheckAgent()
{
InitializeComponent();
cbHour.SelectedIndex = 0;
timer = new System.Windows.Forms.Timer();
}
private void btnExit_Click(object sender, EventArgs e)
{
btnStart.Enabled = false;
btnExit.Enabled = false;
timer.Stop();
Environment.Exit(0);
}
private void btnStart_Click(object sender, EventArgs e)
{
if (!bStart)
{
btnStart.Text = "Stop";
timer.Interval = 5000;
timer.Tick += new EventHandler(SelectQueryProcess); //주기마다 실행되는 이벤트 등록
timer.Start();
//SelectQueryProcess(null,null); //일단 한번 처리 함. 그 뒤로는 timer로 실행됨
}
else
{
btnStart.Enabled = false;
timer.Stop();
btnStart.Text = "Start";
btnStart.Enabled = true;
}
bStart = !bStart;
}
public void SelectQueryProcess(object sender, System.EventArgs e)
{
try
{
}
catch (Exception ex)
{
}
finally
{
}
timer.Interval = 1000 * 60 * 2/*60*/ * Int32.Parse(cbHour.Text); //주기 설정
timer.Stop();
timer.Start();
return ;
}
public void UpdateLog(string sLog)
{
if (this.tbLogBox.InvokeRequired)
{
this.tbLogBox.Invoke((MethodInvoker)delegate
{
// Running on the UI thread
if (this.tbLogBox.Lines.Length > 100) this.tbLogBox.Text = "";
this.tbLogBox.AppendText(DateTime.Now+" ["+ sLog+"]\n");
});
}
else
{
if (this.tbLogBox.Lines.Length > 100) this.tbLogBox.Text = "";
this.tbLogBox.AppendText(DateTime.Now + " [" + sLog + "]\n");
}
}
}
// }
}
'프로그래밍 > C#' 카테고리의 다른 글
C# 소켓 서버 socket server (0) | 2019.03.24 |
---|---|
C# 스레드 thread (0) | 2019.03.24 |
C# 재귀호출 (0) | 2019.03.24 |
C# 정렬 sort (0) | 2019.03.24 |
C# BinarySearchTree 이진탐색트리 (0) | 2019.03.24 |