public ServiceTemporaryWindow(string stencilPath, Dictionary<string, Project> projects, string lastFolder)
    {
      this.lastFolder = lastFolder;

      InitializeComponent();

      addProjectButton.Focus();

      this.Text = "SysCAD.Service (" + Assembly.Load("SysCAD.Service").GetName().Version + ") -- SVN Revision: " + SysCAD.SVNVersion.SVNVersion.version;

      Config config = new Config();
      if (!ServiceConnectCheck(config)) // If service not already there.
      {
        System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
        serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

        BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();

        Hashtable ipcProps = new Hashtable();
        ipcProps["portName"] = "SysCAD.Service";
        ipcProps["exclusiveAddressUse"] = false;
        //ipcProps["typeFilterLevel"] = TypeFilterLevel.Full;
        IpcChannel ipcChannel = new IpcChannel(ipcProps, clientProv, serverProv);
        ChannelServices.RegisterChannel(ipcChannel, false);

        logView.LogFile = System.IO.Path.GetTempPath() + "test.log";

        Config.AddProjectHandler addProjectHandler = new Config.AddProjectHandler(AddProject);
        Config.AddProjectAnywayHandler addProjectAnywayHandler = new Config.AddProjectAnywayHandler(AddProjectAnyway);
        configData = new ConfigData();
        configData.Setup(stencilPath, addProjectHandler, addProjectAnywayHandler);

        RemotingServices.Marshal(configData, "Global");

        Dictionary<string, Project> tempProjects = projects;
        
        foreach (Project project in tempProjects.Values)
        {
          AddProject(project);
        }

        this.projects = projects;
      }
    }
Beispiel #2
0
 public bool TestUrl(Uri url)
 {
   try
   {
     remoteConfig = Activator.GetObject(typeof(ConfigData), url.ToString()) as ConfigData;
     StringCollection test = remoteConfig.ProjectList; // Check that the connection is up.
     return (remoteConfig != null);
   }
   catch (System.Runtime.Remoting.RemotingException remotingException)
   {
     String connectionError = remotingException.Message;
     return false;
   }
 }
Beispiel #3
0
  public void Startup(string filename, string baseCfgFiles)
  {
    this.filename = filename;
    this.baseCfgFiles = baseCfgFiles;

    LogNote("CNETServerThread", 0, "Startup");

    m_Config = new ConfigData();
    m_StencilPath = baseCfgFiles;
    m_StencilPath = m_StencilPath + "Stencils\\";

    //m_pUnmanaged = new CNETServerU;

    //m_pUnmanaged.Startup();

    Console.WriteLine("Startup");
    CreateConnects();
    GetStencils();
    MarshalServiceInterface(filename);
    MarshalConfig();

    LoadItems();
  }