a
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
// DialLoopTaskQuery.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GeoMative.h"
|
||||
#include "DialLoopTaskQuery.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
extern CGeoMativeApp theApp;
|
||||
extern int g_UIOffset;
|
||||
extern int g_iUILanguage;
|
||||
extern CString Tm2LocalStr(time_t t);
|
||||
// DialLoopTaskQuery 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(DialLoopTaskQuery, CDialog)
|
||||
|
||||
DialLoopTaskQuery::DialLoopTaskQuery(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(DialLoopTaskQuery::IDD, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DialLoopTaskQuery::~DialLoopTaskQuery()
|
||||
{
|
||||
m_LoopTablelist.RemoveAll();
|
||||
}
|
||||
|
||||
void DialLoopTaskQuery::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_STATIC_LOOP_Q_NUM, m_StaticLoopNum);
|
||||
DDX_Control(pDX, IDC_LIST_QUERY, m_ListLoopDisplay);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(DialLoopTaskQuery, CDialog)
|
||||
ON_BN_CLICKED(IDOK_QUERY_SUB_LOOP, &DialLoopTaskQuery::OnBnClickedQuerySubLoop)
|
||||
ON_BN_CLICKED(IDCANCEL, &DialLoopTaskQuery::OnBnClickedCancel)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// DialLoopTaskQuery 消息处理程序
|
||||
|
||||
|
||||
void DialLoopTaskQuery::OnBnClickedQuerySubLoop()
|
||||
{
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
CString szListStr;
|
||||
m_szArrayLoopTaskID.RemoveAll();
|
||||
|
||||
POSITION pos = m_ListLoopDisplay.GetFirstSelectedItemPosition();
|
||||
if (pos == NULL)
|
||||
{
|
||||
if (LANG_ZHCN == g_iUILanguage)
|
||||
AfxMessageBox(_T("请先选择一个任务"));
|
||||
else
|
||||
MessageBoxEx(NULL, _T("Please choose one task first."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||||
return;
|
||||
}
|
||||
theApp.m_NetWorkOper.SetSuspendForThread(true);
|
||||
while (pos)
|
||||
{
|
||||
int nItem = m_ListLoopDisplay.GetNextSelectedItem(pos);
|
||||
szListStr.Empty();
|
||||
szListStr = m_ListLoopDisplay.GetItemText(nItem, 1);
|
||||
|
||||
m_szArrayLoopTaskID.Add(szListStr);
|
||||
}
|
||||
SendMessage(WM_CLOSE, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
void DialLoopTaskQuery::OnBnClickedCancel()
|
||||
{
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
m_LoopTablelist.RemoveAll();
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
|
||||
BOOL DialLoopTaskQuery::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: 在此添加额外的初始化
|
||||
CString strColTitle;
|
||||
int iColIndex = (int)VAL_ZERO;
|
||||
|
||||
m_ListLoopDisplay.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_ONECLICKACTIVATE | LVS_EX_GRIDLINES);
|
||||
m_StaticLoopNum.SetWindowTextA(_T("0"));
|
||||
|
||||
strColTitle.Empty();
|
||||
strColTitle.LoadString(IDS_DB_TD_TDNAME + g_UIOffset);
|
||||
m_ListLoopDisplay.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 110);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
if (LANG_ZHCN == g_iUILanguage) { strColTitle += _T("任务ID"); }
|
||||
else{ strColTitle += _T("Task ID"); }
|
||||
m_ListLoopDisplay.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 250);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
if (LANG_ZHCN == g_iUILanguage) { strColTitle += _T("任务类型"); }
|
||||
else{ strColTitle += _T("Task type"); }
|
||||
m_ListLoopDisplay.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 80);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
if (LANG_ZHCN == g_iUILanguage) { strColTitle += _T("开始时间"); }
|
||||
else{ strColTitle += _T("Start time"); }
|
||||
m_ListLoopDisplay.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150);
|
||||
|
||||
iColIndex++;
|
||||
strColTitle.Empty();
|
||||
if (LANG_ZHCN == g_iUILanguage) { strColTitle += _T("结束时间"); }
|
||||
else{ strColTitle += _T("End time"); }
|
||||
m_ListLoopDisplay.InsertColumn(iColIndex, strColTitle, LVCFMT_LEFT, 150);
|
||||
|
||||
int iIndex = 0;
|
||||
CString szStr;
|
||||
if (0 < m_LoopTablelist.GetCount() && 0 == m_LoopTablelist.IsEmpty())
|
||||
{
|
||||
POSITION pos = m_LoopTablelist.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
STLoopTaskTable taskTable = m_LoopTablelist.GetNext(pos);
|
||||
m_ListLoopDisplay.InsertItem(iIndex, _T(""));
|
||||
m_ListLoopDisplay.SetItemText(iIndex, 0, (LPCTSTR)(_bstr_t)taskTable.ucTaskName);
|
||||
m_ListLoopDisplay.SetItemText(iIndex, 1, (LPCTSTR)(_bstr_t)taskTable.ucTaskID);
|
||||
m_ListLoopDisplay.SetItemText(iIndex, 2, (LPCTSTR)(_bstr_t)taskTable.ucLoopType);
|
||||
szStr.Empty(); szStr = Tm2LocalStr(taskTable.uiStartTime); //szTime.Format("%u",taskTable.uiStartTime);
|
||||
m_ListLoopDisplay.SetItemText(iIndex, 3, (LPCTSTR)(_bstr_t)szStr);
|
||||
szStr.Empty(); szStr = Tm2LocalStr(taskTable.uiEndTime); //szTime.Format("%u",taskTable.uiEndTime);
|
||||
m_ListLoopDisplay.SetItemText(iIndex, 4, (LPCTSTR)(_bstr_t)szStr);
|
||||
iIndex++;
|
||||
}
|
||||
}
|
||||
CString szTaskNum; szTaskNum.Format(_T("%u"), iIndex);
|
||||
m_StaticLoopNum.SetWindowTextA(_T(szTaskNum));
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// 异常: OCX 属性页应返回 FALSE
|
||||
}
|
||||
Reference in New Issue
Block a user