Example #1
0
        private void OpenLineEditor(LineEditor.LineData ld)
        {
            LineEditor lineEditor = new LineEditor(ld, pf.project.type);

            if (lineEditor.ShowDialog() == DialogResult.OK)
            {
                string currentItem = fileListBox.SelectedItem.ToString();

                if (!pf.project.files.ContainsKey(currentItem))
                {
                    ProjectFile.RevisedFile rf = new ProjectFile.RevisedFile
                    {
                        complete = false,
                        note     = "",
                        content  = new List <ProjectFile.FileContent>(),
                    };

                    pf.project.files.Add(currentItem, rf);
                }

                int contentId = lineEditor.newfc.contentId;

                if (pf.project.files[currentItem].content.FindIndex(line => line.contentId == contentId) != -1)
                {
                    var item = pf.project.files[currentItem].content.Single(line => line.contentId == contentId);

                    if (pf.project.files[currentItem].content.Contains(item))
                    {
                        pf.project.files[currentItem].content.Remove(item);
                    }
                }

                ProjectFile.FileContent fc = new ProjectFile.FileContent
                {
                    contentId  = lineEditor.newfc.contentId,
                    lineId     = lineEditor.newfc.lineId,
                    proposal   = lineEditor.newfc.proposal,
                    prevLineId = lineEditor.newfc.prevLineId,
                    comment    = lineEditor.newfc.comment,
                    color      = lineEditor.newfc.color
                };

                pf.project.files[currentItem].content.Add(fc);

                ListViewUpdate();

                fileChanged = true;
            }
        }