Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics; // Debug クラス使用のために必要
namespace WindowsFormsApp
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void mnuConfJV_Click(object sender, EventArgs e)
{
try
{
// リターンコード
int nReturnCode;
// 設定画面表示
nReturnCode = AxJVLink1.JVSetUIProperties();
if (nReturnCode != 0)
{
MessageBox.Show("JVSetUIPropertiesエラー コード:" + nReturnCode + ":", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception ex)
{
}
}
private void frmMain_Load(object sender, EventArgs e)
{
string sid;
int nReturnCode;
// 引数設定
sid = "Test";
// JVLink 初期化
nReturnCode = AxJVLink1.JVInit(sid);
// エラー判定
if (nReturnCode != 0)
{
MessageBox.Show("JVInit エラー コード:" + nReturnCode + ":", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
Cursor = System.Windows.Forms.Cursors.Default;
}
}
private void btnGetJVData_Click(object sender, EventArgs e)
{
int nReturnCode;
try
{
string strDataSpec; // JVOpen: ファイル識別子
string strFromTime; // JVOpen: データ提供日付
int nOption; // JVOpen: オプション
int nReadCount; // JVOpen: 戻り値
int nDownloadCount; // JVOpen: 総ダウンロードファイル数
string strLastFileTimestamp; // JVOpen: 最新ファイルのタイムスタンプ゚
// 引数設定
strDataSpec = "RACE";
strFromTime = "20050301000000";
nOption = 2;
nReadCount = 0;
nDownloadCount = 0;
// JVLink ダウンロード処理
nReturnCode = AxJVLink1.JVOpen(strDataSpec, strFromTime, nOption, ref nReadCount, ref nDownloadCount, out strLastFileTimestamp);
// エラー判定
if (nReturnCode != 0)
{
MessageBox.Show("JVOpen エラー:" + nReturnCode);
}
else
{
MessageBox.Show(
"戻り値 : " + nReturnCode + "\n" +
"読み込みファイル数 : " + nReadCount + "\n" +
"ダウンロードファイル数 : " + nDownloadCount + "\n" +
"タイムスタンプ : " + strLastFileTimestamp);
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
return;
}
// JVLink 終了処理
nReturnCode = AxJVLink1.JVClose();
if (nReturnCode != 0)
{
MessageBox.Show("JVClose エラー:" + nReturnCode);
}
}
}
}