G3505_And_note_取消、コマンド設計

2025127

18:25

G3505_andoroid_and_note_prj_can_command

 

取消ボタンの設計

 

音声変換

 

 

本日表示

 

 

プログラムの処理モード代入関数追加

 

 

// プログラムモード代入

private void type_mane_set(string prm_type_nam)

{

Type_name = prm_type_nam;                // グローバル変数

But_tbl[4].Text = prm_type_nam;        // ボタン名称

}

 

 

 

switch(Type_name)

{

case "音声変換":

case "除外ワード登録":

if (Edt_tbl[0].Text.Length == 0)

{

type_mane_set("本日表示");

today_dsp();

}

else Edt_tbl[0].Text = "";

break;

 

case "本日表示":

type_mane_set("本日表示");

today_dsp();

break;

 

}

 

プログラム処理モードのテキスト一覧を作成します

 

 

 

 

 

プログラムの処理モードをカンマ区切りで登録します

 

 

 

 

 

 

 

 

 

 

コマンドを保存するグローバル変数の配列を作ります

 

 

public static string[] Type_name_tbl = new string[50 + 1];        // コマンドワード

public static string[] Type_mem_tbl = new string[50 + 1];   // コマンド解説

public static int Type_tbl_cnt;                                                        // 現在登録個数

public static string Type_fil_path = "";     // コマンドワードテキストパス

 

 

テキストファイルのパスを代入します

 

 

// コマンドテーブルを読み込みします

Type_fil_path = Path_files + @"/000_コマンド.txt";

Type_tbl_cnt = com_txt_tbl_red(Type_fil_path, 1, Type_mem_tbl);    // タイプメモ

Type_tbl_cnt = com_txt_tbl_red(Type_fil_path, 0, Type_name_tbl);    // タイプ名

// メモは空欄であるかもしれず、確実な件数を確保するため逆順にしています

 

// モニタ処理 確認後削除します

int cnt;

string tmp_cst = "";

for (cnt = 0; cnt < Type_tbl_cnt; cnt++)

{

tmp_cst += Type_name_tbl[cnt] + "\r\n";

}

Edt_tbl[0].Text = tmp_cst;

 

クリーンと配置で確認します

 

 

 

 

モニタは成功しています

 

 

タイプ名の検索関数を追加します

 

 

// タイプ名検索

private string type_name_sarch(string prm_type_name)

{

int cnt = 0;

string type_name = prm_type_name.Trim();

string ans_cst = "";

 

for (cnt = 0; cnt < Type_tbl_cnt; cnt++)

{

if(type_name == Type_name_tbl[cnt])

{

ans_cst = Type_name_tbl[cnt];        // 一致した場合

break;

}

}

return (ans_cst);

}

 

 

コマンドボタンの実験をします

 

 

 

Voice_cst = Edt_tbl[0].Text = "";

type_mane_set("コマンド");

voice_call();   // 音声変換呼び出し

 

 

case "コマンド":

tmp_cst = type_name_sarch(Edt_tbl[0].Text);

if(tmp_cst != "") type_mane_set(tmp_cst);

else type_mane_set("----- 未登録です -----");

break;

 

 

クリーン、配置で確認します

 

 

 

 

 

 

未登録ワードの場合メッセージが必要です

 

 

 

取消ボタンの処理を修正します

 

 

string edt_cst = Edt_tbl[0].Text.Trim();

 

switch (Type_name)

{

 

case "本日表示":

type_mane_set("本日表示");

today_dsp();

break;

default:

// ほとんどのモードでの取消動作です

// 取消動作をカスタマイズする場合は、ケースを追加します

if (edt_cst.Length == 0)

{

type_mane_set("本日表示");

today_dsp();

}

else Edt_tbl[0].Text = "";

break;

 

}

 

除外ワード登録の手順を変更します

 

 

 

 

switch (Type_name)

{

case "本日表示":

type_mane_set("本日表示");

today_dsp();

break;

case "除外ワード":

type_mane_set("除外ワード");

Edt_tbl[0].Text = Voice_cst = "";

 

voice_call();   // 音声変換呼び出し

break;

 

}

 

動作確認

 

 

 

 

 

 

 

 

 

除外ワードを「実行/保存」したときに、ワードはクリアします