Exemplo n.º 1
0
 /// <summary>
 /// Registers new URL protocol handler.
 /// </summary>
 /// <param name="protocol">URL protocol.</param>
 /// <param name="friendlyName">Friendly name of URL protocol.</param>
 /// <param name="handler">Delegate that uses as protocol handler for processing requested urls.</param>
 /// <param name="makeDefaultHandler">Delegate that is invoked when protocol is set as default.</param>
 public void RegisterProtocolHandler(string protocol, string friendlyName, ProtocolHandlerCallback handler, MethodInvoker makeDefaultHandler)
 {
     RegisterProtocolHandler(protocol, friendlyName, handler);
     Guard.NullArgument(makeDefaultHandler, "makeDefaultHandler");
     lock ( _makeDefaultHandler )
     {
         _makeDefaultHandler[protocol] = makeDefaultHandler;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Registers new URL protocol handler.
 /// </summary>
 /// <param name="protocol">URL protocol.</param>
 /// <param name="friendlyName">Friendly name of URL protocol.</param>
 /// <param name="handler">Delegate that uses as protocol handler for processing requested urls.</param>
 public void RegisterProtocolHandler(string protocol, string friendlyName, ProtocolHandlerCallback handler)
 {
     CheckParameters(protocol, friendlyName, handler);
     lock ( _handlers )
     {
         _handlers[protocol] = new ProtocolHandler(protocol, friendlyName, handler);
         SaveProtocolSettings(protocol, friendlyName, Default.NoChanges);
     }
 }
Exemplo n.º 3
0
 private static void CheckParameters(string protocol, string friendlyName, ProtocolHandlerCallback handler)
 {
     Guard.NullArgument(protocol, "protocol");
     Guard.NullArgument(friendlyName, "friendlyName");
     Guard.NullArgument(handler, "handler");
     if (protocol.Length == 0)
     {
         throw new ArgumentException("Zero length for protocol name", "protocol");
     }
     if (protocol.IndexOf(':') != -1)
     {
         throw new ArgumentException("Protocol name must not include ':' symbol", "protocol");
     }
 }
Exemplo n.º 4
0
 public MockPlugin()
 {
     Callback              = ProtocolHandler;
     MakeDefaultCallback   = MakeDefault;
     CallbackWithException = ProtocolHandlerWithException;
 }
Exemplo n.º 5
0
 public ProtocolHandler(string protocol, string friendlyName, ProtocolHandlerCallback handler)
 {
     _protocol     = protocol;
     _friendlyName = friendlyName;
     _handler      = handler;
 }