コード例 #1
0
result Enrollment::OnInitializing(void) {
	result r = E_SUCCESS;
	CheckButton* pCheckBtn = null;

	SetFormBackEventListener(this);

	__pSaveBtn = static_cast<Button*>(GetControl(IDC_SAVE));
	__pDate = static_cast<Label*>(GetControl(IDC_DATE));

	String cBtnName[] = { IDC_CHECKBUTTON_WORK1, IDC_CHECKBUTTON_WORK2,
			IDC_CHECKBUTTON_WORK3, IDC_CHECKBUTTON_WORK4 };

	for (int i = 0; i < MAX_WORK_COUNT; i++) {
		__pWorkList[i] = static_cast<CheckButton*>(GetControl(cBtnName[i]));
	}

	for (int i = 0; i < MAX_WORK_COUNT; i++) {
		pCheckBtn = dynamic_cast<CheckButton*>(GetControl(cBtnName[i]));
		TryReturn(pCheckBtn != null, E_SYSTEM,
				"Unable to get control [%ls]", cBtnName[i].GetPointer());
		pCheckBtn->SetEnabled(false);
		pCheckBtn->SetActionId(ID_WORK_1 + i, ID_WORK_1 + 500 + i);

		pCheckBtn->AddActionEventListener(*this);

	}

//!!!!!!!!!!!!!!!!!!!!!!!!!!!

	String btnName[] = { IDC_PILL_1, IDC_PILL_2, IDC_PILL_3, IDC_MEET, IDC_SAVE,
			IDC_DEL };

	Button* pButton = null;

	for (int i = 0; i < MAX_BTN_COUNT; i++) {
		pButton = dynamic_cast<Button*>(GetControl(btnName[i]));
		TryReturn(pButton != null, E_SYSTEM,
				"Unable to get control [%ls]", btnName[i].GetPointer());

		pButton->SetActionId(IDC_BUTTON_PILL_1 + i);
		pButton->AddActionEventListener(*this);
	}

	//!!!!!!!!!!!!!!!!!!!!!!!!!!!!

	__pForm = this;
	EnableControl(false);

	return r;
}
コード例 #2
0
result ConfigForm::Construct(IActionEventListener * mainListener)
{
    VerticalBoxLayout layout;
    layout.Construct(VERTICAL_DIRECTION_DOWNWARD);
    Form::Construct(layout, FORM_STYLE_NORMAL | FORM_STYLE_FOOTER);

    Label * label = new Label();
    label->Construct(Rectangle(0, 0, 48, 50), L"Device model:");
    AddControl(*label);
    layout.SetHorizontalFitPolicy(*label, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*label, FIT_POLICY_FIXED);

    __pModelEditField = new EditField;
    __pModelEditField->Construct(Rectangle(0, 0, 150, 110), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN);
    __pModelEditField->SetText(L"GT-I8800");
    AddControl(*__pModelEditField);
    layout.SetHorizontalFitPolicy(*__pModelEditField, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*__pModelEditField, FIT_POLICY_FIXED);

    label = new Label();
    label->Construct(Rectangle(0, 0, 48, 50), L"MNC:");
    AddControl(*label);
    layout.SetHorizontalFitPolicy(*label, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*label, FIT_POLICY_FIXED);

    __pMncEditField = new EditField;
    __pMncEditField->Construct(Rectangle(0, 0, 150, 110), EDIT_FIELD_STYLE_NUMBER, INPUT_STYLE_FULLSCREEN);
    AddControl(*__pMncEditField);
    layout.SetHorizontalFitPolicy(*__pMncEditField, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*__pMncEditField, FIT_POLICY_FIXED);
    __pMncEditField->SetText(L"01");

    label = new Label();
    label->Construct(Rectangle(0, 0, 48, 50), L"Developer flag:");
    AddControl(*label);
    layout.SetHorizontalFitPolicy(*label, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*label, FIT_POLICY_FIXED);

    __pDevRadioGroup = new RadioGroup;
    __pDevRadioGroup->Construct();
    CheckButton * devbutton = new CheckButton;
    devbutton->Construct(Rectangle(0, 0, 150, 110), CHECK_BUTTON_STYLE_RADIO, BACKGROUND_STYLE_DEFAULT, false, "Developer mode, always success");
    devbutton->SetActionId(BuyConfigInfo::AlwaysSuccess, BuyConfigInfo::AlwaysSuccess);
    devbutton->AddActionEventListener(*this);
    AddControl(*devbutton);
    __pDevRadioGroup->Add(*devbutton);
    layout.SetHorizontalFitPolicy(*devbutton, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*devbutton, FIT_POLICY_FIXED);
    AppLog("chkbtn %p", devbutton);

    __pDevRadioGroup->SetSelectedItem(*devbutton);

    devbutton = new CheckButton;
    devbutton->Construct(Rectangle(0, 0, 150, 110), CHECK_BUTTON_STYLE_RADIO, BACKGROUND_STYLE_DEFAULT, false, "Normal");
    devbutton->SetActionId(BuyConfigInfo::Normal, BuyConfigInfo::Normal);
    devbutton->AddActionEventListener(*this);
    AddControl(*devbutton);
    __pDevRadioGroup->Add(*devbutton);
    layout.SetHorizontalFitPolicy(*devbutton, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*devbutton, FIT_POLICY_FIXED);
    AddControl(*__pDevRadioGroup);
    AppLog("chkbtn %p", devbutton);

    TableView * pTableView = new TableView();
    pTableView->Construct( Rectangle(0, 0, GetWidth(), 600), false, TABLE_VIEW_SCROLL_BAR_STYLE_NONE);
    AddControl(*pTableView);
    m_pTableView = pTableView;
    pTableView->SetItemProvider(this);
    pTableView->AddTableViewItemEventListener(*this);
    layout.SetHorizontalFitPolicy(*pTableView, FIT_POLICY_PARENT);
    layout.SetVerticalFitPolicy(*pTableView, FIT_POLICY_FIXED);

    GetFooter()->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
    GetFooter()->AddActionEventListener(*this);

    __pMainListener = mainListener;

    BuyConfigInfo info;
    info.m_developerFlag = BuyConfigInfo::AlwaysSuccess;
    info.m_model = "GT-I8800";
    info.m_mcc = "000";
    info.m_mnc = "00";
    __pEngine = new BuyEngine(this, info);

    result r = __pEngine->RequestCountryList(0);
    if ( IsFailed(r) ) AppLog(GetErrorMessage(r));

    UpdateConfirmButtonState();

    return E_SUCCESS;
}