Share via


IViewProvider::Load method

Loads the view.

Syntax

HRESULT Load(
  [in] HSTRING contentID
);

Parameters

  • contentID [in]
    Type: HSTRING

    A string used by the implementation of the IViewProvider to understand additional information about the created view.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Examples

class CMyApplicationView : public RuntimeClass<IViewProvider>
{
    ~CMyApplicationView()
    {
        _spApplicationView->remove_TileActivated(_evtToken);
    }

    HRESULT Initialize(__in IWindow* window,
                       __in IApplicationView* view)
    {
        _spWindow = window;
        _spApplicationView = view;

        return window.As(&_spWindowDispatcher);
    }

    HRESULT Load(HSTRING contentId)
    {
        return _spApplicationView->add_TileActivated(Callback<this,
                     CMyApplicationView::OnTileActivated>, &_evtToken);
    }

    HRESULT Run()
    {
        return _spWindowDispatcher->ProcessEvents();
    }

    HRESULT OnTileActivated(__in IApplication* source,
                            __in ITileEventArgs* ea)
    {
        // Set up code to do drawing here
    }

private:
    ComPtr<IWindow> _spWindow;
    ComPtr<IDispatcher> _spWindowDispatcher;
    ComPtr<IApplicationView> _spApplicationView;
    EventToken _evtToken;
}

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Header

Windows.ApplicationModel.Core.h

IDL

Windows.ApplicationModel.Core.idl

See also

IViewProvider