LRESULT UCPage::onChangeMenu(WORD , WORD , HWND , BOOL& ) { if(ctrlCommands.GetSelectedCount() == 1) { int sel = ctrlCommands.GetSelectedIndex(); UserCommand uc; FavoriteManager::getInstance()->getUserCommand(ctrlCommands.GetItemData(sel), uc); CommandDlg dlg; dlg.type = uc.getType(); dlg.ctx = uc.getCtx(); dlg.name = Text::toT(uc.getName()); dlg.command = Text::toT(uc.getCommand()); dlg.to = Text::toT(uc.getTo()); dlg.hub = Text::toT(uc.getHub()); if(dlg.DoModal() == IDOK) { if(dlg.type == UserCommand::TYPE_SEPARATOR) ctrlCommands.SetItemText(sel, 0, CTSTRING(SEPARATOR)); else ctrlCommands.SetItemText(sel, 0, dlg.name.c_str()); ctrlCommands.SetItemText(sel, 1, dlg.command.c_str()); ctrlCommands.SetItemText(sel, 2, dlg.hub.c_str()); uc.setName(Text::fromT(dlg.name)); uc.setCommand(Text::fromT(dlg.command)); uc.setTo(Text::fromT(dlg.to)); uc.setHub(Text::fromT(dlg.hub)); uc.setType(dlg.type); uc.setCtx(dlg.ctx); FavoriteManager::getInstance()->updateUserCommand(uc); } } return 0; }
LRESULT UCPage::onAddMenu(WORD , WORD , HWND , BOOL& ) { CommandDlg dlg; if(dlg.DoModal() == IDOK) { addEntry(FavoriteManager::getInstance()->addUserCommand(dlg.type, dlg.ctx, 0, Text::fromT(dlg.name), Text::fromT(dlg.command), Text::fromT(dlg.to), Text::fromT(dlg.hub)), ctrlCommands.GetItemCount()); } return 0; }
void C图片管理器App::OnCreateele() { // TODO: 在此添加命令处理程序代码 CommandDlg dlg; dlg.DoModal(); }