本文整理汇总了C#中ConnectionInfo.?.GetTreeNodeType方法的典型用法代码示例。如果您正苦于以下问题:C# ConnectionInfo.?.GetTreeNodeType方法的具体用法?C# ConnectionInfo.?.GetTreeNodeType怎么用?C# ConnectionInfo.?.GetTreeNodeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionInfo
的用法示例。
在下文中一共展示了ConnectionInfo.?.GetTreeNodeType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportToFile
public static void ExportToFile(ConnectionInfo selectedNode, ConnectionTreeModel connectionTreeModel)
{
try
{
var saveSecurity = new SaveFilter();
using (var exportForm = new ExportForm())
{
if (selectedNode?.GetTreeNodeType() == TreeNodeType.Container)
exportForm.SelectedFolder = selectedNode as ContainerInfo;
else if (selectedNode?.GetTreeNodeType() == TreeNodeType.Connection)
{
if (selectedNode.Parent.GetTreeNodeType() == TreeNodeType.Container)
exportForm.SelectedFolder = selectedNode.Parent;
exportForm.SelectedConnection = selectedNode;
}
if (exportForm.ShowDialog(frmMain.Default) != DialogResult.OK)
return ;
ConnectionInfo exportTarget;
switch (exportForm.Scope)
{
case ExportForm.ExportScope.SelectedFolder:
exportTarget = exportForm.SelectedFolder;
break;
case ExportForm.ExportScope.SelectedConnection:
exportTarget = exportForm.SelectedConnection;
break;
default:
exportTarget = connectionTreeModel.RootNodes.First(node => node is RootNodeInfo);
break;
}
saveSecurity.SaveUsername = exportForm.IncludeUsername;
saveSecurity.SavePassword = exportForm.IncludePassword;
saveSecurity.SaveDomain = exportForm.IncludeDomain;
saveSecurity.SaveInheritance = exportForm.IncludeInheritance;
SaveExportFile(exportForm.FileName, exportForm.SaveFormat, saveSecurity, exportTarget);
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("App.Export.ExportToFile() failed.", ex, logOnly: true);
}
}