Ejemplo n.º 1
0
        /// <summary>
        /// Saves the Task with a new name.  The task with the old name continues to
        /// exist in whatever state it was last saved.  It is no longer open, because.
        /// the Task object is associated with the new name from now on.
        /// If there is already a task using the new name, it is overwritten.
        /// </summary>
        /// <remarks>See the <see cref="Save()"/>() overload.</remarks>
        /// <param name="name">The new name to be used for this task.</param>
        /// <exception cref="COMException">Unable to establish existence of the account specified.</exception>
        public void Save(string name)
        {
            IPersistFile iFile = (IPersistFile)iTask;
            string       path;

            iFile.GetCurFile(out path);
            string newPath;

            newPath = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + name + Path.GetExtension(path);
            iFile.Save(newPath, true);
            iFile.SaveCompleted(newPath);           /* probably unnecessary */
            this.name = name;
            SetHiddenFileAttr(Hidden);              //Do the Task Scheduler's work for it because it doesn't reset properly
        }