public HomeProjectRow(Project project, Home parentHomeControl)
 {
     InitializeComponent();
     tbl_Name.Text = project.Name;
     CurrentProject = project;
     ParentHomeControl = parentHomeControl;
 }
 public ProjectFile(string fileTitle, string filename, bool isFile, string programToOpen, Project parentProject)
 {
     FileTitle = fileTitle;
     ChangeFile(filename, isFile);
     ProgramToOpen = programToOpen;
     ParentProject = parentProject;
 }
 public ProjectLog(int id, DateTime start, DateTime end, string description, Project parentProject)
 {
     Id = id;
     Start = start;
     End = end;
     Description = description;
     ParentProject = parentProject;
 }
 private void groupAssignmentToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (pjt == null)
         return;
     AddGroup F = new AddGroup(pjt);
     F.ShowDialog();
     pjt = F.pjt;
     pjt.Save();
     F.Dispose();
 }
        /// <summary>
        /// Creates a new project with the given name.
        /// </summary>
        /// <param name="projectName">The name of the new project.</param>
        /// <returns>The new project.</returns>
        public static Project CreateNewProject(string projectName)
        {
            // Get the project's new id and create it
            int projectId = ProjectFileInterface.RequestProjectId();
            Project newProject = new Project(projectId, projectName);
            ProjectFileInterface.CreateFilesForProject(newProject, false);

            // Add a reference to the new project and return
            Projects.Add(newProject);
            return newProject;
        }
        /// <summary>
        /// Base constructor for all options.
        /// </summary>
        private SummaryRow(string title, TimeSpan time, Project project, ProjectLog log)
        {
            InitializeComponent();
            tbl_Name.Text = title;

            Time = time;
            SetTime();

            CurrProject = project;
            CurrLog = log;
        }
Exemple #7
0
 public AddGroup(Project J)
 {
     InitializeComponent();
     pjt = J;
     foreach (AnimalType A in pjt.Animals)
     {
         AnimalList.Items.Add(A.ID);
     }
     UpdateGroupList();
     AnimalList.SelectedIndex = 0;
 }
        public EditProjectDialog(Project currentProject)
        {
            InitializeComponent();

            // Fill out the textblock with the current name
            tb_ProjectName.Text = currentProject.Name;

            // Set the caller action flags
            DeleteProject = false;
            RefreshProjectNameOnUI = false;

            // Set the other data
            CurrentProject = currentProject;
            defaultProjectName = currentProject.Name;
        }
        public ProjectMenu(Project project)
        {
            InitializeComponent();
            CurrentProject = project;
            tbl_Title.Text = project.Name;

            // Update the UI
            RefreshLogsOnUI();
            RefreshFilesOnUI();

            // Make the title realign everytime it's changed
            DependencyPropertyDescriptor dp = DependencyPropertyDescriptor.FromProperty(TextBlock.ActualWidthProperty, typeof(TextBlock));
            dp.AddValueChanged(tbl_Title, (object sender, EventArgs e) =>
            {
                SetIdealTitleAlignment();
            });
        }
