本文整理汇总了C#中System.Windows.Forms.Document.LoadFile方法的典型用法代码示例。如果您正苦于以下问题:C# Document.LoadFile方法的具体用法?C# Document.LoadFile怎么用?C# Document.LoadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.LoadFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadSettings
private void LoadSettings()
{
if (File.Exists(this.SettingsFilename))
{
Document document = new Document();
document.LoadFile(this.SettingsFilename);
Element element = document.get_RootElement().SelectSingleElement("Login");
this.txtJid.Text = element.GetTag("Jid");
this.txtPassword.Text = element.GetTag("Password");
this.txtResource.Text = element.GetTag("Resource");
this.numPriority.Value = element.GetTagInt("Priority");
this.chkSSL.Checked = element.GetTagBool("Ssl");
}
}
示例2: findButton_Click
/// <summary>
/// Occurs when the button is clicked.
/// </summary>
/// <param name="sender">Sender of the event.</param>
/// <param name="e">Event arguments.</param>
private void findButton_Click(object sender, System.EventArgs e)
{
// Update find/replace options
//if ((this.owner as UCEditor)._ParentTab.Selected != true)
// (this.owner as UCEditor)._ParentTab.Selected = true;
this.UpdateFindReplaceOptions();
if (editor == null && optEntireProject.Checked == false) {
MessageBox.Show("No open windows.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
// Save this last search in the list
if (!g.Project.Finds.Contains(findTextBox.Text)) {
// Remove old stuff
if (g.Project.Finds.Count == 10)
g.Project.Finds.RemoveAt(0);
g.Project.Finds.Add(findTextBox.Text);
g.Main.cboRecentSearches.Text = findTextBox.Text;
RehashRecent();
}
// Set the status
//owner.SetStatusMessage("Find: \"" + options.FindText + "\"");
if (this.optCurFile.Checked || this.optSelection.Checked) {
// Perform find operation on currently open file
FindReplaceResultSet resultSet = null;
options.SearchInSelection = this.optSelection.Checked;
try {
resultSet = editor.SelectedView.FindReplace.Find(options);
} catch { return; }
if (resultSet.PastEndOfDocument)
MessageBox.Show(this, "Search past end of file; jumping to beginning.", "Find", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (resultSet.Count == 0)
MessageBox.Show(this, "Cannot find search string.", "Find", MessageBoxButtons.OK, MessageBoxIcon.Information);
} else if (this.optAllFiles.Checked) {
// Perform search on all open files
PrimaryTab<UCEditor> ed = g.Editors[ActiveDocument];
SyntaxEditor actdoc = ed.Control.txtEditor;
ed.page.Selected = true;
FindReplaceResultSet resultSet = null;
try {
resultSet = actdoc.SelectedView.FindReplace.Find(options);
} catch { return; }
if (resultSet.PastEndOfDocument || resultSet.Count == 0) {
if (g.Editors.Count == (ActiveDocument + 1)) {
MessageBox.Show(this, "All open files searched; jumping to beginning.", "Find", MessageBoxButtons.OK, MessageBoxIcon.Information);
ActiveDocument = 0;
return;
} else {
ActiveDocument++;
}
if (resultSet.Count == 0)
findButton_Click(null, null);
}
} else if (this.optEntireProject.Checked) {
// Perform search on all files
UCFindResults fFindResults = new UCFindResults();
fFindResults.lvFind.BeginUpdate();
System.IO.Directory.SetCurrentDirectory(g.Project.ProjectPath);
foreach(CProject.File file in g.Project.FileList) {
Document doc = new Document();
try {
doc.LoadFile(System.IO.Path.GetFullPath(file.RelativePath));
} catch { continue; }
FindReplaceResultSet results = doc.FindReplace.FindAll(options);
foreach(FindReplaceResult result in results) {
ListViewItem item = new ListViewItem(file.RelativePath);
item.SubItems.Add(Convert.ToString(doc.OffsetToPosition(result.Offset).Line + 1));
item.SubItems.Add(doc.Lines[doc.OffsetToPosition(result.Offset).Line].Text);
item.Tag = file;
fFindResults.lvFind.Items.Add(item);
}
doc.Dispose();
doc = null;
}
//.........这里部分代码省略.........