Exemplo n.º 1
0
        /*private string CreateFolderPath(IMediaFileFolder folder)
         * {
         *  string folderName = this.GetBinding<string>("FolderName");
         *
         *  string folderPath = folder.Path;
         *
         *  if (folderPath == "/")
         *  {
         *      folderPath = folderPath + folderName;
         *  }
         *  else
         *  {
         *      folderPath = folderPath + "/" + folderName;
         *  }
         *
         *  folderPath = folderPath.Replace('\\', '/');
         *  while (folderPath.Contains("//"))
         *  {
         *      folderPath.Replace("//", "/");
         *  }
         *
         *  if ((folderPath != "/") && (folderPath.StartsWith("/")))
         *  {
         *      folderPath.Remove(0, 1);
         *  }
         *
         *  return folderPath;
         * }*/


        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);

            IMediaFileFolder folder       = this.GetBinding <IMediaFileFolder>("NewFolder");
            string           folderName   = this.GetBinding <string>("FolderName");
            string           providerName = this.GetBinding <string>("ProviderName");

            string folderPath = folder.CreateFolderPath(folderName);

            folder.Path = folderPath;

            if (folder.Title == string.Empty)
            {
                folder.Title = folderPath.GetFolderName('/');
            }

            CreateParentFolder(folder.GetParentFolderPath(), providerName);

            folder = DataFacade.AddNew <IMediaFileFolder>(folder, providerName);

            addNewTreeRefresher.PostRefreshMesseges(folder.GetDataEntityToken());

            SelectElement(folder.GetDataEntityToken());
        }
        private void saveCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken);

            IMediaFileFolder folder = this.GetDataItemFromEntityToken <IMediaFileFolder>();

            folder.Path        = CreateFolderPath();
            folder.Title       = this.GetBinding <string>("FolderTitle");
            folder.Description = this.GetBinding <string>("FolderDescription");

            DataFacade.Update(folder);

            SetSaveStatus(true);

            updateTreeRefresher.PostRefreshMesseges(folder.GetDataEntityToken());
        }