Exemple #10
0
 public Calendar(Project P)
 {
     InitializeComponent();
     D = DateTime.Now;
     B = new Bitmap(panel1.Width,panel1.Height);
     g = Graphics.FromImage(B);
     panel1.BackgroundImage = B;
     DW = panel1.Width / 7;
     DaysShown = panel1.Height / DW;
     N = DateTime.Now;
     N = N.AddDays(-1 * (int)N.DayOfWeek);
     pjt = P;
     string[] A = pjt.Get_Animals();
     for (int i = 0; i < A.Length; i++)
     {
         AnimalSel.Items.Add(A[i]);
     }
     AnimalSel.SelectedIndex = 0;
 }
        /// <summary>
        /// Parses the projects list file and builds a list of Project instances.
        /// </summary>
        /// <returns>The list of projects.</returns>
        public static List<Project> GetProjectListFromFile()
        {
            List<Project> projects = new List<Project>();

            // Get the non-empty and non-comment lines from the projects file
            List<string> projectRows = GetNonEmptyAndNonCommentLinesFromFile(fullProjectListFilename);

            // Parse the remaining lines
            foreach (var line in projectRows)
            {
                // Ensure that the line has the correct format
                string[] lineItems = line.Split('|');
                int numberOfItems = 2;
                if (lineItems.Length != numberOfItems)
                {
                    ErrorLogger.AddLog(string.Format("Could not parse line '{0}'. Skipping entry.", line), ErrorSeverity.HIGH);
                    continue;
                }

                // Ensure that the first part is a valid id
                int projectId;
                int minId = 0;
                bool parseIdSuccess = int.TryParse(lineItems[0], out projectId);
                if (!parseIdSuccess || projectId < minId)
                {
                    ErrorLogger.AddLog(string.Format("Could not parse project id '{0}'. Skipping entry.", lineItems[0]), ErrorSeverity.HIGH);
                    continue;
                }

                // Ensure that the second part is a valid project name
                string projectName = lineItems[1];
                if (projectName == "")
                {
                    ErrorLogger.AddLog(string.Format("Invalid project name '{0}'. Skipping entry.", lineItems[1]), ErrorSeverity.HIGH);
                    continue;
                }

                // If we got here, we have valid project info, so create an instance
                Project project = new Project(projectId, projectName);

                // Update the highest id fields if necessary
                highestProjectIdInUse = Math.Max(highestProjectIdInUse, projectId);
                highestLogIdsInUse[projectId] = -1;

                // Fill the instance out with the logs
                Tuple<List<ProjectLog>, ProjectLog> projectLogs = GetLogsForProjectFromFile(project);
                project.CompletedLogs = projectLogs.Item1;
                project.IncompleteLog = projectLogs.Item2;

                // Fill the instance with the files
                project.Files = GetFilesForProjectFromFile(project);

                // Add the reference
                projects.Add(project);
            }

            return projects;
        }
        /// <summary>
        /// Writes the given project's files to its files file.
        /// </summary>
        /// <param name="project">The project whose files to write.</param>
        public static void WriteProjectFilesToFile(Project project)
        {
            // Build the file text
            StringBuilder fileText = new StringBuilder();
            fileText.Append(string.Format(projectFilesFileTemplate, project.Name, project.Id));

            // Add the files
            foreach (var file in project.Files)
            {
                fileText.Append(string.Format(projectFileFileRow,
                    file.FileTitle,
                    file.Filename,
                    file.IsFile ? "true" : "false",
                    file.ProgramToOpen != null ? file.ProgramToOpen : ""));
            }

            // Get the filename
            string filesFilename = GetFileNameForProject(project, FileType.FILES);

            // Attempt to write the file
            try
            {
                File.WriteAllText(filesFilename, fileText.ToString());
            }
            catch (IOException e)
            {
                ErrorLogger.AddLog(string.Format("Could not write to project '{0}' files file:\n{1}\n\nProject Files:\n{2}",
                    project.Name, e.Message, fileText.ToString()), ErrorSeverity.HIGH);
            }
        }
 public HideProjectRow(Project project)
 {
     InitializeComponent();
     tbl_Name.Text = project.Name;
     CurrProject = project;
 }
        /// <summary>
        /// Writes the given project's logs to its log file.
        /// </summary>
        /// <param name="project">The project whose logs to write.</param>
        public static void WriteProjectLogsToFile(Project project)
        {
            // Build the file text
            StringBuilder fileText = new StringBuilder();
            fileText.Append(string.Format(projectLogsFileTemplate, project.Name, project.Id));

            // Add the incomplete entry if necessary
            if (project.IncompleteLog != null)
            {
                fileText.Append(incomplete + "\n");
                fileText.Append(string.Format(projectLogFileRow,
                    project.IncompleteLog.Id,
                    project.IncompleteLog.Start.ToString(),
                    "",
                    project.IncompleteLog.Description));
                fileText.Append("\n");
            }

            // Add all complete entries
            fileText.Append(complete + "\n");
            foreach (var entry in project.CompletedLogs)
            {
                fileText.Append(string.Format(projectLogFileRow,
                    entry.Id,
                    entry.Start.ToString(),
                    entry.End.ToString(),
                    entry.Description));
            }

            // Get the filename
            string logsFilename = GetFileNameForProject(project, FileType.LOGS);

            // Attempt to write the file
            try
            {
                File.WriteAllText(logsFilename, fileText.ToString());
            }
            catch (IOException e)
            {
                ErrorLogger.AddLog(string.Format("Could not write to project '{0}' log:\n{1}\n\nProject Logs:\n{2}", project.Name, e.Message, fileText.ToString()), ErrorSeverity.HIGH);
            }
        }
 public ProjectLog(int id, DateTime start, string description, Project parentProject)
     : this(id, start, DateTime.MaxValue, description, parentProject)
 {
 }
