﻿Option Strict Off
Option Explicit On 
Imports System.Text

Friend Class M_ConditionDlg
    Inherits System.Windows.Forms.Form

#Region " Windows フォーム デザイナで生成されたコード "

    Public Sub New()
        MyBase.New()

        ' この呼び出しは Windows フォーム デザイナで必要です。
        InitializeComponent()

        ' InitializeComponent() 呼び出しの後に初期化を追加します。

    End Sub

    ' Form は dispose をオーバーライドしてコンポーネント一覧を消去します。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    ' Windows フォーム デザイナで必要です。
    Private components As System.ComponentModel.IContainer

    ' メモ : 以下のプロシージャは、Windows フォーム デザイナで必要です。
    ' Windows フォーム デザイナを使って変更してください。  
    ' コード エディタは使用しないでください。
    Friend WithEvents STATIC1 As System.Windows.Forms.GroupBox
    Friend WithEvents STATICc As System.Windows.Forms.GroupBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents Label11 As System.Windows.Forms.Label
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents Label12 As System.Windows.Forms.Label
    Friend WithEvents Label13 As System.Windows.Forms.Label
    Friend WithEvents Label14 As System.Windows.Forms.Label
    Friend WithEvents Label15 As System.Windows.Forms.Label
    Friend WithEvents Label16 As System.Windows.Forms.Label
    Friend WithEvents Combo_StartTrg As System.Windows.Forms.ComboBox
    Friend WithEvents Combo_ClockTrg As System.Windows.Forms.ComboBox
    Friend WithEvents Combo_StopTrg As System.Windows.Forms.ComboBox
    Friend WithEvents Edit_InternalClock As System.Windows.Forms.TextBox
    Friend WithEvents Edit_StopNum As System.Windows.Forms.TextBox
    Friend WithEvents Edit_Mask As System.Windows.Forms.TextBox
    Friend WithEvents Edit_Pattern As System.Windows.Forms.TextBox
    Friend WithEvents Radio_WriteOnce As System.Windows.Forms.RadioButton
    Friend WithEvents Radio_WriteRing As System.Windows.Forms.RadioButton
    Friend WithEvents Button_Ok As System.Windows.Forms.Button
    Friend WithEvents Button_Cancel As System.Windows.Forms.Button
    Friend WithEvents Edit_NotifyNumber As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.STATIC1 = New System.Windows.Forms.GroupBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Combo_StartTrg = New System.Windows.Forms.ComboBox()
        Me.Combo_ClockTrg = New System.Windows.Forms.ComboBox()
        Me.Combo_StopTrg = New System.Windows.Forms.ComboBox()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Label8 = New System.Windows.Forms.Label()
        Me.Label11 = New System.Windows.Forms.Label()
        Me.Edit_InternalClock = New System.Windows.Forms.TextBox()
        Me.Edit_StopNum = New System.Windows.Forms.TextBox()
        Me.Edit_Mask = New System.Windows.Forms.TextBox()
        Me.Edit_Pattern = New System.Windows.Forms.TextBox()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.Label9 = New System.Windows.Forms.Label()
        Me.Label10 = New System.Windows.Forms.Label()
        Me.Label12 = New System.Windows.Forms.Label()
        Me.Label13 = New System.Windows.Forms.Label()
        Me.Label14 = New System.Windows.Forms.Label()
        Me.Label15 = New System.Windows.Forms.Label()
        Me.Label16 = New System.Windows.Forms.Label()
        Me.STATICc = New System.Windows.Forms.GroupBox()
        Me.Radio_WriteOnce = New System.Windows.Forms.RadioButton()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Radio_WriteRing = New System.Windows.Forms.RadioButton()
        Me.Button_Ok = New System.Windows.Forms.Button()
        Me.Button_Cancel = New System.Windows.Forms.Button()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.Edit_NotifyNumber = New System.Windows.Forms.TextBox()
        Me.STATIC1.SuspendLayout()
        Me.STATICc.SuspendLayout()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'STATIC1
        '
        Me.STATIC1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.Combo_StartTrg, Me.Combo_ClockTrg, Me.Combo_StopTrg, Me.Label3, Me.Label4, Me.Label8, Me.Label11, Me.Edit_InternalClock, Me.Edit_StopNum, Me.Edit_Mask, Me.Edit_Pattern, Me.Label6, Me.Label9, Me.Label10, Me.Label12, Me.Label13, Me.Label14, Me.Label15, Me.Label16})
        Me.STATIC1.Location = New System.Drawing.Point(16, 8)
        Me.STATIC1.Name = "STATIC1"
        Me.STATIC1.Size = New System.Drawing.Size(480, 120)
        Me.STATIC1.TabIndex = 8
        Me.STATIC1.TabStop = False
        Me.STATIC1.Text = "サンプリング条件"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(8, 16)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(72, 16)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "スタート条件："
        '
        'Combo_StartTrg
        '
        Me.Combo_StartTrg.Location = New System.Drawing.Point(80, 16)
        Me.Combo_StartTrg.Name = "Combo_StartTrg"
        Me.Combo_StartTrg.Size = New System.Drawing.Size(112, 20)
        Me.Combo_StartTrg.TabIndex = 2
        Me.Combo_StartTrg.Text = "ComboBox1"
        '
        'Combo_ClockTrg
        '
        Me.Combo_ClockTrg.Location = New System.Drawing.Point(80, 63)
        Me.Combo_ClockTrg.Name = "Combo_ClockTrg"
        Me.Combo_ClockTrg.Size = New System.Drawing.Size(112, 20)
        Me.Combo_ClockTrg.TabIndex = 3
        Me.Combo_ClockTrg.Text = "ComboBox1"
        '
        'Combo_StopTrg
        '
        Me.Combo_StopTrg.Location = New System.Drawing.Point(80, 91)
        Me.Combo_StopTrg.Name = "Combo_StopTrg"
        Me.Combo_StopTrg.Size = New System.Drawing.Size(112, 20)
        Me.Combo_StopTrg.TabIndex = 4
        Me.Combo_StopTrg.Text = "ComboBox1"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(8, 65)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 15)
        Me.Label3.TabIndex = 1
        Me.Label3.Text = "クロック条件："
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(8, 94)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(72, 18)
        Me.Label4.TabIndex = 1
        Me.Label4.Text = "ストップ条件："
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(273, 94)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(63, 16)
        Me.Label8.TabIndex = 1
        Me.Label8.Text = "停止個数："
        '
        'Label11
        '
        Me.Label11.Location = New System.Drawing.Point(442, 71)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(16, 16)
        Me.Label11.TabIndex = 1
        Me.Label11.Text = "ns"
        '
        'Edit_InternalClock
        '
        Me.Edit_InternalClock.Location = New System.Drawing.Point(352, 66)
        Me.Edit_InternalClock.Name = "Edit_InternalClock"
        Me.Edit_InternalClock.Size = New System.Drawing.Size(80, 19)
        Me.Edit_InternalClock.TabIndex = 7
        Me.Edit_InternalClock.Text = "TextBox2"
        Me.Edit_InternalClock.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Edit_StopNum
        '
        Me.Edit_StopNum.Location = New System.Drawing.Point(352, 91)
        Me.Edit_StopNum.Name = "Edit_StopNum"
        Me.Edit_StopNum.Size = New System.Drawing.Size(80, 19)
        Me.Edit_StopNum.TabIndex = 8
        Me.Edit_StopNum.Text = "TextBox2"
        Me.Edit_StopNum.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Edit_Mask
        '
        Me.Edit_Mask.Location = New System.Drawing.Point(352, 41)
        Me.Edit_Mask.Name = "Edit_Mask"
        Me.Edit_Mask.Size = New System.Drawing.Size(80, 19)
        Me.Edit_Mask.TabIndex = 6
        Me.Edit_Mask.Text = "TextBox2"
        Me.Edit_Mask.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Edit_Pattern
        '
        Me.Edit_Pattern.Location = New System.Drawing.Point(352, 15)
        Me.Edit_Pattern.Name = "Edit_Pattern"
        Me.Edit_Pattern.Size = New System.Drawing.Size(80, 19)
        Me.Edit_Pattern.TabIndex = 5
        Me.Edit_Pattern.Text = "TextBox2"
        Me.Edit_Pattern.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(272, 69)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(72, 16)
        Me.Label6.TabIndex = 1
        Me.Label6.Text = "内部クロック："
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(272, 43)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(80, 16)
        Me.Label9.TabIndex = 1
        Me.Label9.Text = "パターンマスク："
        '
        'Label10
        '
        Me.Label10.Location = New System.Drawing.Point(272, 16)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(80, 16)
        Me.Label10.TabIndex = 1
        Me.Label10.Text = "比較パターン："
        '
        'Label12
        '
        Me.Label12.Location = New System.Drawing.Point(440, 46)
        Me.Label12.Name = "Label12"
        Me.Label12.Size = New System.Drawing.Size(24, 16)
        Me.Label12.TabIndex = 1
        Me.Label12.Text = "Hex"
        '
        'Label13
        '
        Me.Label13.Location = New System.Drawing.Point(440, 18)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(24, 16)
        Me.Label13.TabIndex = 1
        Me.Label13.Text = "Hex"
        '
        'Label14
        '
        Me.Label14.Location = New System.Drawing.Point(200, 95)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(56, 16)
        Me.Label14.TabIndex = 1
        Me.Label14.Text = "->ExtSig3"
        '
        'Label15
        '
        Me.Label15.Location = New System.Drawing.Point(200, 67)
        Me.Label15.Name = "Label15"
        Me.Label15.Size = New System.Drawing.Size(56, 16)
        Me.Label15.TabIndex = 1
        Me.Label15.Text = "->ExtSig1"
        '
        'Label16
        '
        Me.Label16.Location = New System.Drawing.Point(200, 16)
        Me.Label16.Name = "Label16"
        Me.Label16.Size = New System.Drawing.Size(56, 16)
        Me.Label16.TabIndex = 1
        Me.Label16.Text = "->ExtSig2"
        '
        'STATICc
        '
        Me.STATICc.Controls.AddRange(New System.Windows.Forms.Control() {Me.Radio_WriteOnce, Me.Label1, Me.Radio_WriteRing})
        Me.STATICc.Location = New System.Drawing.Point(16, 136)
        Me.STATICc.Name = "STATICc"
        Me.STATICc.Size = New System.Drawing.Size(480, 48)
        Me.STATICc.TabIndex = 10
        Me.STATICc.TabStop = False
        Me.STATICc.Text = "バッファ条件設定"
        '
        'Radio_WriteOnce
        '
        Me.Radio_WriteOnce.Location = New System.Drawing.Point(112, 20)
        Me.Radio_WriteOnce.Name = "Radio_WriteOnce"
        Me.Radio_WriteOnce.Size = New System.Drawing.Size(72, 16)
        Me.Radio_WriteOnce.TabIndex = 9
        Me.Radio_WriteOnce.Text = "一回転送"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(24, 21)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(64, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "転送条件："
        '
        'Radio_WriteRing
        '
        Me.Radio_WriteRing.Location = New System.Drawing.Point(216, 20)
        Me.Radio_WriteRing.Name = "Radio_WriteRing"
        Me.Radio_WriteRing.Size = New System.Drawing.Size(88, 16)
        Me.Radio_WriteRing.TabIndex = 10
        Me.Radio_WriteRing.Text = "無限回転送"
        '
        'Button_Ok
        '
        Me.Button_Ok.Location = New System.Drawing.Point(312, 248)
        Me.Button_Ok.Name = "Button_Ok"
        Me.Button_Ok.Size = New System.Drawing.Size(80, 24)
        Me.Button_Ok.TabIndex = 0
        Me.Button_Ok.Text = "OK"
        '
        'Button_Cancel
        '
        Me.Button_Cancel.Location = New System.Drawing.Point(408, 248)
        Me.Button_Cancel.Name = "Button_Cancel"
        Me.Button_Cancel.Size = New System.Drawing.Size(80, 24)
        Me.Button_Cancel.TabIndex = 1
        Me.Button_Cancel.Text = "ｷｬﾝｾﾙ"
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label5, Me.Edit_NotifyNumber})
        Me.GroupBox1.Location = New System.Drawing.Point(16, 193)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(480, 48)
        Me.GroupBox1.TabIndex = 11
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "転送個数イベント通知"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(144, 20)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(80, 14)
        Me.Label5.TabIndex = 1
        Me.Label5.Text = "データ毎に通知"
        '
        'Edit_NotifyNumber
        '
        Me.Edit_NotifyNumber.Location = New System.Drawing.Point(24, 16)
        Me.Edit_NotifyNumber.Name = "Edit_NotifyNumber"
        Me.Edit_NotifyNumber.Size = New System.Drawing.Size(112, 19)
        Me.Edit_NotifyNumber.TabIndex = 11
        Me.Edit_NotifyNumber.Text = "TextBox1"
        Me.Edit_NotifyNumber.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'M_ConditionDlg
        '
        Me.AcceptButton = Me.Button_Ok
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
        Me.ClientSize = New System.Drawing.Size(504, 278)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button_Ok, Me.STATICc, Me.STATIC1, Me.Button_Cancel, Me.GroupBox1})
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "M_ConditionDlg"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "マスターサンプリング条件設定"
        Me.STATIC1.ResumeLayout(False)
        Me.STATICc.ResumeLayout(False)
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Dim Ret As Integer                       '戻り値
    Public Shared NumberOfData As Integer
    Public Shared IsRing As Integer
    Dim szError As New StringBuilder("", 256)

    '=========================================================
    ' フォームロード
    '=========================================================
    Private Sub M_CONDITIONDLG_DIALOG_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load

        '--------------------------------
        ' 画面項目の初期化
        '--------------------------------
        NumberOfData = 500
        IsRing = DIODM_WRITE_ONCE
        Edit_Pattern.Text = "55"
        Edit_Mask.Text = "FF"
        Edit_InternalClock.Text = "1000"
        Edit_StopNum.Text = "1000"
        Edit_NotifyNumber.Text = "500"
        Radio_WriteOnce.Checked = True
        '--------------------------------
        ' スタート条件初期化
        '--------------------------------
        With Combo_StartTrg
            .Items.Clear()
            .Items.Add(("Software Start"))
            .Items.Add(("External UP"))
            .Items.Add(("External Down"))
            .Items.Add(("Pattern"))
            .SelectedIndex = 0
        End With
        '--------------------------------
        ' クロック条件初期化
        '--------------------------------
        With Combo_ClockTrg
            .Items.Clear()
            .Items.Add(("Internal Clock"))
            .Items.Add(("External Clock"))
            .Items.Add(("Hand Shake"))
            .SelectedIndex = 0
        End With
        '--------------------------------
        ' ストップ条件初期化
        '--------------------------------
        With Combo_StopTrg
            .Items.Clear()
            .Items.Add(("Software Stop"))
            .Items.Add(("External UP"))
            .Items.Add(("External Down"))
            .Items.Add(("Number"))
            .SelectedIndex = 0
        End With

        COMBO_START_TRG_SelectedIndexChanged(Combo_StartTrg, New System.EventArgs())
        COMBO_CLOCK_TRG_SelectedIndexChanged(Combo_ClockTrg, New System.EventArgs())
        COMBO_STOP_TRG_SelectedIndexChanged(Combo_StopTrg, New System.EventArgs())
    End Sub

    '=========================================================
    ' スタート条件設定変更
    '=========================================================
    Private Sub COMBO_START_TRG_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Combo_StartTrg.SelectedIndexChanged
        '--------------------------------
        ' 比較パターン、マスクの有効、無効を切り替え
        '--------------------------------
        If (Combo_StartTrg.Text = "Pattern") Then
            Edit_Pattern.Enabled = True
            Edit_Mask.Enabled = True
        Else
            Edit_Pattern.Enabled = False
            Edit_Mask.Enabled = False
        End If
    End Sub

    '=========================================================
    ' クロック条件設定変更
    '=========================================================
    Private Sub COMBO_CLOCK_TRG_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Combo_ClockTrg.SelectedIndexChanged
        '--------------------------------
        ' 内部クロックの有効、無効を切り替え
        '--------------------------------
        If (Combo_ClockTrg.Text = "Internal Clock") Then
            Edit_InternalClock.Enabled = True
        Else
            Edit_InternalClock.Enabled = False
        End If
    End Sub

    '=========================================================
    ' ストップ条件設定変更
    '=========================================================
    Private Sub COMBO_STOP_TRG_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Combo_StopTrg.SelectedIndexChanged
        '--------------------------------
        ' 停止個数の有効、無効を切り替え
        '--------------------------------
        If (Combo_StopTrg.Text = "Number") Then
            Edit_StopNum.Enabled = True
        Else
            Edit_StopNum.Enabled = False
        End If
    End Sub

    '=========================================================
    ' OKボタン
    '=========================================================
    Private Sub BUTTON_OK_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_Ok.Click
        Dim StartTrg As Short
        Dim ClockTrg As Short
        Dim StopTrg As Short
        Dim Direction As Short
        Dim ExtSig1 As Short
        Dim ExtSig2 As Short
        Dim ExtSig3 As Short

        '--------------------------------
        ' 表示データを取得
        '--------------------------------
        NumberOfData = Val(Edit_NotifyNumber.Text)
        If Radio_WriteOnce.Checked = True Then
            IsRing = DIODM_WRITE_ONCE
        Else
            IsRing = DIODM_WRITE_RING
        End If
        '--------------------------------
        ' 設定値を数値に変換
        '--------------------------------
        '--------------------------------
        ' スタート条件
        '--------------------------------
        StartTrg = 0
        ExtSig2 = 0
        If Combo_StartTrg.Text = "Software Start" Then
            StartTrg = DIODM_START_SOFT
            ExtSig2 = DIODM_EXT_START_SOFT_IN
        End If
        If Combo_StartTrg.Text = "External UP" Then
            StartTrg = DIODM_START_EXT_RISE
            ExtSig2 = DIODM_EXT_START_EXT_RISE_IN
        End If
        If Combo_StartTrg.Text = "External Down" Then
            StartTrg = DIODM_START_EXT_FALL
            ExtSig2 = DIODM_EXT_START_EXT_FALL_IN
        End If
        If Combo_StartTrg.Text = "Pattern" Then
            StartTrg = DIODM_START_PATTERN
            ExtSig2 = DIODM_EXT_START_PATTERN_IN
        End If
        '--------------------------------
        ' クロック条件
        '--------------------------------
        ClockTrg = 0
        ExtSig1 = 0
        If Combo_ClockTrg.Text = "Internal Clock" Then
            ClockTrg = DIODM_CLK_CLOCK
            ExtSig1 = DIODM_EXT_CLOCK_IN
        End If
        If Combo_ClockTrg.Text = "External Clock" Then
            ClockTrg = DIODM_CLK_EXT_TRG
            ExtSig1 = DIODM_EXT_EXT_TRG_IN
        End If
        If Combo_ClockTrg.Text = "Hand Shake" Then
            ClockTrg = DIODM_CLK_HANDSHAKE
            ExtSig1 = DIODM_EXT_HANDSHAKE_IN
        End If
        '--------------------------------
        ' ストップ条件
        '--------------------------------
        StopTrg = 0
        ExtSig3 = 0
        If Combo_StopTrg.Text = "Software Stop" Then
            StopTrg = DIODM_STOP_SOFT
            ExtSig3 = DIODM_EXT_STOP_SOFT_IN
        End If
        If Combo_StopTrg.Text = "External UP" Then
            StopTrg = DIODM_STOP_EXT_RISE
            ExtSig3 = DIODM_EXT_STOP_EXT_RISE_IN
        End If
        If Combo_StopTrg.Text = "External Down" Then
            StopTrg = DIODM_STOP_EXT_FALL
            ExtSig3 = DIODM_EXT_STOP_EXT_FALL_IN
        End If
        If Combo_StopTrg.Text = "Number" Then
            StopTrg = DIODM_STOP_NUM
            ExtSig3 = DIODM_EXT_TRNSNUM_IN
        End If
        '--------------------------------
        ' サンプリング条件を設定
        '--------------------------------
        Direction = DIODM_DIR_IN
        '--------------------------------
        ' 入出力方向設定(全点入力)
        '--------------------------------
        Ret = DioDmSetDirection(Sync.M_Id, PI_32)
        If Ret <> 0 Then
            Call DioGetErrorString(Ret, szError)
            MsgBox("DioDmSetDirection Ret = " & Ret & ":" & szError.ToString(), 0, "Sync")
            Exit Sub
        End If
        '--------------------------------
        ' マスター設定
        '--------------------------------
        Ret = DioDmSetMaster(Sync.M_Id, ExtSig1, ExtSig2, ExtSig3, 1, 1)
        If Ret <> 0 Then
            Call DioGetErrorString(Ret, szError)
            MsgBox("DioDmSetMaster Ret = " & Ret & ":" & szError.ToString(), 0, "Sync")
            Exit Sub
        End If
        '--------------------------------
        ' スタート条件設定
        '--------------------------------
        Ret = DioDmSetStartTrigger(Sync.M_Id, Direction, StartTrg)
        If Ret <> 0 Then
            Call DioGetErrorString(Ret, szError)
            MsgBox("DioDmSetStartTrigger Ret = " & Ret & ":" & szError.ToString(), 0, "Sync")
            Exit Sub
        End If
        '--------------------------------
        ' クロック条件設定
        '--------------------------------
        Ret = DioDmSetClockTrigger(Sync.M_Id, Direction, ClockTrg)
        If Ret <> 0 Then
            Call DioGetErrorString(Ret, szError)
            MsgBox("DioDmSetClockTrigger Ret = " & Ret & ":" & szError.ToString(), 0, "Sync")
            Exit Sub
        End If
        '--------------------------------
        ' ストップ条件設定
        '--------------------------------
        Ret = DioDmSetStopTrigger(Sync.M_Id, Direction, StopTrg)
        If Ret <> 0 Then
            Call DioGetErrorString(Ret, szError)
            MsgBox("DioDmSetStopTrigger Ret = " & Ret & ":" & szError.ToString(), 0, "Sync")
            Exit Sub
        End If
        '--------------------------------
        ' パターン/マスク
        '--------------------------------
        Ret = DioDmSetStartPattern(Sync.M_Id, Val("&H" & Edit_Pattern.Text), Val("&H" & Edit_Mask.Text))
        If Ret <> 0 Then
            Call DioGetErrorString(Ret, szError)
            MsgBox("DioDmSetStartPattern Ret = " & Ret & ":" & szError.ToString(), 0, "Sync")
            Exit Sub
        End If
        '--------------------------------
        ' 内部クロック値設定
        '--------------------------------
        Ret = DioDmSetInternalClock(Sync.M_Id, Direction, Val(Edit_InternalClock.Text), DIODM_TIM_UNIT_NS)
        If Ret <> 0 Then
            Call DioGetErrorString(Ret, szError)
            MsgBox("DioDmSetInternalClock Ret = " & Ret & ":" & szError.ToString(), 0, "Sync")
            Exit Sub
        End If
        '--------------------------------
        ' 停止個数設定
        '--------------------------------
        Ret = DioDmSetStopNumber(Sync.M_Id, Direction, Val(Edit_StopNum.Text))
        If Ret <> 0 Then
            Call DioGetErrorString(Ret, szError)
            MsgBox("DioDmSetStopNumber Ret = " & Ret & ":" & szError.ToString(), 0, "Sync")
            Exit Sub
        End If
        Hide()
    End Sub

    '=========================================================
    ' キャンセルボタン
    '=========================================================
    Private Sub BUTTON_CANCEL_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button_Cancel.Click
        Hide()
    End Sub

End Class