Esempio n. 1
0
    private string GetAttachmentImageDirectoryCommandHandler() {
      string position = GetCommandParameter("position", true);
      string folderName = GetCommandParameter("name", false, String.Empty);

      int currentPosition = int.Parse(GetCommandParameter("currentPosition", true));

      int recordingId = int.Parse(GetCommandParameter("recordingId", false, "0"));

      Recording recording = Recording.Parse(recordingId);
      if (currentPosition == -1) {
        currentPosition = 0;
      }
      RecordingAttachmentFolder folder = recording.GetAttachementFolder(folderName);

      if (!EmpiriaString.IsInteger(position)) {
        switch (position) {
          case "first":
            return folder.GetImageURL(0);
          case "previous":
            return folder.GetImageURL(Math.Max(currentPosition - 1, 0));
          case "next":
            return folder.GetImageURL(Math.Min(currentPosition + 1, folder.FilesCount - 1));
          case "last":
            return folder.GetImageURL(folder.FilesCount - 1);
          case "refresh":
            return folder.GetImageURL(currentPosition);
          default:
            return folder.GetImageURL(currentPosition);
        }
      } else {
        return folder.GetImageURL(int.Parse(position));
      }
    }
Esempio n. 2
0
    private string GetAttachmentImageCountCommandHandler() {
      int recordingId = int.Parse(GetCommandParameter("recordingId", false, "0"));
      string folderName = GetCommandParameter("name", false, String.Empty);

      Recording recording = Recording.Parse(recordingId);

      RecordingAttachmentFolder folder = recording.GetAttachementFolder(folderName);

      return folder.FilesCount.ToString();
    }