OPC Studio User's Guide and Reference
Installed Examples - WPF - WpfApplication1

The simplest WPF application for OPC “Classic”. Reads and displays an OPC item value.

// $Header: $
// Copyright (c) CODE Consulting and Development, s.r.o., Plzen. All rights reserved.

//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

using System.Windows;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.OperationModel;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow/* : Window*/
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var client = new EasyDAClient();
            try
            {
                var value = client.ReadItemValue("", "OPCLabs.KitServer.2", "Demo.Single");
                TextBox1.Text = value?.ToString() ?? "";
            }
            catch (OpcException opcException)
            {
                TextBox1.Text = $"*** {opcException}";
            }
        }
    }
}

 

See Also

Conceptual

Installed Examples - WindowsForms

Installed Examples - Console