123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053 |
- #pragma once
- #include "stdafx.h"
- #include "GeocacheDisplay.h"
- #include "antmessage.h"
- using namespace System::Runtime::InteropServices;
- static ULONG ulMessageCount = 0;
- static BOOL bFoundGeocache;
- static BOOL bAllPagesRecvd;
- static BOOL bProgramming;
- static BOOL bSendAuthReq;
- static BOOL bUpdateLoggedVisit;
- static UCHAR ucNumPagesRecvd;
- static time_t tmtEpoch;
- static struct tm tmEpoch;
- void GeocacheDisplay::InitializeSim()
- {
- ulTimerInterval = 250;
- dbDispAcumTime = 0;
- dbDispAcumDist = 0;
- usLastEventTime = 0;
- ulTotalTime = 0;
- bFoundGeocache = FALSE;
- bAllPagesRecvd = FALSE;
- GeocacheData->InitDisplay();
- this->buttonProgram->Enabled = FALSE;
- this->buttonErase->Enabled = FALSE;
- ulMessageCount = 0;
- ucNumPagesRecvd = 0;
- GeocacheData->ucTotalPages = 0;
- GeocacheData->ucCurrProgPage = 0;
- GeocacheData->ucProgTotalPages = 0;
- GeocacheData->InitDisplay();
- UpdateDisplay();
- commonData->eTimeResolution = CommonData::TimeResolution::TWO;
- commonData->ulOpTime = ulTotalTime;
- tmEpoch.tm_year = 1989 - 1900;
- tmEpoch.tm_mon = 12 - 1;
- tmEpoch.tm_mday = 31;
- tmEpoch.tm_hour = 00;
- tmEpoch.tm_min = 00;
- tmEpoch.tm_sec = 00;
- tmtEpoch = mktime(&tmEpoch);
- }
- void GeocacheDisplay::ANT_eventNotification(UCHAR ucEventCode_, UCHAR* pucEventBuffer_)
- {
- switch(ucEventCode_)
- {
- case EVENT_TX:
- break;
- case EVENT_RX_BROADCAST:
- case EVENT_RX_ACKNOWLEDGED:
- case EVENT_RX_BURST_PACKET:
- HandleReceive((UCHAR*) pucEventBuffer_);
- break;
- case EVENT_TRANSFER_TX_COMPLETED:
- UpdateAckStatus((UCHAR*) pucEventBuffer_);
- break;
- case EVENT_ACK_TIMEOUT:
- case EVENT_TRANSFER_TX_FAILED:
- UpdateDisplayAckStatus(GeocacheData->ACK_FAIL);
- break;
- case MESG_CLOSE_CHANNEL_ID:
- InitializeSim();
- break;
- default:
- break;
- }
- }
- void GeocacheDisplay::HandleReceive(UCHAR* pucRxBuffer_)
- {
- ulMessageCount++;
-
-
- if (!bProgramming)
- {
- UCHAR ucPage = pucRxBuffer_[0];
-
- if (ucPage <= commonData->PAGE82)
- GeocacheData->bPageRead[ucPage] = TRUE;
-
- if (ucPage < commonData->START_COMMON_PAGE)
- GeocacheData->Decode(pucRxBuffer_);
- else
- commonData->Decode(pucRxBuffer_);
- UpdateDisplay();
-
- if (!bFoundGeocache)
- {
- pucRxBuffer_[0] = 0x46;
- pucRxBuffer_[1] = 0xFF;
- pucRxBuffer_[2] = 0xFF;
- pucRxBuffer_[3] = 0xFF;
- pucRxBuffer_[4] = 0xFF;
- pucRxBuffer_[5] = 0x01;
- pucRxBuffer_[6] = 0x01;
- pucRxBuffer_[7] = 0x01;
- requestBcastMsg(pucRxBuffer_);
- bFoundGeocache = TRUE;
- }
-
- else if (!bAllPagesRecvd && (ulMessageCount > GeocacheData->MESG_WAIT_REQ))
- {
- pucRxBuffer_[0] = 0x46;
- pucRxBuffer_[1] = 0xFF;
- pucRxBuffer_[2] = 0xFF;
- pucRxBuffer_[3] = 0xFF;
- pucRxBuffer_[4] = 0xFF;
- pucRxBuffer_[5] = 0x01;
- pucRxBuffer_[6] = NextUnReadPage();
- pucRxBuffer_[7] = 0x01;
- requestBcastMsg(pucRxBuffer_);
- }
- else if (bSendAuthReq)
- {
- GeocacheData->GenerateAuthRequestPage(pucRxBuffer_);
- requestAckMsg(pucRxBuffer_);
- bSendAuthReq = FALSE;
- if (GeocacheData->bLoggedVisitsEnabled) bUpdateLoggedVisit = TRUE;
- }
- else if (bUpdateLoggedVisit)
- {
- UpdateLoggedVisit();
- GeocacheData->UpdateLoggedVisitPage();
- GeocacheData->GetPageData(GeocacheData->ucLoggedVisitPage, pucRxBuffer_);
- requestAckMsg(pucRxBuffer_);
- bUpdateLoggedVisit = FALSE;
- }
- }
- else
- {
-
- GeocacheData->GetPageData(GeocacheData->ucCurrProgPage, pucRxBuffer_);
- requestAckMsg(pucRxBuffer_);
- UpdateDisplay();
- }
- }
- void GeocacheDisplay::UpdateAckStatus(UCHAR* pucRxBuffer_)
- {
- if (bProgramming)
- {
-
- if (pucRxBuffer_[0] < GeocacheData->PAGE_32)
- GeocacheData->bPageProg[pucRxBuffer_[0]] = TRUE;
- if (GeocacheData->ucCurrProgPage >= GeocacheData->ucProgTotalPages)
- {
- bProgramming = FALSE;
- this->labelProgStatus->Text = "Done Programming ...";
- this->labelProgStatus->ForeColor = System::Drawing::Color::Black;
- }
- else
- {
- GeocacheData->ucCurrProgPage++;
- }
- }
- }
- void GeocacheDisplay::UpdateDisplayAckStatus(UCHAR status_)
- {
-
- }
- using namespace System::Security::Cryptography;
- void GeocacheDisplay::Authentication(UCHAR* pucRxBuffer_)
- {
- GeocacheData->GenerateAuthRequestPage(pucRxBuffer_);
- requestBcastMsg(pucRxBuffer_);
- }
- void GeocacheDisplay::HandleTransmit(UCHAR* pucTxBuffer_)
- {
- }
- UCHAR GeocacheDisplay::NextUnReadPage(void)
- {
- ucNumPagesRecvd = 0;
-
- for (UCHAR ucPage=0; ucPage<GeocacheData->ucTotalPages; ucPage++)
- {
- if (!GeocacheData->bPageRead[ucPage])
- return (ucPage);
- else
- ucNumPagesRecvd++;
- }
-
- if (!GeocacheData->bPageRead[commonData->PAGE80]) return (commonData->PAGE80);
- if (!GeocacheData->bPageRead[commonData->PAGE81]) return (commonData->PAGE81);
- if (!GeocacheData->bPageRead[commonData->PAGE82]) return (commonData->PAGE82);
- bAllPagesRecvd = TRUE;
- bSendAuthReq = TRUE;
- this->buttonProgram->Enabled = TRUE;
- this->buttonErase->Enabled = TRUE;
- return (0);
- }
- void GeocacheDisplay::UpdateLoggedVisit(void)
- {
- time_t tmtNow;
-
- time(&tmtNow);
- GeocacheData->ulLastVisitTimestamp = (ULONG) difftime(tmtNow, tmtEpoch);
- GeocacheData->usNumVisits++;
- }
- void GeocacheDisplay::buttonForget_Click(System::Object^ sender, System::EventArgs^ e)
- {
- bFoundGeocache = FALSE;
- bAllPagesRecvd = FALSE;
- this->buttonProgram->Enabled = FALSE;
- this->buttonErase->Enabled = FALSE;
- ulMessageCount = 0;
- ucNumPagesRecvd = 0;
- GeocacheData->ucTotalPages = 0;
- GeocacheData->ucCurrProgPage = 0;
- GeocacheData->ucProgTotalPages = 0;
- GeocacheData->InitDisplay();
- UpdateDisplay();
- }
- void GeocacheDisplay::buttonErase_Click(System::Object^ sender, System::EventArgs^ e)
- {
- ucNumPagesRecvd = 0;
- GeocacheData->InitDisplay();
- GeocacheData->GenerateProgPages();
- GeocacheData->ucProgTotalPages = 32;
- GeocacheData->ucCurrProgPage = GeocacheData->PAGE_0;
- bProgramming = TRUE;
- UpdateDisplay();
- }
- void GeocacheDisplay::buttonProgram_Click(System::Object^ sender, System::EventArgs^ e)
- {
-
- if (GeocacheData->ulPIN == GeocacheData->DEFAULT_PIN)
- {
- bProgramming = TRUE;
- this->labelProgStatus->Text = "Programming...";
- this->labelProgStatus->ForeColor = System::Drawing::Color::Green;
- }
- else if ((this->textBoxPIN->Text->Length > 0) && (System::Convert::ToInt32(this->textBoxPIN->Text) == GeocacheData->ulPIN))
- {
- bProgramming = TRUE;
- this->labelProgStatus->Text = "Programming ...";
- this->labelProgStatus->ForeColor = System::Drawing::Color::Green;
- }
- else
- {
- bProgramming = FALSE;
- this->labelProgStatus->Text = "Incorrect PIN";
- this->labelProgStatus->ForeColor = System::Drawing::Color::Red;
- return;
- }
- GeocacheData->bLatitudeEnabled = FALSE;
- GeocacheData->bLongitudeEnabled = FALSE;
- GeocacheData->bHintEnabled = FALSE;
- GeocacheData->bLoggedVisitsEnabled = FALSE;
-
- if (this->checkBoxID->Checked)
- {
- char* stringPointer = (char*) Marshal::StringToHGlobalAnsi(this->textBoxID->Text->ToUpper()).ToPointer();
- for (int i=0; i<this->textBoxID->Text->Length; i++)
- GeocacheData->cID[i] = stringPointer[i] - 0x20;
- for (int i=this->textBoxID->Text->Length; i<9; i++)
- GeocacheData->cID[i] = 0x00;
-
- Marshal::FreeHGlobal(IntPtr(stringPointer));
- }
-
- if (this->checkBoxPIN->Checked)
- {
- GeocacheData->ulPIN = System::Convert::ToUInt32(this->textBoxPIN->Text);
- }
- if (this->checkBoxLatitude->Checked)
- {
- GeocacheData->bLatitudeEnabled = TRUE;
- GeocacheData->slLatitude_SC = System::Convert::ToInt32(double (this->numericUpDownLatitude->Value) * GeocacheData->SEMI_CIRCLE_CONVERSION);
- }
- if (this->checkBoxLongitude->Checked)
- {
- GeocacheData->bLongitudeEnabled = TRUE;
- GeocacheData->slLongitude_SC = System::Convert::ToInt32(double (this->numericUpDownLongitude->Value) * GeocacheData->SEMI_CIRCLE_CONVERSION);
- }
- if (this->checkBoxLoggedVisits->Checked)
- {
- time_t tmtLastVisit;
- struct tm tmLastVisit;
- tmLastVisit.tm_year = System::Convert::ToUInt16(this->numericUpDownYear->Value) - 1900;
- tmLastVisit.tm_mon = System::Convert::ToUInt16(this->numericUpDownMonth->Value) - 1;
- tmLastVisit.tm_mday = System::Convert::ToUInt16(this->numericUpDownDay->Value);
- tmLastVisit.tm_hour = System::Convert::ToUInt16(this->numericUpDownHours->Value);
- tmLastVisit.tm_min = System::Convert::ToUInt16(this->numericUpDownMinutes->Value);
- tmLastVisit.tm_sec = System::Convert::ToUInt16(this->numericUpDownSeconds->Value);
- tmtLastVisit = mktime(&tmLastVisit);
- if (tmLastVisit.tm_isdst > 0)
- GeocacheData->ulLastVisitTimestamp = (ULONG) difftime(tmtLastVisit, tmtEpoch) - 3600;
- else
- GeocacheData->ulLastVisitTimestamp = (ULONG) difftime(tmtLastVisit, tmtEpoch);
- GeocacheData->bLoggedVisitsEnabled = TRUE;
- GeocacheData->usNumVisits = System::Convert::ToUInt16(this->numericUpDownNumVisits->Value);
- }
- if (this->checkBoxHint->Checked)
- {
- char* stringPointer = (char*) Marshal::StringToHGlobalAnsi(this->textBoxHint->Text).ToPointer();
- for (int i=0; i<this->textBoxHint->Text->Length; i++)
- GeocacheData->cHint[i] = stringPointer[i];
- GeocacheData->ucNumHintPages = (this->textBoxHint->Text->Length/GeocacheData->HINT_CHARS_PER_PAGE) + 1;
- GeocacheData->bHintEnabled = TRUE;
- }
- UCHAR ucPriorTotalPages = GeocacheData->ucTotalPages;
- GeocacheData->GenerateProgPages();
- GeocacheData->ucProgTotalPages = (ucPriorTotalPages > GeocacheData->ucTotalPages) ? ucPriorTotalPages : GeocacheData->ucTotalPages;
- GeocacheData->ucCurrProgPage = GeocacheData->PAGE_0;
- }
- void GeocacheDisplay::UpdateDisplay()
- {
-
- System::Text::StringBuilder^ builder = gcnew System::Text::StringBuilder();
- for(int i=0; i<GeocacheData->cID->Length; i++) builder->Append((Char)(GeocacheData->cID[i]+0x20));
- this->labelGCdID->Text = builder->ToString();
- if (this->tabControl1->SelectedIndex != 3)
- {
- this->textBoxID->Text = builder->ToString();
- this->labelID->Text = builder->ToString();
- }
-
- this->labelPIN->Text = GeocacheData->ulPIN.ToString();
- this->labelGCdPIN->Text = GeocacheData->ulPIN.ToString();
- if (this->tabControl1->SelectedIndex != 3)
- this->textBoxPIN->Text = GeocacheData->ulPIN.ToString();
-
- this->labelGCdTotNumPages->Text = GeocacheData->ucTotalPages.ToString();
- this->labelGCdPagesRecvd->Text = ucNumPagesRecvd.ToString();
-
- this->labelProgTotalPages->Text = GeocacheData->ucProgTotalPages.ToString();
- this->labelCurrProgPage->Text = GeocacheData->ucCurrProgPage.ToString();
-
- if (GeocacheData->bLatitudeEnabled)
- {
- this->labelLat->Text = ((double)GeocacheData->slLatitude_SC / GeocacheData->SEMI_CIRCLE_CONVERSION).ToString("N2");
- this->labelGCdLat->Text = ((double)GeocacheData->slLatitude_SC / GeocacheData->SEMI_CIRCLE_CONVERSION).ToString("N2");
- if (this->tabControl1->SelectedIndex != 3)
- this->numericUpDownLatitude->Text = ((double)GeocacheData->slLatitude_SC / GeocacheData->SEMI_CIRCLE_CONVERSION).ToString();
- }
- else
- {
- this->labelLat->Text = "---";
- this->labelGCdLat->Text = "---";
- }
- if (GeocacheData->bLongitudeEnabled)
- {
- this->labelLon->Text = ((double)GeocacheData->slLongitude_SC / GeocacheData->SEMI_CIRCLE_CONVERSION).ToString("N2");
- this->labelGCdLon->Text = ((double)GeocacheData->slLongitude_SC / GeocacheData->SEMI_CIRCLE_CONVERSION).ToString("N2");
- if (this->tabControl1->SelectedIndex != 3)
- this->numericUpDownLongitude->Text = ((double)GeocacheData->slLongitude_SC / GeocacheData->SEMI_CIRCLE_CONVERSION).ToString();
- }
- else
- {
- this->labelLon->Text = "---";
- this->labelGCdLon->Text = "---";
- }
-
- if (GeocacheData->bHintEnabled)
- {
- System::Text::StringBuilder^ builder = gcnew System::Text::StringBuilder();
- for(int i=0; i<GeocacheData->cHint->Length; i++) builder->Append((Char)GeocacheData->cHint[i]);
- this->labelHint->Text = builder->ToString();
- this->labelGCdHint->Text = builder->ToString();
- if (this->tabControl1->SelectedIndex != 3)
- this->textBoxHint->Text = builder->ToString();
- }
- else
- {
- this->labelHint->Text = "---";
- this->labelGCdHint->Text = "---";
- }
-
- if (GeocacheData->bLoggedVisitsEnabled && (GeocacheData->ulLastVisitTimestamp > 0))
- {
- this->labelNumVisits->Text = GeocacheData->usNumVisits.ToString();
- this->labelGCdNumVisits->Text = GeocacheData->usNumVisits.ToString();
- if (this->tabControl1->SelectedIndex != 3)
- this->numericUpDownNumVisits->Value = GeocacheData->usNumVisits;
- time_t tmtLastVisit;
- struct tm * tmLastVisit;
- tmtLastVisit = ((time_t)GeocacheData->ulLastVisitTimestamp + tmtEpoch);
- #pragma warning (disable : 4996)
- tmLastVisit = localtime(&tmtLastVisit);
- if (this->tabControl1->SelectedIndex != 3)
- {
- this->numericUpDownYear->Value = tmLastVisit->tm_year + 1900;
- this->numericUpDownMonth->Value = tmLastVisit->tm_mon + 1;
- this->numericUpDownDay->Value = tmLastVisit->tm_mday;
- this->numericUpDownHours->Value = tmLastVisit->tm_hour;
- this->numericUpDownMinutes->Value = tmLastVisit->tm_min;
- this->numericUpDownSeconds->Value = tmLastVisit->tm_sec;
- }
- System::Text::StringBuilder^ builder = gcnew System::Text::StringBuilder();
- for(int i=0; i<26; i++) builder->Append((Char)((asctime(&tmLastVisit[0]))[i]));
- this->labelTimestamp->Text = builder->ToString();
- this->labelGCdTimestamp->Text = builder->ToString();
- }
- else
- {
- this->labelNumVisits->Text = "---";
- this->labelTimestamp->Text = "---";
- this->labelGCdNumVisits->Text = "---";
- this->labelGCdTimestamp->Text = "---";
- }
-
- UInt64 ui64AuthToken = ((UInt64)GeocacheData->ucAuthToken[0]) +
- ((UInt64)GeocacheData->ucAuthToken[1] << 8) +
- ((UInt64)GeocacheData->ucAuthToken[2] << 16) +
- ((UInt64)GeocacheData->ucAuthToken[3] << 24) +
- ((UInt64)GeocacheData->ucAuthToken[4] << 32) +
- ((UInt64)GeocacheData->ucAuthToken[5] << 40) +
- ((UInt64)GeocacheData->ucAuthToken[6] << 48);
- this->labelAuthToken->Text = ui64AuthToken.ToString("X2");
- this->labelAuthSerialNum->Text = GeocacheData->ulSerialNum.ToString();
- this->labelAuthNonce->Text = GeocacheData->usNonce.ToString();
-
- if (commonData->usMfgID != 0)
- {
- this->label_Glb_ManfIDDisplay->Text = commonData->usMfgID.ToString();
- this->label_Glb_HardwareVerDisplay->Text = commonData->ucHwVersion.ToString();
- this->label_Glb_ModelNumDisplay->Text = commonData->usModelNum.ToString();
- }
-
- if (commonData->ulSerialNum != 0)
- {
- if(commonData->ulSerialNum == 0xFFFFFFFF)
- this->label_Glb_SerialNumDisplay->Text = "N/A";
- else
- this->label_Glb_SerialNumDisplay->Text = commonData->ulSerialNum.ToString();
-
- this->label_Glb_SoftwareVerDisplay->Text = commonData->ucSwVersion.ToString();
- }
-
- if (commonData->ulOpTime != 0)
- {
- if(commonData->IsBatteryVoltageInvalid(commonData->usBatVoltage256))
- this->labelBattVolt->Text = "Invalid";
- else
- this->labelBattVolt->Text = System::Math::Round((double)commonData->usBatVoltage256/256,4).ToString("N2");
- if (commonData->eTimeResolution == CommonData::TimeResolution::SIXTEEN)
- this->labelTimeRes->Text = "16";
- else
- this->labelTimeRes->Text = "2";
-
- this->labelOpTime->Text = (commonData->ulOpTime * (UCHAR) commonData->eTimeResolution).ToString();
- switch (commonData->eBatStatus)
- {
- case CommonData::BatStatus::CRITICAL:
- this->labelBattStatus->Text = "Critical";
- break;
- case CommonData::BatStatus::GOOD:
- this->labelBattStatus->Text = "Good";
- break;
- case CommonData::BatStatus::INVALID:
- this->labelBattStatus->Text = "Invalid";
- break;
- case CommonData::BatStatus::LOW:
- this->labelBattStatus->Text = "Low";
- break;
- case CommonData::BatStatus::NEW:
- this->labelBattStatus->Text = "New";
- break;
- case CommonData::BatStatus::OK:
- this->labelBattStatus->Text = "Ok";
- break;
- default:
- break;
- }
- }
- }
- void GeocacheDisplay::onTimerTock(USHORT eventTime)
- {
- UpdateDisplay();
- }
- void GeocacheDisplay::numericUpDownLongitude_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
- }
- void GeocacheDisplay::numericUpDownLatitude_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
- }
- void GeocacheDisplay::checkBoxID_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
- {
- if (this->checkBoxID->Checked == TRUE)
- {
- this->textBoxID->Enabled = TRUE;
- }
- else
- {
- this->textBoxID->Enabled = FALSE;
- }
- }
- bool nonNumberEntered;
- void GeocacheDisplay::textBoxID_KeyDown( Object^ , System::Windows::Forms::KeyEventArgs^ e )
- {
-
- nonNumberEntered = false;
-
-
- if ( e->KeyCode < Keys::D0 || e->KeyCode > Keys::Z )
- {
-
- if ( e->KeyCode < Keys::NumPad0 || e->KeyCode > Keys::NumPad9 )
- {
-
- if ( e->KeyCode != Keys::Back )
- {
-
-
- nonNumberEntered = true;
- }
- }
- }
-
- if (Control::ModifierKeys == Keys::Shift) {
-
- if ( e->KeyCode < Keys::A || e->KeyCode > Keys::Z )
- nonNumberEntered = true;
- }
- }
- void GeocacheDisplay::textBoxID_KeyPress( Object^ , System::Windows::Forms::KeyPressEventArgs^ e )
- {
-
- if ( nonNumberEntered == true )
- {
- e->Handled = true;
- }
- }
- void GeocacheDisplay::checkBoxPIN_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
- {
- if (this->checkBoxPIN->Checked == TRUE)
- {
- this->textBoxPIN->Enabled = TRUE;
- }
- else
- {
- this->textBoxPIN->Enabled = FALSE;
- }
- }
- void GeocacheDisplay::textBoxPIN_KeyDown( Object^ , System::Windows::Forms::KeyEventArgs^ e )
- {
-
- nonNumberEntered = false;
-
-
- if ( e->KeyCode < Keys::D0 || e->KeyCode > Keys::D9 )
- {
-
- if ( e->KeyCode < Keys::NumPad0 || e->KeyCode > Keys::NumPad9 )
- {
-
- if ( e->KeyCode != Keys::Back )
- {
-
-
- nonNumberEntered = true;
- }
- }
- }
-
- if (Control::ModifierKeys == Keys::Shift) {
- nonNumberEntered = true;
- }
- }
- void GeocacheDisplay::textBoxPIN_KeyPress( Object^ , System::Windows::Forms::KeyPressEventArgs^ e )
- {
-
- if ( nonNumberEntered == true )
- {
- e->Handled = true;
- }
- }
- void GeocacheDisplay::checkBoxLatitude_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
- {
- if (this->checkBoxLatitude->Checked == TRUE)
- {
- this->numericUpDownLatitude->Enabled = TRUE;
- }
- else
- {
- this->numericUpDownLatitude->Enabled = FALSE;
- }
- }
- void GeocacheDisplay::checkBoxLongitude_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
- {
- if (this->checkBoxLongitude->Checked == TRUE)
- {
- this->numericUpDownLongitude->Enabled = TRUE;
- }
- else
- {
- this->numericUpDownLongitude->Enabled = FALSE;
- }
- }
- void GeocacheDisplay::checkBoxHint_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
- {
- if (this->checkBoxHint->Checked == TRUE)
- {
- this->textBoxHint->Enabled = TRUE;
- }
- else
- {
- this->textBoxHint->Enabled = FALSE;
- }
- }
- void GeocacheDisplay::checkBoxLoggedVisits_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
- {
- if (this->checkBoxLoggedVisits->Checked == TRUE)
- {
- this->numericUpDownNumVisits->Enabled = TRUE;
- this->numericUpDownYear->Enabled = TRUE;
- this->numericUpDownMonth->Enabled = TRUE;
- this->numericUpDownDay->Enabled = TRUE;
- this->numericUpDownHours->Enabled = TRUE;
- this->numericUpDownMinutes->Enabled = TRUE;
- this->numericUpDownSeconds->Enabled = TRUE;
- }
- else
- {
- this->numericUpDownNumVisits->Enabled = FALSE;
- this->numericUpDownYear->Enabled = FALSE;
- this->numericUpDownMonth->Enabled = FALSE;
- this->numericUpDownDay->Enabled = FALSE;
- this->numericUpDownHours->Enabled = FALSE;
- this->numericUpDownMinutes->Enabled = FALSE;
- this->numericUpDownSeconds->Enabled = FALSE;
- }
- }
- void GeocacheDisplay::numericUpDownNumVisits_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
-
- }
- void GeocacheDisplay::numericUpDownDay_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
- commonData->ucDays = System::Convert::ToByte(this->numericUpDownDay->Value);
- }
- void GeocacheDisplay::numericUpDownMonth_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
- commonData->ucMonth = System::Convert::ToByte(this->numericUpDownMonth->Value);
- }
- void GeocacheDisplay::numericUpDownYear_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
- commonData->ucYears = System::Convert::ToByte(this->numericUpDownYear->Value);
- }
- void GeocacheDisplay::numericUpDownHours_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
- commonData->ucHours = System::Convert::ToByte(this->numericUpDownHours->Value);
- }
- void GeocacheDisplay::numericUpDownMinutes_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
- commonData->ucMinutes = System::Convert::ToByte(this->numericUpDownMinutes->Value);
- }
- void GeocacheDisplay::numericUpDownSeconds_ValueChanged(System::Object^ sender, System::EventArgs^ e)
- {
- commonData->ucSeconds = System::Convert::ToByte(this->numericUpDownSeconds->Value);
- }
|