Beispiel #1
0
    public Project(string name, string path)
      {
      this.name = name;
      this.path = path;

      graphic = new Graphic();
      model = new Model();
      }
    public EngineServiceProtocol(String name, String path,
      Graphic graphic, Model model,
      LogMessageHandler logMessageHandler, StateChangedHandler stateChangedHandler, RequestPortInfoHandler requestPortInfoHandler,
      AnnounceHandler announceHandler, RenounceHandler renounceHandler)
    {
      this.Name = name;
      this.Path = path;

      this.graphic = graphic;
      this.model = model;

      this.logMessageHandler = logMessageHandler;
      this.stateChangedHandler = stateChangedHandler;
      this.requestPortInfoHandler = requestPortInfoHandler;

      this.announceHandler = announceHandler;
      this.renounceHandler = renounceHandler;
    }
    public ClientServiceProtocol(String name,
      String path,
      LoadHandler loadHandler,
      SaveHandler saveHandler,
      SaveAsHandler saveAsHandler,
      Graphic graphic,
      Model model,
      ChangePermissionsHandler clientChangePermissions, 
      GetPropertyValuesHandler getPropertyValuesHandler, 
      GetSubTagsHandler getSubTagsHandler,
      ChangeHandler changeHandler,
      RequestPortInfoHandler requestPortInfoHandler,
      PropertyListHandler propertyListHandler, 
      LogMessageHandler logMessageHandler,
      AnnounceHandler announceHandler, 
      RenounceHandler renounceHandler)
    {
      this.Name = name;
      this.Path = path;

      this.graphic = graphic;
      this.model = model;

      this.loadHandler = loadHandler;
      this.saveHandler = saveHandler;
      this.saveAsHandler = saveAsHandler;

      this.clientChangePermissions = clientChangePermissions;

      this.getPropertyValuesHandler = getPropertyValuesHandler;
      this.getSubTagsHandler = getSubTagsHandler;

      this.changeHandler = changeHandler;

      this.requestPortInfoHandler = requestPortInfoHandler;

      this.propertyListHandler = propertyListHandler;

      this.logMessageHandler = logMessageHandler;

      this.announceHandler = announceHandler;
      this.renounceHandler = renounceHandler;
    }
Beispiel #4
0
  bool ModifyItem(ServiceProtocol serviceProtocol, Int64 requestID, Guid guid, String tag, String path, Model model, Shape stencil, RectangleF boundingRect, Single angle, System.Drawing.Color fillColor, System.Drawing.Drawing2D.FillMode fillMode, bool mirrorX, bool mirrorY)
  {
    if (true) // Decide whether to modify an item.
    { // We're going to do it.

      // Modify the item.

      // Need to get hold of a valid pDoc pointer... *********

      //Individual changes would go something like this: *********
      //int length = tag.Length;
      //wchar_t * tagwc = (wchar_t*)(void*)Marshal.StringToHGlobalUni(tag);

      //char * tagc = (char *)malloc(length+1);
      //tagc[length] = 0;
      //for (int i=0; i<length; i++)
      //  tagc[i] = (char)tagwc[i];

      //pDoc.GCB.DoModify(tagc, 
      //                    angle,
      //                    boundingRect, 
      //                    fillColor,
      //                    fillMode,
      //                    mirrorX,
      //                    mirrorY);

      // Raise event(s).
      serviceProtocol.DoItemModified(requestID, guid, tag, path, model, stencil, boundingRect, angle, fillColor, fillMode, mirrorX, mirrorY);

      return true;
    }
    else
    { // We're not going to do it.
      return false;
    }
  }
Beispiel #5
0
  bool CreateItem(ServiceProtocol serviceProtocol, Int64 requestID, Guid guid, String tag, String path, Model model, Shape stencil, RectangleF boundingRect, Single angle, System.Drawing.Color fillColor, System.Drawing.Drawing2D.FillMode fillMode, bool mirrorX, bool mirrorY)
  {
    // Need to check for runstate here, and decide if we'll fire DoItemCreated.
    // This is required in case a rogue client tries to create an item even when not supposed to.
    // This applies to all three create*, and all three delete* events.
    if (true) // Decide whether to create an item.
    { // We're going to do it.
      // Create the item.

      // Raise event(s).
      serviceProtocol.DoItemCreated(requestID, guid, tag, path, model, stencil, boundingRect, angle, fillColor, fillMode, mirrorX, mirrorY);

      return true;
    }
    else
    { // We're not going to do it.
      return false;
    }
  }
Beispiel #6
0
    public bool LoadGraphics(out Int64 requestId)
      {
      this.requestId++;
      requestId = this.requestId;

      try
        {
          {
          BinaryFormatter bf = new BinaryFormatter();
          StreamReader streamRdr = new StreamReader(path + "\\Graphic.10");
          Stream stream = streamRdr.BaseStream;
          graphic = (Graphic)bf.Deserialize(stream);
          stream.Close();
          }

            {
            BinaryFormatter bf = new BinaryFormatter();
            StreamReader streamRdr = new StreamReader(path + "\\Model.10");
            Stream stream = streamRdr.BaseStream;
            model = (Model)bf.Deserialize(stream);
            stream.Close();
            }

            if (graphic == null) graphic = new Graphic();
            if (model == null) model = new Model();

            return true;
        }
      catch (Exception)
        {
        if (graphic == null)
          {
          graphic = new Graphic();
          LogMessage(out requestId, "LoadGraphics: Graphic.10 file not found or corrupt for project " + name + ".  Creating empty one.", MessageType.Error);
          }

        if (model == null)
          {
          model = new Model();
          LogMessage(out requestId, "LoadGraphics: Model.10 file not found or corrupt for project " + name + ".  Creating empty one.", MessageType.Error);
          }

        return false;
        }
      }