本文整理汇总了C#中System.Windows.Forms.RichTextBox.LoadFile方法的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.RichTextBox.LoadFile方法的具体用法?C# System.Windows.Forms.RichTextBox.LoadFile怎么用?C# System.Windows.Forms.RichTextBox.LoadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.RichTextBox
的用法示例。
在下文中一共展示了System.Windows.Forms.RichTextBox.LoadFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: importNotes
//.........这里部分代码省略.........
}
if (data.idGroup == -2 && (chkNoRecycle.IsChecked != null && chkNoRecycle.IsChecked.Value))
{
// do not get note from Recycle bin - continue to iterate notes ids
goto _sections_loop;
}
break;
case "schedule":
schedule = PNInterop.ReadINIStructure(dbPath, id, key, schedule);
break;
case "rel_position":
relPos = PNInterop.ReadINIStructure(dbPath, id, key, relPos);
break;
case "add_appearance":
addApp = PNInterop.ReadINIStructure(dbPath, id, key, addApp);
break;
case "creation":
creation = PNInterop.ReadINIStructure(dbPath, id, key, creation);
break;
case "appearance":
appearance = PNInterop.ReadINIStructure(dbPath, id, key, appearance);
break;
case "pin":
pin = PNInterop.ReadINIStructure(dbPath, id, key, pin);
break;
case "send_rec":
sendrec = PNInterop.ReadINIStructure(dbPath, id, key, sendrec);
break;
case "deletion":
deletion = PNInterop.ReadINIStructure(dbPath, id, key, deletion);
break;
case "lock":
PNInterop.GetPrivateProfileStringByBuilder(id, key, "", password, 256, dbPath);
if (password.Length > 0)
{
// no import for password protected notes - continue to iterate notes ids
goto _sections_loop;
}
break;
case "tags":
while (PNInterop.GetPrivateProfileStringByBuilder(id, key, "", tags, tags.Capacity, dbPath) == tags.Capacity - 1)
{
tags.Capacity *= 2;
}
break;
case "links":
while (PNInterop.GetPrivateProfileStringByBuilder(id, key, "", links, links.Capacity, dbPath) == tags.Capacity - 1)
{
links.Capacity *= 2;
}
break;
}
}
if (addNewNote(id, data, schedule, relPos, addApp, creation, deletion, appearance, pin, sendrec,
tags, links, groupIds,
chkKeepInvisible.IsChecked ?? false))
{
listID.Add(id);
}
}
_sections_loop:
System.Windows.Forms.Application.DoEvents();
}
if (listID.Count > 0)
{
var rtb = new System.Windows.Forms.RichTextBox();
var ids = listID.ToArray();
foreach (string id in ids)
{
var src = Path.Combine(txtDataDir.Text, id + ".pnote");
if (!File.Exists(src))
{
listID.Remove(id);
continue;
}
try
{
rtb.LoadFile(src, System.Windows.Forms.RichTextBoxStreamType.RichText);
}
catch (ArgumentException aex)
{
if (aex.Message.Contains("File format is not valid"))
{
listID.Remove(id);
continue;
}
}
var dest = Path.Combine(PNPaths.Instance.DataDir, id + PNStrings.NOTE_EXTENSION);
File.Copy(src, dest, true);
}
//show notes if appropriate check box is unchecked
PNStatic.FormMain.LoadNotesByList(listID, !(chkKeepInvisible.IsChecked ?? false));
}
}
catch (Exception ex)
{
PNStatic.LogException(ex);
}
}