コード例 #1
0
ファイル: EngineProtocol.cs プロジェクト: ChrisMoreton/Test3
    //[EnvironmentPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)]
    public bool Connect(String engineName)
    {
      if (serviceGraphic.PortInfoRequested != null) // An engine is already connected.
        return false;

      try
      {
        serviceGraphic = Activator.GetObject(typeof(BaseProtocol), url.ToString()) as EngineServiceProtocol;

        Name = serviceGraphic.Name; // Force a test of the connection.

        serviceGraphicPortInfoRequestedHandler = new EngineServiceProtocol.PortInfoRequestedHandler(ServiceGraphicPortInfoRequested);

        serviceGraphic.PortInfoRequested = serviceGraphicPortInfoRequestedHandler;

        Syncxxx();

        this.engineName = Announce(engineName);

        connectionError = "";
        return true;
      }

      catch (System.Runtime.Remoting.RemotingException remotingException)
      {
        connectionError = remotingException.Message;
        return false;
      }
    }
コード例 #2
0
        //[EnvironmentPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)]
        public bool Connect(String engineName)
        {
            if (serviceGraphic.PortInfoRequested != null) // An engine is already connected.
            {
                return(false);
            }

            try
            {
                serviceGraphic = Activator.GetObject(typeof(BaseProtocol), url.ToString()) as EngineServiceProtocol;

                Name = serviceGraphic.Name; // Force a test of the connection.

                serviceGraphicPortInfoRequestedHandler = new EngineServiceProtocol.PortInfoRequestedHandler(ServiceGraphicPortInfoRequested);

                serviceGraphic.PortInfoRequested = serviceGraphicPortInfoRequestedHandler;

                Syncxxx();

                this.engineName = Announce(engineName);

                connectionError = "";
                return(true);
            }

            catch (System.Runtime.Remoting.RemotingException remotingException)
            {
                connectionError = remotingException.Message;
                return(false);
            }
        }
コード例 #3
0
        public bool TestUrl(Uri url)
        {
            try
            {
                serviceGraphic = Activator.GetObject(typeof(BaseProtocol), url.ToString()) as EngineServiceProtocol;

                Name = serviceGraphic.Name; // Force a test of the connection.

                this.url        = url;
                connectionError = "";
                return(true);
            }

            catch (System.Runtime.Remoting.RemotingException remotingException)
            {
                url             = null;
                connectionError = remotingException.Message;
                return(false);
            }
        }
コード例 #4
0
ファイル: EngineProtocol.cs プロジェクト: ChrisMoreton/Test3
    public bool TestUrl(Uri url)
    {

      try
      {
        serviceGraphic = Activator.GetObject(typeof(BaseProtocol), url.ToString()) as EngineServiceProtocol;

        Name = serviceGraphic.Name; // Force a test of the connection.

        this.url = url;
        connectionError = "";
        return true;
      }

      catch (System.Runtime.Remoting.RemotingException remotingException)
      {
        url = null;
        connectionError = remotingException.Message;
        return false;
      }
    }
コード例 #5
0
ファイル: Project.cs プロジェクト: ChrisMoreton/Test3
    internal void ConnectClientServiceProtocol()
      {
      ClientServiceProtocol.LoadHandler clientLoad = new ClientServiceProtocol.LoadHandler(LoadGraphics);
      ClientServiceProtocol.SaveHandler clientSave = new ClientServiceProtocol.SaveHandler(SaveGraphics);
      ClientServiceProtocol.SaveAsHandler clientSaveAs = new ClientServiceProtocol.SaveAsHandler(SaveAsGraphics);

      ClientServiceProtocol.ChangePermissionsHandler clientChangePermissions = new ClientServiceProtocol.ChangePermissionsHandler(ChangePermissions);

      ClientServiceProtocol.GetPropertyValuesHandler clientGetPropertyValues = new ClientServiceProtocol.GetPropertyValuesHandler(GetPropertyValues);
      ClientServiceProtocol.GetSubTagsHandler clientGetSubTags = new ClientServiceProtocol.GetSubTagsHandler(GetSubTags);

      ClientServiceProtocol.ChangeHandler clientChange = new ClientServiceProtocol.ChangeHandler(Change);

      ClientServiceProtocol.RequestPortInfoHandler clientRequestPortInfo = new ClientServiceProtocol.RequestPortInfoHandler(ClientRequestPortInfo);

      ClientServiceProtocol.PropertyListHandler clientPropertyListCheck = new ClientServiceProtocol.PropertyListHandler(PropertyListCheck);

      ClientServiceProtocol.LogMessageHandler clientLogMessage = new ClientServiceProtocol.LogMessageHandler(LogMessage);

      ClientServiceProtocol.AnnounceHandler clientAnnounce = new ClientServiceProtocol.AnnounceHandler(ClientAnnounce);
      ClientServiceProtocol.RenounceHandler clientRenounce = new ClientServiceProtocol.RenounceHandler(ClientRenounce);

      clientClientServiceProtocol = new ClientServiceProtocol(name,
                                                              path,
                                                              clientLoad,
                                                              clientSave,
                                                              clientSaveAs,
                                                              graphic,
                                                              model,
                                                              clientChangePermissions,
                                                              clientGetPropertyValues,
                                                              clientGetSubTags,
                                                              clientChange,
                                                              clientRequestPortInfo,
                                                              clientPropertyListCheck,
                                                              clientLogMessage,
                                                              clientAnnounce,
                                                              clientRenounce);

      RemotingServices.Marshal(clientClientServiceProtocol, "Client/" + Name);


      EngineServiceProtocol.LogMessageHandler engineLogMessage = new EngineServiceProtocol.LogMessageHandler(LogMessage);
      EngineServiceProtocol.StateChangedHandler engineStateChanged = new EngineServiceProtocol.StateChangedHandler(StateChanged);
      EngineServiceProtocol.RequestPortInfoHandler engineRequestPortInfo = new EngineServiceProtocol.RequestPortInfoHandler(EngineRequestPortInfo);

      EngineServiceProtocol.AnnounceHandler engineAnnounce = new EngineServiceProtocol.AnnounceHandler(EngineAnnounce);
      EngineServiceProtocol.RenounceHandler engineRenounce = new EngineServiceProtocol.RenounceHandler(EngineRenounce);

      engineClientServiceProtocol = new EngineServiceProtocol(name,
                                                              path,
                                                              graphic,
                                                              model,
                                                              engineLogMessage,
                                                              engineStateChanged,
                                                              engineRequestPortInfo,
                                                              engineAnnounce,
                                                              engineRenounce);

      RemotingServices.Marshal(engineClientServiceProtocol, "Engine/" + Name);
      }