private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { try { if (Clipboard.ContainsText()) { foreach (Description f in DescriptionContainer.LoadString(Clipboard.GetText()).Descriptions) { list.Add(f); } fill(); } } catch (Exception) { if (Clipboard.ContainsText()) { string[] elms = Clipboard.GetText().Split('\n'); for (int i = 0; i < elms.Length; i++) { string s = elms[i]; string trim = s.Trim(new char[] { '\n', '\t', ' ', '\r' }); if (trim.Length == 0) { continue; } if (!s.Contains(".") && i < elms.Length - 1) { int next = i + 1; StringBuilder desc = new StringBuilder(); while (next < elms.Length && (elms[next].Contains(".") || elms[next].Trim(new char[] { '\n', '\t', ' ', '\r' }).Length == 0)) { if (elms[next].Trim(new char[] { '\n', '\t', ' ', '\r' }).Length > 0) { desc.AppendLine(elms[next].Trim(new char[] { '\n', '\t', ' ', '\r' })); } next++; } list.Add(new Description(trim, desc.ToString())); i = next - 1; } else { string[] ss = s.Split(new char[] { '.' }, 2); list.Add(new Description(ss[0].Trim(new char[] { '\n', '\t', ' ', '\r' }), ss.Length > 1 ? ss[1].Trim(new char[] { '\n', '\t', ' ', '\r' }) : null)); } } fill(); } } }
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { try { if (Clipboard.ContainsText()) { foreach (Description f in DescriptionContainer.LoadString(Clipboard.GetText()).Descriptions) { list.Add(f); } fill(); } } catch (Exception) { } }
private void Paste_Clicked(object sender, EventArgs e) { try { Changed = true; foreach (Description d in DescriptionContainer.LoadString(DependencyService.Get <IClipboardService>().GetTextData()).Descriptions) { if (d is ListDescription td) { foreach (Names f in td.Names) { Desc.Names.Add(f); } } } Fill(); } catch (Exception ex) { DisplayAlert("Error", ex.Message, "Ok"); } }