Export (0) Print
Expand All

Notification.OnResponseSubmitted Method

Raises the ResponseSubmitted event.

Namespace: Microsoft.WindowsCE.Forms
Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)

protected virtual void OnResponseSubmitted (
	ResponseSubmittedEventArgs e
)
protected void OnResponseSubmitted (
	ResponseSubmittedEventArgs e
)
protected function OnResponseSubmitted (
	e : ResponseSubmittedEventArgs
)

Parameters

e

A ResponseSubmitted event occurs when the message balloon is dismissed by user input or if the InitialDuration time elapses. The Response property contains a string with the results of an HTML form or the names of a button or link clicked by the user. You can parse this string for values pertinent to your application.

Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

The OnResponseSubmitted method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors When overriding OnResponseSubmitted in a derived class, be sure to call the base class’s OnResponseSubmitted method so that registered delegates receive the event.

The following code example parses the Response property for values selected in an HTML form, and for the name of other elements in the message balloon. This code example is part of a larger example provided for the Notification class.

// When a ResponseSubmitted event occurs, this event handler
// parses the response to determine values in the HTML form.
private void OnResponseSubmitted(object obj, ResponseSubmittedEventArgs resevent)
{

    // Use a StringBuilder to create a log of the response.
    StringBuilder LogResponse = new StringBuilder();


    // If the response contains the name specified for the action value
    // of the HTML form, in this case "notify," get the value of the
    // selected option from the SELECT list. An example of the
    // response string would be notify?lstbx=0.

    if (resevent.Response.Substring(0, 6) == "notify")
    {
        int choice = Convert.ToInt32(resevent.Response.Substring(13, 1));
        switch (choice)
        {
            case 0:
                LogResponse.Equals("submit");
                break;
            case 1:
                LogResponse.Equals("opt 1");
                break;
            case 2:
                LogResponse.Equals("opt 2");
                break;
            case 3:
                LogResponse.Equals("opt 3");
                break;
            case 4:
                LogResponse.Equals("opt 4");
                break;
        }
        // If the checkbox in the form is checked, the response
        // string could be as follows: notify?lstbx=0chkbx=on
        // You can determine whether the check box is selected
        // by checking whether the response ends with "on".
        if (resevent.Response.EndsWith("on"))
            LogResponse.Equals("checkbox");
    }

    // If the user clicked the settings link,
    // log the response. This example could display
    // a dialog box by activating another form.
    else if (resevent.Response == "settings")
    {
        // Display a settings dialog by activating
        // a form named 'Settings':
        // Settings.Activate
        LogResponse.Equals("Postponed by clicking link");

        // The user needs to respond to the notification
        // after checking the settings, so set the
        // InitialDuration and Visible properties so
        // that the icon appears in the title bar.
        notification1.InitialDuration = 0;
        notification1.Visible = true;
    }

    // Display the response on the status bar.
    statusBar1.Text = LogResponse.ToString() + " HTML: " + resevent.Response.ToString();
}

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows Mobile for Pocket PC

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2015 Microsoft