}
else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 0)
{
- EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
- "正在链接网络");
+ EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("正在链接网络");
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() > 0)
{
}
std::string progress_str = "正在下载"+std::to_string(progress)+"%";
EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress_str.c_str());
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 10)
{
if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) {
EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
"下载成功");
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
//更新有效期
if(EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()) {
case EphemerisDownloadStatus::FAILED:
if (EphemerisDownloadView::GetInstance()) {
if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) {
- EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
- "下载失败");
+ EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("下载失败");
}
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
- break;
- // case EphemerisDownloadStatus::NOT_DOWNLOADED:
- // if (EphemerisDownloadView::GetInstance()) {
- // if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) {
- // EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
- // "未下载");
- // }
- // }
- // break;
+ default:
+ break;
}
}
// 更新下载状态显示
void EphemerisDownloadView::UpdateDownloadStatus() {
if (labelStatusValue_ == nullptr) return;
-
- auto status = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadStatus();
- int progress = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress();
-
- switch (status) {
- case EphemerisDownloadStatus::NOT_DOWNLOADED:
- labelStatusValue_->SetText("未下载");
- break;
- case EphemerisDownloadStatus::DOWNLOADING:
- labelStatusValue_->SetText(("下载中 " + std::to_string(progress) + "%").c_str());
- break;
- case EphemerisDownloadStatus::DOWNLOADED:
- labelStatusValue_->SetText("已完成");
- break;
- case EphemerisDownloadStatus::FAILED:
- labelStatusValue_->SetText("下载失败");
- break;
+ //如果有效期大于0,则显示下载成功
+ if(EphemerisDownloadModel::GetInstance().GetValidityPeriod())
+ {
+ labelStatusValue_->SetText("数据有效");
+ }
+ else
+ {
+ labelStatusValue_->SetText("未下载");
}
}
case EphemerisDownloadStatus::NOT_DOWNLOADED:
case EphemerisDownloadStatus::FAILED:
btnDownload_->SetText("未下载");
- btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0xff, 0x8c, 0x00, 0xff).full); // 橙色
+ btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); // 蓝色
btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0xcc, 0x70, 0x00, 0xff).full, UIButton::PRESSED);
break;
case EphemerisDownloadStatus::DOWNLOADING:
btnDownload_->SetText("下载中");
- btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff).full); // 灰色
+ btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); // 灰色
btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x44, 0x44, 0x44, 0xff).full, UIButton::PRESSED);
break;
case EphemerisDownloadStatus::DOWNLOADED:
btnDownload_->SetText("已下载");
- btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff).full); // 灰色
+ btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); // 绿色
btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x44, 0x44, 0x44, 0xff).full, UIButton::PRESSED);
break;
}
}
else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 0)
{
- EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
- "正在链接网络");
+ EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("正在链接网络");
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() > 0)
{
}
std::string progress_str = "正在下载"+std::to_string(progress)+"%";
EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress_str.c_str());
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 10)
{
if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) {
EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
"下载成功");
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
//更新有效期
if(EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()) {
case EphemerisDownloadStatus::FAILED:
if (EphemerisDownloadView::GetInstance()) {
if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) {
- EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
- "下载失败");
+ EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("下载失败");
}
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
- break;
- // case EphemerisDownloadStatus::NOT_DOWNLOADED:
- // if (EphemerisDownloadView::GetInstance()) {
- // if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) {
- // EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
- // "未下载");
- // }
- // }
- // break;
+ default:
+ break;
}
}
// 更新下载状态显示
void EphemerisDownloadView::UpdateDownloadStatus() {
if (labelStatusValue_ == nullptr) return;
-
- auto status = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadStatus();
- int progress = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress();
-
- switch (status) {
- case EphemerisDownloadStatus::NOT_DOWNLOADED:
- labelStatusValue_->SetText("未下载");
- break;
- case EphemerisDownloadStatus::DOWNLOADING:
- labelStatusValue_->SetText(("下载中 " + std::to_string(progress) + "%").c_str());
- break;
- case EphemerisDownloadStatus::DOWNLOADED:
- labelStatusValue_->SetText("已完成");
- break;
- case EphemerisDownloadStatus::FAILED:
- labelStatusValue_->SetText("下载失败");
- break;
+ //如果有效期大于0,则显示下载成功
+ if(EphemerisDownloadModel::GetInstance().GetValidityPeriod())
+ {
+ labelStatusValue_->SetText("数据有效");
+ }
+ else
+ {
+ labelStatusValue_->SetText("未下载");
}
}
case EphemerisDownloadStatus::NOT_DOWNLOADED:
case EphemerisDownloadStatus::FAILED:
btnDownload_->SetText("未下载");
- btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0xff, 0x8c, 0x00, 0xff).full); // 橙色
+ btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); // 蓝色
btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0xcc, 0x70, 0x00, 0xff).full, UIButton::PRESSED);
break;
case EphemerisDownloadStatus::DOWNLOADING:
btnDownload_->SetText("下载中");
- btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff).full); // 灰色
+ btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); // 灰色
btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x44, 0x44, 0x44, 0xff).full, UIButton::PRESSED);
break;
case EphemerisDownloadStatus::DOWNLOADED:
btnDownload_->SetText("已下载");
- btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff).full); // 灰色
+ btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); // 绿色
btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x44, 0x44, 0x44, 0xff).full, UIButton::PRESSED);
break;
}
}
else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 0)
{
- EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
- "正在链接网络");
+ EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("正在链接网络");
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() > 0)
{
}
std::string progress_str = "正在下载"+std::to_string(progress)+"%";
EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress_str.c_str());
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 10)
{
if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) {
EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
"下载成功");
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
//更新有效期
if(EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()) {
case EphemerisDownloadStatus::FAILED:
if (EphemerisDownloadView::GetInstance()) {
if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) {
- EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
- "下载失败");
+ EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText("下载失败");
}
+ //设置下载按键
+ EphemerisDownloadView::GetInstance()->UpdateDownloadButton();
}
- break;
- // case EphemerisDownloadStatus::NOT_DOWNLOADED:
- // if (EphemerisDownloadView::GetInstance()) {
- // if (EphemerisDownloadView::GetInstance()->GetDownloadLabel()) {
- // EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(
- // "未下载");
- // }
- // }
- // break;
+ default:
+ break;
}
}
// 更新下载状态显示
void EphemerisDownloadView::UpdateDownloadStatus() {
if (labelStatusValue_ == nullptr) return;
-
- auto status = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadStatus();
- int progress = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress();
-
- switch (status) {
- case EphemerisDownloadStatus::NOT_DOWNLOADED:
- labelStatusValue_->SetText("未下载");
- break;
- case EphemerisDownloadStatus::DOWNLOADING:
- labelStatusValue_->SetText(("下载中 " + std::to_string(progress) + "%").c_str());
- break;
- case EphemerisDownloadStatus::DOWNLOADED:
- labelStatusValue_->SetText("已完成");
- break;
- case EphemerisDownloadStatus::FAILED:
- labelStatusValue_->SetText("下载失败");
- break;
+ //如果有效期大于0,则显示下载成功
+ if(EphemerisDownloadModel::GetInstance().GetValidityPeriod())
+ {
+ labelStatusValue_->SetText("数据有效");
+ }
+ else
+ {
+ labelStatusValue_->SetText("未下载");
}
}
case EphemerisDownloadStatus::NOT_DOWNLOADED:
case EphemerisDownloadStatus::FAILED:
btnDownload_->SetText("未下载");
- btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0xff, 0x8c, 0x00, 0xff).full); // 橙色
+ btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); // 蓝色
btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0xcc, 0x70, 0x00, 0xff).full, UIButton::PRESSED);
break;
case EphemerisDownloadStatus::DOWNLOADING:
btnDownload_->SetText("下载中");
- btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff).full); // 灰色
+ btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); // 灰色
btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x44, 0x44, 0x44, 0xff).full, UIButton::PRESSED);
break;
case EphemerisDownloadStatus::DOWNLOADED:
btnDownload_->SetText("已下载");
- btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff).full); // 灰色
+ btnDownload_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); // 绿色
btnDownload_->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGBA(0x44, 0x44, 0x44, 0xff).full, UIButton::PRESSED);
break;
}