IFACEMETHODIMP CTriColorControlProvider::SetValue(_In_ LPCWSTR val) 
{ 
    HRESULT hr = CheckDisconnected();
    if (SUCCEEDED(hr))
    {
        TriColorValue newValue = TriColorValue::Red;
        bool bFound = false;
        if (0 == _wcsicmp(val, L"red"))
        {
            newValue = TriColorValue::Red;
            bFound = true;
        }
        else if (0 == _wcsicmp(val, L"yellow"))
        {
            newValue = TriColorValue::Yellow;
            bFound = true;
        } 
        else if (0 == _wcsicmp(val, L"green"))
        {
            newValue = TriColorValue::Green;
            bFound = true;
        }

        if (bFound)
        {
            hr = m_control->put_ControlValue(newValue);
        }
        else
        {
            hr = E_INVALIDARG;
        }
    }
    return hr;
}
예제 #2
0
STDMETHODIMP CTriColorFragmentProvider::Select()
{ 
    HRESULT hr = CheckDisconnected();
    if (SUCCEEDED(hr))
    {
        hr = m_control->put_ControlValue(m_value);
    }
    return hr;
}