Наследование: System.EventArgs
Пример #1
0
 private static void OnServiceAdded (object o, ServiceInfoArgs args)
 {
     // Console.WriteLine ("Got service: " + info.Name);
     ServiceResolver resolver = new ServiceResolver (client, args.Service);
     objects.Add (resolver);
     resolver.Found += OnServiceResolved;
 }
Пример #2
0
        private void OnServiceRemoved(object o, AV.ServiceInfoArgs args)
        {
            ServiceBrowseEventHandler handler = ServiceRemoved;

            if (handler != null)
            {
                handler(this, new ServiceBrowseEventArgs(new ResolvableService(client, args.Service)));
            }
        }
Пример #3
0
        private void OnServiceResolved(object o, AV.ServiceInfoArgs args)
        {
            service = args.Service;
            ((AV.ServiceResolver)o).Dispose();

            ServiceResolvedEventHandler handler = Resolved;

            if (handler != null)
            {
                handler(this, new ServiceResolvedEventArgs(this));
            }
        }
Пример #4
0
                private void OnServiceAdded (object o, ServiceInfoArgs args)
                {
			// Ignore local services
                        if ((args.Service.Flags & LookupResultFlags.Local) > 0)
                                return;
                        
                        resolver = new ServiceResolver (avahi_client, args.Service);
                        resolver.Found += OnServiceResolved;
                        resolver.Timeout += OnServiceTimeout;
                }
Пример #5
0
                private void OnServiceRemoved (object sender, ServiceInfoArgs args)
                {
			foreach (NetworkService service in services) {
				if (service.Name != args.Service.Name)
					continue;
                        
                                services.Remove (service);
			                        
				AvahiEventArgs event_args = new AvahiEventArgs (service);
				
				if (HostRemoved != null)
					HostRemoved (this, event_args);

				return;
			}
                }
Пример #6
0
                private void OnServiceResolved (object o, ServiceInfoArgs args)
                {
			NetworkService service = ParseServiceInfo (args.Service);
                        services.Add (service);

                        AvahiEventArgs event_args = new AvahiEventArgs (service);

                        if (HostFound != null)
                                HostFound (null, event_args);
                        
			((ServiceResolver)o).Dispose ();
                }
Пример #7
0
        void OnServiceResolved(object o, ServiceInfoArgs args)
        {
            ConnectionData cd = new ConnectionData ();
            cd.Name = String.Format ("{0} ({1})", args.Service.Name, args.Service.Address);
            cd.Host = args.Service.Address.ToString ();
            cd.Port = args.Service.Port;
            cd.UserName = "";
            cd.Pass = "";
            cd.DontSavePassword = false;
            cd.ServerType = Util.GetServerType ("Generic LDAP server");
            cd.Dynamic = true;

            Log.Debug ("Found LDAP service {0} on {1} port {2}",
                args.Service.Name, args.Service.Address, args.Service.Port);

            if (args.Service.Port == 636)
                cd.Encryption = EncryptionType.SSL;

            Connection conn = new Connection (cd);

            if (Found != null) {
                FoundServiceEventArgs fargs = new FoundServiceEventArgs ();
                fargs.FoundConnection = conn;
                Found (this, fargs);
            }
        }
Пример #8
0
        void OnServiceRemoved(object o, ServiceInfoArgs args)
        {
            if (Removed == null)
                return;

            RemovedServiceEventArgs rargs = new RemovedServiceEventArgs ();
            rargs.ConnectionName = String.Format ("{0} ({1})", args.Service.Name, args.Service.Address);
            Removed (this, rargs);
        }
Пример #9
0
 void OnServiceAdded(object o, ServiceInfoArgs args)
 {
     ServiceResolver resolver = new ServiceResolver (client, args.Service);
     resolver.Found += OnServiceResolved;
 }
Пример #10
0
    private static void OnServiceResolved(object o, ServiceInfoArgs args)
    {
        objects.Remove (o);

        Console.WriteLine ("Service '{0}' at {1}:{2}", args.Service.Name, args.Service.HostName, args.Service.Port);
        foreach (byte[] bytes in args.Service.Text) {
            Console.WriteLine ("Text: " + Encoding.UTF8.GetString (bytes));
        }

        AddressResolver ar = new AddressResolver (client, args.Service.Address);
        objects.Add (ar);

        ar.Found += OnAddressResolved;
        ar.Failed += OnAddressResolverFailed;
    }