Exemple #16
0
 public Exporter(Project p)
 {
     InitializeComponent();
     pjt = p;
 }
Exemple #17
0
 //открытие формы с информацией о выбранном проекте (задачи, пользователи)
 private void openTaskForm(Project choosenProject)
 {
     new TasksForm(choosenProject).Show();
 }
Exemple #18
0
        public void OpenProject(String appname)
        {
            resourceManager = new ResourceManager();

            Project newProject = new Project();

            newProject.Load(appname);

            String ResourcePath = newProject.GetResourcePath();

            resourceManager.loadResource(ResourcePath);

            CurrentProject = newProject;
        }
Exemple #19
0
 public void CloseProject()
 {
     CurrentProject = null;
 }
 //-------------------//
 // File Name Methods //
 //-------------------//
 /// <summary>
 /// Returns the filename of the given type for the given project. Will throw an ArgumentException
 /// if the FileType is not recognized.
 /// </summary>
 /// <param name="project">The project whose file to return.</param>
 /// <param name="fileType">The type of file to return.</param>
 /// <returns>The filename.</returns>
 private static string GetFileNameForProject(Project project, FileType fileType)
 {
     return GetFileNameForProject(project.Name, project.Id, fileType);
 }
        /// <summary>
        /// Updates the project logs, notes, and files filenames. This should be called right after the project name changes.
        /// </summary>
        /// <param name="project">The project (with its new name).</param>
        /// <param name="oldName">The project's old name.</param>
        public static void UpdateFilenamesForNewProjectName(Project project, string oldName)
        {
            // Make sure we have actually changed names
            if (oldName == project.Name)
            {
                ErrorLogger.AddLog(string.Format("No file update necessary; project '{0}' has not changed names.", oldName), ErrorSeverity.WARNING);
                return;
            }

            // Get the names for the old files
            string oldNotesFilename = GetFileNameForProject(oldName, project.Id, FileType.NOTES);
            string oldLogsFilename = GetFileNameForProject(oldName, project.Id, FileType.LOGS);
            string oldFilesFilename = GetFileNameForProject(oldName, project.Id, FileType.FILES);

            // Get the old notes and ready them for the new notes file
            StringBuilder notesText = new StringBuilder();
            try
            {
                // Form the file headers
                string oldNotesHeader = BuildProjectNotesFileHeader(oldName);
                string newNotesHeader = BuildProjectNotesFileHeader(project.Name);

                // Read in the notes text
                notesText.Append(File.ReadAllText(oldNotesFilename));

                // Remove the old header if possible
                if (notesText.ToString().IndexOf(oldNotesHeader) == 0)
                {
                    notesText.Remove(0, oldNotesHeader.Length);
                }

                // Add the new header
                notesText.Insert(0, newNotesHeader);
            }
            catch (IOException e)
            {
                ErrorLogger.AddLog(string.Format("Could not read project '{0}' old notes file after name change:\n{1}", project.Name, e.Message), ErrorSeverity.HIGH);
            }

            // Try to delete the old notes and log files
            try
            {
                File.Delete(oldNotesFilename);
                File.Delete(oldLogsFilename);
                File.Delete(oldFilesFilename);
            }
            catch (IOException e)
            {
                ErrorLogger.AddLog(string.Format("Could not delete old project '{0}' file after name change:\n{1}", project.Name, e.Message), ErrorSeverity.MODERATE);
            }

            // Create the new files and write to them
            CreateFilesForProject(project, true);
            try
            {
                // Notes file
                string newNotesFilename = GetFileNameForProject(project, FileType.NOTES);
                File.WriteAllText(newNotesFilename, notesText.ToString());

                // Logs file
                WriteProjectLogsToFile(project);

                // Files file
                WriteProjectFilesToFile(project);
            }
            catch (IOException e)
            {
                ErrorLogger.AddLog(string.Format("Error writing to new project '{0}' file after name change:\n{1}\n\nProject Notes:\n{2}",
                    project.Name, e.Message, notesText.ToString()), ErrorSeverity.HIGH);
            }
        }
        /// <summary>
        /// Creates files for the given project's logs, notes, and files.
        /// </summary>
        /// <param name="project">The project whose files to create.</param>
        /// <param name="overwrite">Whether or not to overwrite the any files that already exist.</param>
        public static void CreateFilesForProject(Project project, bool overwrite)
        {
            // Log file
            CreateFile(
                GetFileNameForProject(project, FileType.LOGS),
                BuildProjectLogsFileHeader(project.Name, project.Id),
                overwrite);

            // Notes file
            CreateFile(
                GetFileNameForProject(project, FileType.NOTES),
                BuildProjectNotesFileHeader(project.Name),
                overwrite);

            // Files file
            CreateFile(
                GetFileNameForProject(project, FileType.FILES),
                BuildProjectFilesFileHeader(project.Name, project.Id),
                overwrite);
        }
