static bool LoggerDeclare(PDeviceDescriptor_t dev, Declaration_t *decl) { if (!devIsLogger(dev)) return FALSE; // If a Flarm is reset while we are here, then it will come up with isFlarm set to false, // and task declaration will fail. The solution is to let devices have a flag for "HaveFlarm". LKDoNotResetComms=true; // LKTOKEN _@M221_ = "Declare Task?" if (MessageBoxX(hWndMapWindow, gettext(TEXT("_@M221_")), dev->Name, MB_YESNO| MB_ICONQUESTION) == IDYES) { const unsigned ERROR_BUFFER_LEN = 64; TCHAR errorBuffer[ERROR_BUFFER_LEN] = { '\0' }; if (devDeclare(dev, decl, ERROR_BUFFER_LEN, errorBuffer)) { // LKTOKEN _@M686_ = "Task Declared!" MessageBoxX(hWndMapWindow, gettext(TEXT("_@M686_")), dev->Name, MB_OK| MB_ICONINFORMATION); DeclaredToDevice = true; } else { TCHAR buffer[2*ERROR_BUFFER_LEN]; if(errorBuffer[0] == '\0') { // LKTOKEN _@M1410_ = "Unknown error" _sntprintf(errorBuffer, ERROR_BUFFER_LEN, gettext(_T("_@M1410_"))); } else { // do it just to be sure errorBuffer[ERROR_BUFFER_LEN - 1] = '\0'; } // LKTOKEN _@M265_ = "Error! Task NOT declared!" _sntprintf(buffer, 2*ERROR_BUFFER_LEN, _T("%s\n%s"), gettext(_T("_@M265_")), errorBuffer); MessageBoxX(hWndMapWindow, buffer, dev->Name, MB_OK| MB_ICONERROR); DeclaredToDevice = false; } } LKDoNotResetComms=false; return TRUE; }
bool LoggerImpl::LoggerDeclare(PDeviceDescriptor_t dev, Declaration_t *decl) { if (!devIsLogger(dev)) return FALSE; if (MessageBoxX(gettext(TEXT("Declare Task?")), dev->Name, MB_YESNO| MB_ICONQUESTION) == IDYES) { if (devDeclare(dev, decl)) { MessageBoxX(gettext(TEXT("Task Declared!")), dev->Name, MB_OK| MB_ICONINFORMATION); DeclaredToDevice = true; } else { MessageBoxX(gettext(TEXT("Error occured,\r\nTask NOT Declared!")), dev->Name, MB_OK| MB_ICONERROR); DeclaredToDevice = false; } } return TRUE; }
static bool DeviceDeclare(DeviceDescriptor *dev, const Declaration &decl) { if (!devIsLogger(*dev)) return false; if (MessageBoxX(_("Declare Task?"), dev->GetName(), MB_YESNO| MB_ICONQUESTION) == IDYES) { if (devDeclare(*dev, &decl)) { MessageBoxX(_("Task Declared!"), dev->GetName(), MB_OK| MB_ICONINFORMATION); DeclaredToDevice = true; } else { MessageBoxX(_("Error occured,\nTask NOT Declared!"), dev->GetName(), MB_OK| MB_ICONERROR); } } return true; }