/* ========================================================================
* Copyright (c) 2005-2020 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Opc.Ua;
using Opc.Ua.Client;
namespace Opc.Ua.Client.Controls
{
///
/// A control which displays browse tree.
///
public partial class BrowseNodeCtrl : UserControl
{
#region Constructors
///
/// Creates a new instance of the control.
///
public BrowseNodeCtrl()
{
InitializeComponent();
}
#endregion
#region Private Fields
#endregion
#region Public Interface
///
/// Initializes the control with a root and a set of hierarchial reference types to follow.
///
/// The session.
/// The root of the hierarchy to browse.
/// The reference types to follow.
public void Initialize(
Session session,
NodeId rootId,
params NodeId[] referenceTypeIds)
{
BrowseCTRL.Initialize(session, rootId, referenceTypeIds);
}
///
/// Changes the session used by the control.
///
/// The session.
public void ChangeSession(Session session)
{
BrowseCTRL.ChangeSession(session);
}
///
/// The view to use.
///
public ViewDescription View
{
get { return BrowseCTRL.View; }
set { BrowseCTRL.View = value; }
}
///
/// Gets or sets the default position of the splitter
///
public int SplitterDistance
{
get { return MainPN.SplitterDistance; }
set { MainPN.SplitterDistance = value; }
}
///
/// Gets or sets a flag that indicates whether the attributes should be displayed.
///
public bool AttributesListCollapsed
{
get { return MainPN.Panel2Collapsed; }
set { MainPN.Panel2Collapsed = value; }
}
///
/// Gets or sets the context menu for the browse tree.
///
public ContextMenuStrip BrowseMenuStrip
{
get { return BrowseCTRL.BrowseMenuStrip; }
set { BrowseCTRL.BrowseMenuStrip = value; }
}
///
/// Gets or sets the context menu for the attributes list.
///
public ContextMenuStrip AttributesMenuStrip
{
get { return AttributesCTRL.AttributesMenuStrip; }
set { AttributesCTRL.AttributesMenuStrip = value; }
}
///
/// The reference for the currently selected node.
///
public ReferenceDescription SelectedNode
{
get
{
return BrowseCTRL.SelectedNode;
}
}
///
/// The reference for the parent of the currently selected node.
///
public ReferenceDescription SelectedParent
{
get
{
return BrowseCTRL.SelectedParent;
}
}
///
/// Returns the child node at the specified index.
///
public ReferenceDescription GetChildOfSelectedNode(int index)
{
return BrowseCTRL.GetChildOfSelectedNode(index);
}
///
/// Returns the attribute at the specified index.
///
public ReadValueId GetSelectedAttribute(int index)
{
return AttributesCTRL.GetSelectedAttribute(index);
}
///
/// The reference for the parent of the currently selected node.
///
public void RefreshSelection()
{
BrowseCTRL.RefreshSelection();
}
///
/// Raised after a node is selected in the control.
///
public event EventHandler AfterSelect
{
add { BrowseCTRL.AfterSelect += value; }
remove { BrowseCTRL.AfterSelect -= value; }
}
#endregion
#region Private Methods
#endregion
#region Event Handlers
#endregion
}
}