Exemple #23
0
 public void deleteProject(Project project, ref List<Project> projects)
 {
     projects.Remove(project);
 }
        /// <summary>
        /// Returns a tuple containing the a list of the project's completed logs and the project's incomplete log. 
        /// </summary>
        /// <param name="project">The project whose logs to return.</param>
        /// <returns>A tuple containg the project logs.</returns>
        public static Tuple<List<ProjectLog>, ProjectLog> GetLogsForProjectFromFile(Project project)
        {
            List<ProjectLog> completeEntries = new List<ProjectLog>();
            ProjectLog incompleteEntry = null;

            // Get the non-empty and non-comment lines from the log file
            List<string> projectLogRows = GetNonEmptyAndNonCommentLinesFromFile(GetFileNameForProject(project, FileType.LOGS));
            Nullable<bool> parsingCompletedEntries = null;

            // Parse the remaining lines
            foreach (var line in projectLogRows)
            {
                // Check if we have a keywork (incomplete or complete)
                if (line == incomplete)
                {
                    parsingCompletedEntries = false;
                    continue;
                }
                else if (line == complete)
                {
                    parsingCompletedEntries = true;
                    continue;
                }

                // Make sure that we know what type of entry we are parsing
                if (parsingCompletedEntries == null)
                {
                    ErrorLogger.AddLog(string.Format("Could not determin with log '{0}' should be complete or incomplete. Skipping entry.", line), ErrorSeverity.HIGH);
                    continue;
                }

                // If we got here, then we should have a log entry
                // Ensure that the line has the correct format
                string[] lineItems = line.Split('|');
                int numberOfItems = 4;
                if (lineItems.Length != numberOfItems)
                {
                    ErrorLogger.AddLog(string.Format("Could not parse line '{0}'. Skipping entry.", line), ErrorSeverity.HIGH);
                    continue;
                }

                // Ensure that the first part is a valid id
                int logId;
                int minId = 0;
                bool parseIdSuccess = int.TryParse(lineItems[0], out logId);
                if (!parseIdSuccess || logId < minId)
                {
                    ErrorLogger.AddLog(string.Format("Could not parse log id '{0}'. Skipping entry.", lineItems[0]), ErrorSeverity.HIGH);
                    continue;
                }

                // Ensure that the second part is a valid datetime
                DateTime start = DateTime.MinValue;
                try
                {
                    start = DateTime.Parse(lineItems[1]);
                }
                catch (Exception e)
                {
                    if (e is ArgumentNullException || e is FormatException)
                    {
                        ErrorLogger.AddLog(string.Format("Could not parse log start time '{0}'. Skipping entry.", lineItems[1]), ErrorSeverity.HIGH);
                        continue;
                    }
                    else
                    {
                        throw;
                    }
                }

                // Ensure that the third part is either blank (for incomplete entries) or a valid datetime (for complete entries)
                DateTime end;
                // If we're blank but parsing an incomplete entry, just set end to the default value
                if (lineItems[2] == "" && parsingCompletedEntries == false)
                {
                    end = DateTime.MaxValue;
                }
                // Otherwise, if we're not blank and parsing a complete entry, try to parse the value
                else if (lineItems[2] != "" && parsingCompletedEntries == true)
                {
                    try
                    {
                        end = DateTime.Parse(lineItems[2]);
                    }
                    catch (FormatException)
                    {
                        ErrorLogger.AddLog(string.Format("Could not parse log end time '{0}'. Skipping entry.", lineItems[1]), ErrorSeverity.HIGH);
                        continue;
                    }
                }
                // Otherwise, we're invalid
                else
                {
                    ErrorLogger.AddLog(string.Format("Invalid end time '{0}' for log completion status ({1}). Skipping entry.", lineItems[1],
                        parsingCompletedEntries == true ? "complete" : "incomplete"), ErrorSeverity.HIGH);
                    continue;
                }

                // Ensure that the fourth part is a valid description
                string description = lineItems[3];
                if (description == "")
                {
                    ErrorLogger.AddLog(string.Format("Invalid log description '{0}'. Skipping entry.", lineItems[1]), ErrorSeverity.HIGH);
                    continue;
                }

                // If we got here, we have valid project log entry, so create an instance
                if (parsingCompletedEntries == true)
                {
                    // Create a complete entry here
                    ProjectLog logEntry = new ProjectLog(logId, start, end, description, project);
                    highestLogIdsInUse[project.Id] = Math.Max(highestLogIdsInUse[project.Id], logId);
                    completeEntries.Add(logEntry);
                }
                else
                {
                    // Try to create an incomplete entry here, but don't allow multiple incomplete entries
                    if (incompleteEntry == null)
                    {
                        // Create an incomplete entry here
                        ProjectLog logEntry = new ProjectLog(logId, start, description, project);
                        highestLogIdsInUse[project.Id] = Math.Max(highestLogIdsInUse[project.Id], logId);
                        incompleteEntry = logEntry;
                    }
                    else
                    {
                        ErrorLogger.AddLog(string.Format("Only one incomplete entry is allowed. Additional entry '{0}' will be skipped.", description), ErrorSeverity.HIGH);
                        continue;
                    }
                }
            }

            return new Tuple<List<ProjectLog>,ProjectLog>(completeEntries, incompleteEntry);
        }
        /// <summary>
        /// Returns a list of the files associated with this project.
        /// </summary>
        /// <param name="project">The project whose files to return.</param>
        /// <returns>The list of project files.</returns>
        public static List<ProjectFile> GetFilesForProjectFromFile(Project project)
        {
            List<ProjectFile> projectFiles = new List<ProjectFile>();

            // Get the non-empty and non-comment lines from the log file
            List<string> projectFileRows = GetNonEmptyAndNonCommentLinesFromFile(GetFileNameForProject(project, FileType.FILES));

            // Parse the remaining lines
            foreach (var line in projectFileRows)
            {
                // Ensure that the line has the correct format
                string[] lineItems = line.Split('|');
                int numberOfItems = 4;
                if (lineItems.Length != numberOfItems)
                {
                    ErrorLogger.AddLog(string.Format("Could not parse line '{0}'. Skipping entry.", line), ErrorSeverity.HIGH);
                    continue;
                }

                // Ensure that the first part is a valid title
                string fileTitle = lineItems[0];
                if (fileTitle == "")
                {
                    ErrorLogger.AddLog(string.Format("Could not parse file title. Value was '{0}'. Skipping entry.", fileTitle), ErrorSeverity.HIGH);
                    continue;
                }

                // Ensure that the second part is a "true" or "false"
                // Note: We do this before checking the filename because that check depends on this value.
                string isFileString = lineItems[2];
                if (isFileString != "true" && isFileString != "false")
                {
                    ErrorLogger.AddLog(string.Format("Could not parse file type. Value was '{0}'. Skipping entry.", isFileString), ErrorSeverity.HIGH);
                    continue;
                }
                bool isFile = isFileString == "true" ? true : false;

                // Ensure that the first part is a valid filepath
                string fileName = lineItems[1];
                if (isFile)
                {
                    try
                    {
                        fileName = Path.GetFullPath(fileName);
                    }
                    catch (ArgumentException e)
                    {
                        ErrorLogger.AddLog(string.Format("Could not parse filename '{0}':\n{1}\nSkipping entry.", fileName, e.Message), ErrorSeverity.HIGH);
                        continue;
                    }
                }
                else
                {
                    Uri uriResult;
                    bool result = Uri.TryCreate(fileName, UriKind.Absolute, out uriResult) && uriResult.Scheme == Uri.UriSchemeHttp;
                    if (!result)
                    {
                        ErrorLogger.AddLog(string.Format("Could not parse url '{0}':\n{1}\nSkipping entry.", fileName), ErrorSeverity.HIGH);
                        continue;
                    }
                }

                // Ensure that the third part is a valid program or is blank
                string programToOpen = lineItems[3];
                if (programToOpen != "")
                {
                    try
                    {
                        programToOpen = Path.GetFullPath(programToOpen);
                    }
                    catch (ArgumentException e)
                    {
                        ErrorLogger.AddLog(string.Format("Could not parse filename '{0}':\n{1}\nSkipping entry.", programToOpen, e.Message), ErrorSeverity.HIGH);
                        continue;
                    }
                }

                // If we got here, we have valid project file, so create an instance
                ProjectFile projectFile = null;
                if (programToOpen == "")
                {
                    projectFile = new ProjectFile(fileTitle, fileName, isFile, project);
                }
                else
                {
                    projectFile = new ProjectFile(fileTitle, fileName, isFile, programToOpen, project);
                }

                projectFiles.Add(projectFile);
            }
            return projectFiles;
        }
        /// <summary>
        /// Delete the log, notes, and files file for the given project.
        /// </summary>
        /// <param name="project">The project whose files to delete.</param>
        public static void DeleteFilesForProject(Project project)
        {
            try
            {
                string logFilename = GetFileNameForProject(project, FileType.LOGS);
                if (File.Exists(logFilename))
                {
                    File.Delete(logFilename);
                }

                string notesFilename = GetFileNameForProject(project, FileType.NOTES);
                if (File.Exists(notesFilename))
                {
                    File.Delete(notesFilename);
                }

                string filesFilename = GetFileNameForProject(project, FileType.FILES);
                if (File.Exists(filesFilename))
                {
                    File.Delete(filesFilename);
                }
            }
            catch (IOException e)
            {
                ErrorLogger.AddLog(string.Format("Could not delete files for project '{0}':\n{1}", project.Name, e.Message), ErrorSeverity.MODERATE);
                return;
            }
        }
 public ProjectFile(string fileTitle, string filename, bool isFile, Project parentProject)
     : this(fileTitle, filename, isFile, null, parentProject)
 {
 }
        //-------------------//
        // File Open Methods //
        //-------------------//
        /// <summary>
        /// Opens the notes file for the given project (or the generic note file if no project given).
        /// </summary>
        /// <param name="project">The project whose notes file to open. Open the generic notes file if null.</param>
        public static void OpenNotesFile(Project project = null)
        {
            // Check to make sure the file exists, and create it if necessary
            string notesFilename;

            // Handle the case where we have a project
            if (project != null)
            {
                notesFilename = GetFileNameForProject(project, FileType.NOTES);
                if (!File.Exists(notesFilename))
                {
                    CreateFilesForProject(project, false);
                }
            }

            // Handle the case where we have no project
            else
            {
                notesFilename = fullCommonNotesFilename;
                try
                {
                    if (!File.Exists(notesFilename))
                    {
                        File.WriteAllText(notesFilename, CommonNotesFileTemplate);
                    }
                }
                catch (IOException e)
                {
                    ErrorLogger.AddLog(string.Format("Error creating common notes file:\n{0}", e.Message), ErrorSeverity.HIGH);
                    return;
                }
            }

            // Append a timestamp to the notes file
            if (UserSettings.AddTimestampToNotes)
            {
                try
                {
                    File.AppendAllText(notesFilename, BuildTimeStamp(DateTime.Now.ToString()));
                }
                catch (IOException e)
                {
                    ErrorLogger.AddLog(string.Format("Error opening project '{0}' notes file:\n{1}", project.Name, e.Message), ErrorSeverity.HIGH);
                }
            }

            // Try to open the file
            try
            {
                Process.Start(notesFilename);
            }
            catch (FileNotFoundException e)
            {
                ErrorLogger.AddLog(string.Format("Error opening project '{0}' notes file:\n{1}", project.Name, e.Message), ErrorSeverity.HIGH);
            }
        }
 //------------------//
 // External Methods //
 //------------------//
 /// <summary>
 /// Switches the UserControl to the project menu.
 /// </summary>
 /// <param name="project">The project whose project menu to switch to.</param>
 public void GoToProjectMenu(Project project)
 {
     Window parent = Window.GetWindow(this);
     parent.Content = new ProjectMenu(project);
 }
        /// <summary>
        /// Resets the notes file for the given project.
        /// </summary>
        /// <param name="project">The project whose notes file to open.</param>
        public static void ResetNotesFile(Project project = null)
        {
            if (project == null)
            {
                ErrorLogger.AddLog("Cannot reset notes file for null project.", ErrorSeverity.MODERATE);
            }

            string notesFilename = GetFileNameForProject(project, FileType.NOTES);
            try
            {
                File.WriteAllText(notesFilename, BuildProjectNotesFileHeader(project.Name));
            }
            catch (IOException e)
            {
                ErrorLogger.AddLog(string.Format("Error resetting project {0} notes file:\n{1}", project.Name, e.Message), ErrorSeverity.MODERATE);
                return;
            }
        }