private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            uint res = Init();

            switch (Init())
            {
            case S_OK:

                break;

            case E_ACCESSDENIED:
                MessageBox.Show("Отсутствуют права на использование: нужен USB-ключ", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);

                return;

            default:
                MessageBox.Show("Непредвиденная ошибка", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            CreateDiana(out pDiana);
            if (pDiana == IntPtr.Zero)
            {
                return;
            }

            OnDataReceived = DataReceivedCallback;
            SetDataReceivedCallback(pDiana, 0, OnDataReceived);

            OnConnectionChanged = ConnectionChangedCallback;
            SetConnectionChangedCallback(pDiana, 0, OnConnectionChanged);

            OnDianaInfo = DianaInfoCallback;
            SetDianaInfoCallback(pDiana, 0, OnDianaInfo);

            OnDispChanged = DispChangedCallback;
            SetDispChangedCallback(pDiana, 0, OnDispChanged);

            OnAmplChanged = AmplChangedCallback;
            SetAmplChangedCallback(pDiana, 0, OnAmplChanged);

            OnOptionalTypeChanged = OptionalTypeChangedCallback;
            SetOptionalTypeChangedCallback(pDiana, 0, OnOptionalTypeChanged);

            UpdateDeviceList();
        }
Exemple #2
0
        private void Start_Diana()
        {
            tiEquipment.IsEnabled = true;
            uint res = Init();

            switch (Init())
            {
            case S_OK:

                break;

            case E_ACCESSDENIED:
                System.Windows.MessageBox.Show("Отсутствуют права на использование: нужен USB-ключ", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);

                return;

            default:
                System.Windows.MessageBox.Show("Непредвиденная ошибка", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            CreateDiana(out pDiana);
            if (pDiana == IntPtr.Zero)
            {
                return;
            }

            OnDataReceived = DataReceivedCallback;
            SetDataReceivedCallback(pDiana, 0, OnDataReceived);

            OnConnectionChanged = ConnectionChangedCallback;
            SetConnectionChangedCallback(pDiana, 0, OnConnectionChanged);

            OnDianaInfo = DianaInfoCallback;
            SetDianaInfoCallback(pDiana, 0, OnDianaInfo);

            OnOptionalTypeChanged = OptionalTypeChangedCallback;
            SetOptionalTypeChangedCallback(pDiana, 0, OnOptionalTypeChanged);

            UpdateDeviceList();
        }
Exemple #3
0
 public static extern void SetOptionalTypeChangedCallback(IntPtr pDiana, UInt32 dwUser, OptionalTypeChangedCallback pCallback);