예제 #1
0
        private void addNoteBtn_Click(object sender, EventArgs e)
        {
            string currentFile = fileListBox.SelectedItem.ToString();

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

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

            NoteEditor   ne = new NoteEditor(currentFile, pf.project.files[currentFile].note);
            DialogResult dr = ne.ShowDialog();

            if (dr == DialogResult.OK)
            {
                pf.project.files[currentFile].note = ne.note;
            }
            else if (dr == DialogResult.Abort)
            {
                pf.project.files[currentFile].note = "";
            }

            ChangeNoteIcon(currentFile);

            fileChanged = true;
        }
예제 #2
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;
            }
        }
예제 #3
0
        private void fileListBox_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            var item = fileListBox.SelectedItem.ToString();

            if (e.NewValue == CheckState.Checked)
            {
                DialogResult dr = DialogResult.Yes;

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

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

                if (pf.project.files[item].content.Count > 0)
                {
                    dr = MessageBox.Show("Are you sure you want to mark this file as complete?\nThis operation CAN be undone.", "Warning", MessageBoxButtons.YesNo);
                }

                if (dr == DialogResult.Yes)
                {
                    pf.project.files[item].complete = true;
                    CompleteToggle(true);
                    fileChanged = true;
                }
                else
                {
                    e.NewValue = CheckState.Unchecked;
                }
            }
            else
            {
                DialogResult dr = DialogResult.Yes;

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

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

                if (pf.project.files[item].content.Count > 0)
                {
                    dr = MessageBox.Show("Are you sure you want to mark this file as not complete?\nThis operation CAN be undone.", "Warning", MessageBoxButtons.YesNo);
                }

                if (dr == DialogResult.Yes)
                {
                    pf.project.files[item].complete = false;
                    CompleteToggle(false);
                    fileChanged = true;
                }
                else
                {
                    e.NewValue = CheckState.Checked;
                }
            }
        }