Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Xml.XPath;
- using System.Text;
- using System.Windows.Forms;
- namespace Kana {
- public partial class frmMain : Form {
- public frmMain() {
- InitializeComponent();
- }
- //IEnumerable<System.Collections.Generic.KeyValuePair<string,string>> selectedKana
- private void btnTest_Click(object sender, EventArgs e) {
- /*
- Create XPath Document, XPath Navigator, and Node "Selector"
- Used to Select a Random Kana based on the Users Choice in the combo box
- */
- XPathNavigator nav;
- XPathDocument docNav;
- XPathNodeIterator NodeIter;
- String strExpression;
- docNav = new XPathDocument(@"C:\Users\Owner\Documents\Visual Studio 2010\Projects\Kana\Kana\Kana.xml");
- nav = docNav.CreateNavigator();
- Random basic = new Random();
- int result;
- if (cboKana.SelectedIndex == 0) { //SELECT VOWELS
- Data.aiueo.init();
- if (radHirg.Checked) { //HIRIGANA
- strExpression="/kana/hirg/aiueo/*";
- result = basic.Next(0, 4);
- switch (result) {
- case 0:
- strExpression = Data.aiueo.hirg[0];
- break;
- case 1:
- strExpression = Data.aiueo.hirg[1];
- break;
- case 2:
- strExpression = Data.aiueo.hirg[2];
- break;
- case 3:
- strExpression = Data.aiueo.hirg[3];
- break;
- case 4:
- strExpression = Data.aiueo.hirg[4];
- break;
- }
- nav.Evaluate(strExpression);
- NodeIter = nav.Select(strExpression);
- while (NodeIter.MoveNext()) {
- string value = NodeIter.Current.GetAttribute("value","");
- //txtRomaniji.Text = value + "\n";
- lblKana.Text = value;
- }
- }else if(radKata.Checked){ //KATAKANA
- strExpression = "/kana/kata/aiueo/*";
- result = basic.Next(0, 4);
- switch (result) {
- case 0:
- strExpression = Data.aiueo.kata[0];
- break;
- case 1:
- strExpression = Data.aiueo.kata[1];
- break;
- case 2:
- strExpression = Data.aiueo.kata[2];
- break;
- case 3:
- strExpression = Data.aiueo.kata[3];
- break;
- case 4:
- strExpression = Data.aiueo.kata[4];
- break;
- }
- nav.Evaluate(strExpression);
- NodeIter = nav.Select(strExpression);
- while (NodeIter.MoveNext()) {
- string value = NodeIter.Current.GetAttribute("value", "");
- lblKana.Text = value;
- }
- }else if (radMixed.Checked) { //MIXED
- strExpression="//aiueo/*";
- result = basic.Next(0, 9);
- switch (result) {
- case 0:
- strExpression = Data.aiueo.mixed[0];
- break;
- case 1:
- strExpression = Data.aiueo.mixed[1];
- break;
- case 2:
- strExpression = Data.aiueo.mixed[2];
- break;
- case 3:
- strExpression = Data.aiueo.mixed[3];
- break;
- case 4:
- strExpression = Data.aiueo.mixed[4];
- break;
- case 5:
- strExpression = Data.aiueo.mixed[5];
- break;
- case 6:
- strExpression = Data.aiueo.mixed[6];
- break;
- case 7:
- strExpression = Data.aiueo.mixed[7];
- break;
- case 8:
- strExpression = Data.aiueo.mixed[8];
- break;
- case 9:
- strExpression = Data.aiueo.mixed[9];
- break;
- }
- nav.Evaluate(strExpression);
- NodeIter = nav.Select(strExpression);
- while (NodeIter.MoveNext()) {
- string value = NodeIter.Current.GetAttribute("value", "");
- lblKana.Text = value;
- }
- }
- } else if (cboKana.SelectedIndex == 1) { //SELECT KA KI KU KE KO
- //ka/ki/ku/ke/ko
- Data.kSeries.init();
- if (radHirg.Checked){
- result = basic.Next(0, 4);
- strExpression = "/kana/hirg/kSeries/*";
- switch (result) {
- case 0:
- strExpression = Data.kSeries.hirg[0];
- break;
- case 1:
- strExpression = Data.kSeries.hirg[1];
- break;
- case 2:
- strExpression = Data.kSeries.hirg[2];
- break;
- case 3:
- strExpression = Data.kSeries.hirg[3];
- break;
- case 4:
- strExpression = Data.kSeries.hirg[4];
- break;
- }
- nav.Evaluate(strExpression);
- NodeIter = nav.Select(strExpression);
- while (NodeIter.MoveNext()) {
- string value = NodeIter.Current.GetAttribute("value", "");
- lblKana.Text = value;
- }
- }else if(radKata.Checked){
- strExpression = "/kana/kata/kSeries/*";
- result = basic.Next(0, 4);
- switch (result) {
- case 0:
- strExpression = Data.kSeries.kata[0];
- break;
- case 1:
- strExpression = Data.kSeries.kata[1];
- break;
- case 2:
- strExpression = Data.kSeries.kata[2];
- break;
- case 3:
- strExpression = Data.kSeries.kata[3];
- break;
- case 4:
- strExpression = Data.kSeries.kata[4];
- break;
- }
- nav.Evaluate(strExpression);
- NodeIter = nav.Select(strExpression);
- while (NodeIter.MoveNext()) {
- string value = NodeIter.Current.GetAttribute("value", "");
- lblKana.Text = value;
- }
- }else if(radMixed.Checked){
- strExpression = "//kSeries/*";
- result = basic.Next(0, 9);
- switch (result) {
- case 0:
- strExpression = Data.kSeries.mixed[0];
- break;
- case 1:
- strExpression = Data.kSeries.mixed[1];
- break;
- case 2:
- strExpression = Data.kSeries.mixed[2];
- break;
- case 3:
- strExpression = Data.kSeries.mixed[3];
- break;
- case 4:
- strExpression = Data.kSeries.mixed[4];
- break;
- case 5:
- strExpression = Data.kSeries.mixed[5];
- break;
- case 6:
- strExpression = Data.kSeries.mixed[6];
- break;
- case 7:
- strExpression = Data.kSeries.mixed[7];
- break;
- case 8:
- strExpression = Data.kSeries.mixed[8];
- break;
- case 9:
- strExpression = Data.kSeries.mixed[9];
- break;
- }
- nav.Evaluate(strExpression);
- NodeIter = nav.Select(strExpression);
- while (NodeIter.MoveNext()) {
- string value = NodeIter.Current.GetAttribute("value", "");
- lblKana.Text = value;
- }
- }
- } else if (cboKana.SelectedIndex == 2) { //SELECT SA SHI KU KE KO
- //sa/shi/su/se/so
- Data.sSeries.init();
- if (radHirg.Checked) {
- strExpression = "/kana/hirg/sSeries/*";
- result = basic.Next(0, 4);
- switch (result) {
- case 0:
- strExpression = Data.sSeries.hirg[0];
- break;
- case 1:
- strExpression = Data.sSeries.hirg[1];
- break;
- case 2:
- strExpression = Data.sSeries.hirg[2];
- break;
- case 3:
- strExpression = Data.sSeries.hirg[3];
- break;
- case 4:
- strExpression = Data.sSeries.hirg[4];
- break;
- }
- nav.Evaluate(strExpression);
- NodeIter = nav.Select(strExpression);
- while (NodeIter.MoveNext()) {
- string value = NodeIter.Current.GetAttribute("value", "");
- lblKana.Text = value;
- }
- }else if(radKata.Checked) {
- strExpression = "/kana/kata/sSeries/*";
- result = basic.Next(0, 4);
- switch (result) {
- case 0:
- strExpression = Data.sSeries.kata[0];
- break;
- case 1:
- strExpression = Data.sSeries.kata[1];
- break;
- case 2:
- strExpression = Data.sSeries.kata[2];
- break;
- case 3:
- strExpression = Data.sSeries.kata[3];
- break;
- case 4:
- strExpression = Data.sSeries.kata[4];
- break;
- }
- nav.Evaluate(strExpression);
- NodeIter = nav.Select(strExpression);
- while (NodeIter.MoveNext()) {
- string value = NodeIter.Current.GetAttribute("value", "");
- lblKana.Text = value;
- }
- }else if(radMixed.Checked) {
- strExpression = "//sSeries/*";
- result = basic.Next(0, 9);
- switch (result) {
- case 0:
- strExpression = Data.sSeries.mixed[0];
- break;
- case 1:
- strExpression = Data.sSeries.mixed[1];
- break;
- case 2:
- strExpression = Data.sSeries.mixed[2];
- break;
- case 3:
- strExpression = Data.sSeries.mixed[3];
- break;
- case 4:
- strExpression = Data.sSeries.mixed[4];
- break;
- case 5:
- strExpression = Data.sSeries.mixed[5];
- break;
- case 6:
- strExpression = Data.sSeries.mixed[6];
- break;
- case 7:
- strExpression = Data.sSeries.mixed[7];
- break;
- case 8:
- strExpression = Data.sSeries.mixed[8];
- break;
- case 9:
- strExpression = Data.sSeries.mixed[9];
- break;
- }
- nav.Evaluate(strExpression);
- NodeIter = nav.Select(strExpression);
- while (NodeIter.MoveNext()) {
- string value = NodeIter.Current.GetAttribute("value", "");
- lblKana.Text = value;
- }
- }
- }else if(cboKana.SelectedIndex ==3){
- //ta/chi/tsu/te/to
- Data.tSeries.init();
- if (radHirg.Checked){
- strExpression = "/kana/hirg/tSeries/*";
- result = basic.Next(0, 4);
- }else if (radKata.Checked){
- strExpression = "/kana/kata/tSeries/*";
- result = basic.Next(0, 4);
- }else if(radMixed.Checked){
- strExpression = "//tSeries/*";
- result = basic.Next(0, 9);
- }
- }else if(cboKana.SelectedIndex == 4){
- Data.nSeries.init();
- if (radHirg.Checked){
- strExpression = "/kana/hirg/nSeries/*";
- result = basic.Next(0, 4);
- }else if(radKata.Checked){
- strExpression = "/kana/kata/nSeries/*";
- result = basic.Next(0, 4);
- }else if(radMixed.Checked){
- strExpression = "//nSeries/*";
- result = basic.Next(0, 4);
- }
- }else if (cboKana.SelectedIndex == 5){
- //ha/hi/fu/he/ho
- Data.hSeries.init();
- if(radHirg.Checked){
- strExpression = "/kana/hirg/hSeries/*";
- result = basic.Next(0, 4);
- }else if(radKata.Checked){
- strExpression = "/kana/kata/hSeries/*";
- result = basic.Next(0, 4);
- }else if(radMixed.Checked) {
- strExpression = "//hSeries/*";
- result = basic.Next(0, 9);
- }
- }else if(cboKana.SelectedIndex == 6) {
- Data.mSeries.init();
- if (radHirg.Checked) {
- strExpression = "/kana/hirg/mSeries/*";
- result = basic.Next(0, 4);
- }else if (radKata.Checked){
- strExpression = "/kana/kata/mSeries/*";
- result = basic.Next(0, 4);
- }else if(radMixed.Checked){
- strExpression = "//mSeries/*";
- result = basic.Next(0, 9);
- }
- }else if (cboKana.SelectedIndex == 7){
- //ya/yu/yo
- Data.ySeries.init();
- if (radHirg.Checked) {
- strExpression = "/kana/hirg/ySeries/*";
- result = basic.Next(0, 2);
- switch (result) {
- case 0:
- break;
- case 1:
- break;
- case 2:
- break;
- }
- }else if (radKata.Checked) {
- strExpression = "/kana/kata/ySeries/*";
- result = basic.Next(0, 2);
- }else if(radMixed.Checked){
- strExpression = "//ySeries/*";
- result = basic.Next(0, 5);
- }
- }else if(cboKana.SelectedIndex == 8) {
- //ra/ri/ru/ru/re/ro
- if (radHirg.Checked) {
- strExpression = "/kana/hirg/rSeries/*";
- result = basic.Next(0, 4);
- }else if(radKata.Checked){
- strExpression = "/kana/kata/rSeries/*";
- result = basic.Next(0, 4);
- }else if (radMixed.Checked){
- strExpression = "//rSeries/*";
- result = basic.Next(0, 9);
- }
- }else if (cboKana.SelectedIndex == 9) {
- //wa/wo/n
- if (radHirg.Checked) {
- strExpression = "/kana/hirg/wSeries/*";
- result = basic.Next(0, 2);
- } else if (radKata.Checked) {
- strExpression = "/kana/kata/wSeries/*";
- result = basic.Next(0, 2);
- } else if (radMixed.Checked) {
- strExpression = "//wSeries/*";
- result = basic.Next(0, 9);
- }
- }else if(cboKana.SelectedIndex == 10){
- //Basic Kanas
- }else if(cboKana.SelectedIndex == 11){
- //combo Kana Part 1 (Tintin/Bubble)
- }else if(cboKana.SelectedIndex == 12){
- //cboKana Part 2 (combo[Letter])
- }else if(cboKana.SelectedIndex == 13){
- //All Kana
- }
- } //btn_Test
- private void Form1_Load(object sender, EventArgs e) {
- cboKana.Items.Add("a-i-u-e-o");//0
- cboKana.Items.Add("ka-ki-ku-ke-ko");//1
- cboKana.Items.Add("sa-shi-su-se-so");//2
- cboKana.Items.Add("ta-chi-tsu-te-to");//3
- cboKana.Items.Add("na-ni-nu-ne-no");//4
- cboKana.Items.Add("ha-hi-fu-he-ho");//5
- cboKana.Items.Add("ma-mi-mu-me-mo");//6
- cboKana.Items.Add("ya-yu-yo");//7
- cboKana.Items.Add("ra-ri-ru-re-ro");//8
- cboKana.Items.Add("wa-wo-n");//9
- cboKana.Items.Add("Basic Kanas"); //10
- cboKana.Items.Add("Combo Kanas Part 1");//11
- cboKana.Items.Add("Combo Kanas Part 2");//12
- cboKana.Items.Add("All Kanas");//13
- cboKana.SelectedIndex = 10;
- }//form_load
- private void txtRomaniji_TextChanged(object sender, EventArgs e) {
- }
- }//partial Class Form 1
- }//end namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement