Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Control Code:
- public class CardReader : Panel,ICardReaderEvents, ICardReaderProperties
- {
- public void Error()
- {
- }
- public void Success()
- {
- }
- }
- //Interface for events
- [Guid("DD0C202B-12B4-4457-9FC6-05F88A6E8BC5")]
- [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
- public interface ICardReaderEvents
- {
- [DispId(0x60020000)]
- void Error();
- [DispId(0x60020001)]
- void Success();
- }
- //Interface for public properties/methods
- public interface ICardReaderProperties
- {
- ...
- }
- //JavaScript to handle events
- <SCRIPT FOR="CardReader1" EVENT="Error">
- window.status = "Error...";
- </SCRIPT>
- <SCRIPT FOR="CardReader1" EVENT="Success">
- window.alert("Success");
- window.status = "";
- </SCRIPT>
- public event Error;
- public event Success;
- protected void OnError()
- {
- if(Error != null)
- Error();
- }
- protected void OnSuccess()
- {
- if(Success != null)
- Success();
- }
- <object id="CR" ...></object>
- <script type="text/javascript">
- function CR::Error()
- {
- alert("Error!");
- }
- function CR::Success()
- {
- alert("Success");
- }
- </script>
Add Comment
Please, Sign In to add comment