private void ParseFromText(string text) { string[] paras = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < paras.Length; i++) { Paragraph para = new Paragraph(); para.Text = paras[i]; para.SetNumber(i + 1); para.SetSequence(i + 1); Body.Add(para); } }
private void cmiSplit_Click(object sender, EventArgs e) { if (txtMain.SelectionStart > 0) { string newpara = txtMain.Text.Substring(txtMain.SelectionStart).Trim(); Global.Working.Body.Single(p => p.Number == _counter).Text = txtMain.Text.Remove(txtMain.SelectionStart).Trim(); Paragraph para = new Paragraph(); para.SetNumber(_next.Number); para.SetSequence(_next.Sequence); para.Text = newpara; Global.Working.RecalculateForInsert(_next.Sequence); int idx = Global.Working.Body.IndexOf(Global.Working.Body.Single(p => p.Number == _next.Number)); Global.Working.Body.Insert(idx, para); SetWorkArea(); } }