/* M P G E T S E L E C T V A L U E S */ /*---------------------------------------------------------------------------- %%Function: MpGetSelectValues %%Qualified: ArbWeb.AwMainForm.MpGetSelectValues %%Contact: rlittle for a given <select name=$sName><option value=$sValue>$sText</option>... Find the given sName select object. Then add a mapping of $sText -> $sValue to a dictionary and return it. ----------------------------------------------------------------------------*/ public static Dictionary<string, string> MpGetSelectValues(StatusRpt srpt, IHTMLDocument2 oDoc2, string sName) { IHTMLElementCollection hec; Dictionary<string, string> mp = new Dictionary<string, string>(); hec = (IHTMLElementCollection) oDoc2.all.tags("select"); foreach (IHTMLSelectElement ihie in hec) { if (String.Compare(ihie.name, sName, true) == 0) { foreach (IHTMLOptionElement ihoe in (IHTMLElementCollection) ihie.tags("option")) { if (mp.ContainsKey(ihoe.text)) srpt.AddMessage( String.Format("How strange! '{0}' shows up more than once as a position", ihoe.text), StatusRpt.MSGT.Warning); else mp.Add(ihoe.text, ihoe.value); } } } return mp; }
public void EnsureLoggedIn() { if (m_fLoggedIn) { return; } m_srpt.AddMessage("Logging in..."); m_srpt.PushLevel(); if (!m_wc.FNavToPage(_s_LoginLegacy) || !m_wc.FWaitForNavFinish()) { throw new Exception("couldn't navigate to login page"); } IHTMLDocument2 oDoc2 = m_wc.Document2; WebControl.FSetInputControlText(oDoc2, _s_CtlName_LoginName, m_sUsername, false); WebControl.FSetInputControlText(oDoc2, _s_CtlName_LoginPassword, m_sPassword, false); m_wc.ResetNav(); IHTMLElement ihe = WebControl.FindSubmitControlByValueText(oDoc2, null); if (ihe == null) { throw new Exception("no submit control?"); } ihe.click(); m_wc.FWaitForNavFinish(_s_CtlId_Cellar_MyWine); m_fLoggedIn = true; m_srpt.PopLevel(); m_srpt.AddMessage("Login complete"); }
/* M P G E T S E L E C T V A L U E S */ /*---------------------------------------------------------------------------- %%Function: MpGetSelectValues %%Qualified: ArbWeb.AwMainForm.MpGetSelectValues %%Contact: rlittle for a given <select name=$sName><option value=$sValue>$sText</option>... Find the given sName select object. Then add a mapping of $sText -> $sValue to a dictionary and return it. ----------------------------------------------------------------------------*/ public static Dictionary<string, string> MpGetSelectValues(StatusRpt srpt, IHTMLDocument2 oDoc2, string sName) { IHTMLElementCollection hec; Dictionary<string, string> mp = new Dictionary<string, string>(); hec = (IHTMLElementCollection)oDoc2.all.tags("select"); foreach (HTMLSelectElementClass ihie in hec) { if (String.Compare(ihie.name, sName, true) == 0) { foreach (IHTMLOptionElement ihoe in (IHTMLElementCollection)ihie.tags("option")) { if (mp.ContainsKey(ihoe.text)) srpt.AddMessage(String.Format("How strange! '{0}' shows up more than once as a position", ihoe.text), StatusRpt.MSGT.Warning); else mp.Add(ihoe.text, ihoe.value); } } } return mp; }
/* O N N A V I G A T I N G */ /*---------------------------------------------------------------------------- %%Function: OnNavigating %%Qualified: ArbWeb.ArbWebControl.OnNavigating %%Contact: rlittle ----------------------------------------------------------------------------*/ private void OnNavigating(object sender, WebBrowserNavigatingEventArgs e) { m_srpt.AddMessage(String.Format("OnNavigating: {0}", e.Url)); }