HTREEITEM PublicHubsFrame::LoadTreeItems(TStringSet& l_hubs, HTREEITEM hRoot)
{
	if (hRoot)
	{
		tstring buf;
		TV_ITEM tvi = {0};
		tvi.mask    = TVIF_TEXT;
		tvi.hItem  =  hRoot;
		if (m_ctrlTree.GetItem(&tvi))
		{
			if (tvi.lParam == e_ISPHub)
			{
				buf.resize(1000);
				m_ctrlTree.GetItemText(hRoot, &buf[0], buf.size());
				l_hubs.insert(buf);
			}
		}
		HTREEITEM hSub = m_ctrlTree.GetChildItem(hRoot);
		while (hSub)
		{
			HTREEITEM hFound = LoadTreeItems(l_hubs, hSub);
			if (hFound)
				return hFound;
			hSub = m_ctrlTree.GetNextSiblingItem(hSub);
		}
	}
	return NULL;
}
Beispiel #2
0
YardCustomer::YardCustomer(wxWindow* parent, wxWindowID id, 
    const wxString& title, const wxPoint& pos,
    const wxSize& size, long style, const wxString& name)
:wxDialog(parent, id, title, pos, size, style, name), m_loading(true) {
    wxBusyCursor busy();
    wxXmlResource::Get()->Load("res/customer.xrc");
    wxPanel * panel = wxXmlResource::Get()->LoadPanel(this, "Customer");
    wxSizer * sizer = panel->GetSizer();
    sizer->SetSizeHints(this);
    SetSize(wxSize(600,400));
    Centre();  
    
    
    m_pic = static_cast<wxStaticBitmap *>(FindWindow(XRCID("ID_CUST_PICTURE")));
    m_sig = static_cast<wxStaticBitmap *>(FindWindow(XRCID("ID_CUST_SIG")));
    m_tree = static_cast<wxTreeCtrl *>(FindWindow(XRCID("ID_CUST_TREE")));
    m_first = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_CUST_FIRST")));
    m_middle = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_CUST_MIDDLE")));
    m_last = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_CUST_LAST")));
    m_address = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_CUST_ADDRESS")));
    m_ccNum = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_CUST_CC")));
    m_ccName = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_CUST_CC_NAME")));
    m_ccExp = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_CUST_CC_EXP")));
    m_phone = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_CUST_PHONE")));
    m_custSince = static_cast<wxStaticText *>(FindWindow(XRCID("ID_CUST_SINCE")));
    m_save = static_cast<wxButton *>(FindWindow(XRCID("ID_CUST_SAVE")));
    
    CreateImageList(m_tree);
    LoadTreeItems(m_tree);
    //ID_CUST_PICTURE
    m_loading = false;
    
}
Beispiel #3
0
YardEmployee::YardEmployee(wxWindow* parent, wxWindowID id, 
    const wxString& title, const wxPoint& pos,
    const wxSize& size, long style, const wxString& name)
:wxDialog(parent, id, title, pos, size, style, name), m_loading(true) {
    wxBusyCursor busy();
    wxXmlResource::Get()->Load("res/employee.xrc");
    wxPanel * panel = wxXmlResource::Get()->LoadPanel(this, "Employee");
    wxSizer * sizer = panel->GetSizer();
    sizer->SetSizeHints(this);
    SetSize(wxSize(600,400));
    Centre();
    
    #if 0
    if (wxGetApp().Full())
        ShowFullScreen(true);
    #endif
    m_pic = static_cast<wxStaticBitmap *>(FindWindow(XRCID("ID_EMPLOY_PICTURE")));
    m_sig = static_cast<wxStaticBitmap *>(FindWindow(XRCID("ID_EMPLOY_SIG")));
    m_tree = static_cast<wxTreeCtrl *>(FindWindow(XRCID("ID_EMPLOY_TREE")));
    m_first = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_EMPLOY_FIRST")));
    m_middle = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_EMPLOY_MIDDLE")));
    m_last = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_EMPLOY_LAST")));
    m_address = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_EMPLOY_ADDRESS")));
    m_id = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_EMPLOY_ID")));
    m_taxid = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_EMPLOY_TAX_ID")));
    m_phone = static_cast<wxTextCtrl *>(FindWindow(XRCID("ID_EMPLOY_PHONE")));
    m_position = static_cast<wxStaticText *>(FindWindow(XRCID("ID_EMPLOY_POSITION")));
    m_save = static_cast<wxButton *>(FindWindow(XRCID("ID_EMPLOY_SAVE")));
    m_hire = static_cast<wxStaticText *>(FindWindow(XRCID("ID_EMPLOY_HIRE")));
    
    m_save->Show(false);
    m_id->Enable(false);
    m_taxid->Enable(false);
    
    CreateImageList(m_tree);
    LoadTreeItems(m_tree);
    //ID_EMPLOY_PICTURE
    m_loading = false;
    
}
LRESULT PublicHubsFrame::onSelChangedISPTree(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/)
{
	NMTREEVIEW* p = (NMTREEVIEW*) pnmh;
	if (p->itemNew.state & TVIS_SELECTED)
	{
		CWaitCursor l_cursor_wait; //-V808
		m_ctrlHubs.DeleteAllItems();
		if (p->itemNew.lParam == e_HubListItem)
		{
			tstring buf;
			buf.resize(100);
			if (m_ctrlTree.GetItemText(p->itemNew.hItem, &buf[0], buf.size()))
			{
				const string l_url = Text::fromT(buf.c_str());
				CFlyLog l_log("Download Hub List");
				std::vector<byte> l_data;
				l_log.step("URL = " + l_url);
				CFlyHTTPDownloader l_http_downloader;
				//l_http_downloader.setInetFlag(INTERNET_FLAG_RESYNCHRONIZE);
				l_http_downloader.m_is_use_cache = true;
				if (l_http_downloader.getBinaryDataFromInet(l_url, l_data, 1000))
				{
					const string ext = Util::getFileExt(l_url);
					if (stricmp(ext, ".bz2") == 0)
					{
						std::vector<byte> l_out(l_data.size() * 20);
						size_t outSize = l_out.size();
						size_t sizeRead = l_data.size();
						UnBZFilter unbzip;
						try
						{
							unbzip(l_data.data(), (size_t &)sizeRead, &l_out[0], outSize);
							l_out[outSize] = 0;
							HubEntryList& l_list = m_publicListMatrix[l_url];
							l_list.clear();
							try
							{
								PubHubListXmlListLoader loader(l_list);
								SimpleXMLReader(&loader).parse((const char*)l_out.data(), outSize, false);
								m_hubs = l_list;
								updateList();
							}
							catch (const Exception& e)
							{
								l_log.step("XML parse error = " + e.getError());
							}
						}
						catch (const Exception& e)
						{
							l_log.step("Unpack error = " + e.getError());
						}
					}
				}
			}
		}
		else
		{
			TStringSet l_items;
			LoadTreeItems(l_items, p->itemNew.hItem);
			int cnt = 0;
			for (auto i = l_items.cbegin(); i != l_items.end(); ++i)
			{
				TStringList l;
				l.resize(COLUMN_LAST);
				l[COLUMN_SERVER] = *i;
				m_ctrlHubs.insert(cnt++, l, I_IMAGECALLBACK); // !SMT!-IP
			}
		}
		m_ctrlHubs.resort();
		updateStatus();
	}
	return 0;
}