Exemplo n.º 1
0
 internal void PermissionsChanged(ClientBaseProtocol.Permissions permissions)
 {
   this.permissions = permissions;
 }
Exemplo n.º 2
0
    public bool StateChanged(out Int64 requestId, EngineBaseProtocol.RunState runState)
      {
      this.requestId++;
      requestId = this.requestId;

      ClientBaseProtocol.Permissions permissions = null;
      switch (runState)
        {
        case EngineBaseProtocol.RunState.Edit:
          permissions = new ClientBaseProtocol.Permissions(true, true, true);
          break;
        case EngineBaseProtocol.RunState.Idle:
          permissions = new ClientBaseProtocol.Permissions(false, true, false);
          break;
        case EngineBaseProtocol.RunState.Run:
          permissions = new ClientBaseProtocol.Permissions(false, true, false);
          break;
        }

      eventId++;
      clientClientServiceProtocol.PermissionsChanged(eventId, requestId, permissions);
      return true;
      }
Exemplo n.º 3
0
    public void SetButtonStates()
    {
      if (InvokeRequired)
      {
        BeginInvoke(new SetButtonStatesDelegate(SetButtonStates));
      }
      else
      {
        bool projectOpen = false;
        ClientBaseProtocol.Permissions permissions = new ClientBaseProtocol.Permissions(false, false, false);

        if (frmFlowChart != null)
        {
          projectOpen = frmFlowChart.State.ProjectAttached;
          permissions = frmFlowChart.State.Permissions;

          // Uncomment to enable create/modify always.
          //permissions.Create = true;
          //permissions.Modify = true;
        }

        barManager1.Commands["File.PrintPreview"].Enabled = projectOpen;
        barManager1.Commands["File.Print"].Enabled = projectOpen;
        barManager1.Commands["File.Save"].Enabled = projectOpen;
        barManager1.Commands["File.Close"].Enabled = projectOpen;
        barManager1.Commands["View.ZoomIn"].Enabled = projectOpen;
        barManager1.Commands["View.ZoomOut"].Enabled = projectOpen;
        barManager1.Commands["View.ZoomToVisible"].Enabled = projectOpen;
        barManager1.Commands["View.ZoomToSelected"].Enabled = projectOpen;
        barManager1.Commands["View.ShowAreas"].Enabled = projectOpen;
        barManager1.Commands["View.ShowModels"].Enabled = projectOpen;
        barManager1.Commands["View.ShowGraphics"].Enabled = projectOpen;
        barManager1.Commands["View.ShowLinks"].Enabled = projectOpen;
        barManager1.Commands["View.ShowTags"].Enabled = projectOpen;
        barManager1.Commands["Tools.Unlock(Demo)"].Enabled = projectOpen;
        barManager1.Commands["Selection.SelectItems"].Enabled = projectOpen;
        barManager1.Commands["Selection.SelectLinks"].Enabled = projectOpen;
        barManager1.Commands["Mode.Modify"].Enabled = projectOpen && permissions.Modify;

        barManager1.Commands["Mode.CreateLink"].Enabled = projectOpen && permissions.Create;
        stencilChooser1.Enabled = projectOpen && permissions.Create;

        barManager1.Commands["Edit.Cut"].Enabled = projectOpen && permissions.Delete;
        barManager1.Commands["Edit.Copy"].Enabled = projectOpen;
        barManager1.Commands["Edit.Delete"].Enabled = projectOpen;
        barManager1.Commands["Edit.Paste"].Enabled = projectOpen && permissions.Create;

        barManager1.Commands["Edit.Undo"].Enabled = projectOpen && frmFlowChart.State.ClientProtocol.UndoAvailable;
        barManager1.Commands["Edit.Redo"].Enabled = projectOpen && frmFlowChart.State.ClientProtocol.RedoAvailable;

        if (frmFlowChart != null)
        {
          frmFlowChart.State.SelectItems = true;
          frmFlowChart.State.SelectLinks = false;
        }

        ((IBarCheckableCommand)barManager1.Commands["Selection.SelectItems"]).Checked = true;
        ((IBarCheckableCommand)barManager1.Commands["Selection.SelectLinks"]).Checked = false;
      }
    }