static void OnDeleteClicked(WndButton* pWnd){ TCHAR file_name[MAX_PATH]; WndProperty* wp; DataFieldFileReader *dfe; wp = (WndProperty*)wf->FindByName(TEXT("prpFile")); if (!wp) return; wp->OnLButtonDown((POINT){0,0}); dfe = (DataFieldFileReader*) wp->GetDataField(); int file_index = dfe->GetAsInteger(); if (file_index>0) { _stprintf(file_name, TEXT("%s '%s' ?"), MsgToken(1789), dfe->GetAsString()); // Delete task file? if(MessageBoxX(file_name, _T(" "), mbYesNo) == IdNo) { return; } } else { MessageBoxX(MsgToken(1790),_T(" "), mbOk); // No task file to delete return; } if (file_index>0) { lk::filesystem::deleteFile(dfe->GetPathFile()); // Cannot update dfe list, so we force exit. ItemIndex = -1; wf->SetModalResult(mrOK); return; } }
static void OnLoadClicked(WndButton* pWnd){ // 091216 TCHAR file_name[MAX_PATH]; WndProperty* wp; DataFieldFileReader *dfe; wp = (WndProperty*)wf->FindByName(TEXT("prpFile")); if (!wp) return; wp->OnLButtonDown((POINT){0,0}); dfe = (DataFieldFileReader*) wp->GetDataField(); int file_index = dfe->GetAsInteger(); if (file_index>0) { if (ValidTaskPoint(ActiveWayPoint) && ValidTaskPoint(1)) { _stprintf(file_name, TEXT("%s '%s' ?"), gettext(TEXT("_@M891_")), dfe->GetAsString()); // Clear old task and load if(MessageBoxX(file_name, _T(" "), mbYesNo) == IdNo) { return; } } } else { // LKTOKEN _@M467_ = "No Task to load" MessageBoxX(gettext(TEXT("_@M467_")),_T(" "), mbOk); return; } if (file_index>0) { LPCTSTR szFileName = dfe->GetPathFile(); LPCTSTR wextension = _tcsrchr(szFileName, _T('.')); if(wextension) { bool bOK = false; if(_tcsicmp(wextension,_T(LKS_TSK))==0) { CTaskFileHelper helper; bOK = helper.Load(szFileName); } #ifdef OLDTASK_COMPAT else if (_tcsicmp(wextension,_T(LKS_OLD_TSK))==0) { LoadNewTask(szFileName); bOK = true; } #endif else if (_tcsicmp(wextension,_T(LKS_WP_CUP))==0) { bOK = LoadCupTask(szFileName); } else if (_tcsicmp(wextension,_T(LKS_WP_GPX))==0) { bOK = LoadGpxTask(szFileName); } if(!bOK) { MessageBoxX(gettext(TEXT("_@M467_")),_T(" "), mbOk); return; } OverviewRefreshTask(); UpdateFilePointer(); UpdateCaption(); } } }