예제 #1
0
LRESULT CDlgDepartureSlotSpec::OnEndDbClickNoEditListItem( WPARAM wparam, LPARAM lparam)
{
	if(!m_pDepSlotSpec)return (0);	
	DepartureSlotItem* pItem = m_pDepSlotSpec->GetItem(m_nRowSel);
	if(!pItem)return (0);

	if(m_nColumnSel == 0)//Flight Type
	{
		if (m_pSelectFlightType == NULL)
			return (0);
		FlightConstraint fltType = (*m_pSelectFlightType)(NULL);
		char szBuffer[1024]={0};
		int xCount = m_wndListCtrl.GetItemCount();
		for(int n = 0;n<xCount;n++)
		{
			if(!m_wndListCtrl.GetItemText(n,0).Compare(szBuffer))
			{
				MessageBox(_T("This Flight Type had existed."));
				return (0);
			}
		}

		pItem->SetFltType(fltType);
		CString strFltType;
		pItem->GetFlightConstraint().screenPrint(strFltType);
		CString strString;		
		strString.Format("%s \t ", strFltType);
		m_wndListCtrl.SetItemText(m_nRowSel,m_nColumnSel,strString);
	}
	else if(m_nColumnSel == 2)//Time Range
	{
		CDlgTimeRange dlg(pItem->GetFromTime(), pItem->GetToTime());
		if(IDOK == dlg.DoModal())
		{
			pItem->SetFromTime(dlg.GetStartTime());
			pItem->SetToTime(dlg.GetEndTime());
			
			ElapsedTime estFromTime;
			estFromTime = pItem->GetFromTime();
			ElapsedTime estToTime;
			estToTime = pItem->GetToTime();
			CString strFromTime;
			strFromTime.Format("Day%d %02d:%02d:%02d", estFromTime.GetDay(), 
				estFromTime.GetHour(),
				estFromTime.GetMinute(),
				estFromTime.GetSecond());
			CString strToTime;
			strToTime.Format("Day%d %02d:%02d:%02d", estToTime.GetDay(), 
				estToTime.GetHour(),
				estToTime.GetMinute(),
				estToTime.GetSecond());
			CString strfromToTime;
			strfromToTime.Format("%s - %s", strFromTime, strToTime);
			m_wndListCtrl.SetItemText(m_nRowSel,m_nColumnSel,strfromToTime);
		}
	}

	return (0);
}
예제 #2
0
void CDlgDepartureSlotSpec::SetListContent()
{
	m_wndListCtrl.DeleteAllItems();
	//get values
	size_t nDepSlotCount = m_pDepSlotSpec->GetElementCount();
	for (size_t i = 0; i< nDepSlotCount; i++)
	{
		DepartureSlotItem* pItem = m_pDepSlotSpec->GetItem(i);

		//flight type
		FlightConstraint fltType = pItem->GetFlightConstraint();
		CString strFltType;
		fltType.screenPrint(strFltType);
		CString strString;		
		strString.Format("%s \t ", strFltType);
		m_wndListCtrl.InsertItem(i, strString);

		//SID
		m_wndListCtrl.SetItemText(i,1,pItem->GetSIDName());

		//Time Range
		ElapsedTime estFromTime;
		estFromTime = pItem->GetFromTime();
		ElapsedTime estToTime;
		estToTime = pItem->GetToTime();
		CString strFromTime;
		strFromTime.Format("Day%d %02d:%02d:%02d", estFromTime.GetDay(), 
			estFromTime.GetHour(),
			estFromTime.GetMinute(),
			estFromTime.GetSecond());
		CString strToTime;
		strToTime.Format("Day%d %02d:%02d:%02d", estToTime.GetDay(), 
			estToTime.GetHour(),
			estToTime.GetMinute(),
			estToTime.GetSecond());
		CString strfromToTime;
		strfromToTime.Format("%s - %s", strFromTime, strToTime);
		m_wndListCtrl.SetItemText(i, 2,strfromToTime);

		//first slot delay distribution
		m_wndListCtrl.SetItemText(i, 3,pItem->GetFirstSlotDelayProDisName());

		//inter slot delay distribution
		m_wndListCtrl.SetItemText(i, 4,pItem->GetInterSlotDelayProDisName());

		m_wndListCtrl.SetItemData(i, (DWORD_PTR)pItem);
	}
	m_wndListCtrl.SetItemState(nDepSlotCount - 1, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
}