Exemplo n.º 1
0
 public void OpenJson()
 {
     _state = 1;
     ChooseText();
     StreamReader sr = new StreamReader(GetText);
     string temp = sr.ReadToEnd();
     dialogs = JsonConvert.DeserializeObject<DialogsClass>(temp);
     sr.Close();
 }
Exemplo n.º 2
0
        private void новыйДиалогToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try {
                FileDialog.ShowDialog();

                _path = FileDialog.FileName;
                StreamReader sr = new StreamReader(_path);

                dialogs = JsonConvert.DeserializeObject<DialogsClass>(sr.ReadToEnd());
                sr.Close();
                NextQuestion();
            } catch (Exception) {
                MessageBox.Show("Неверный формат файла.");
            }
        }
Exemplo n.º 3
0
        private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FileDialog.ShowDialog();
            try {
                _path = FileDialog.FileName;
                StreamReader sr = new StreamReader(_path);

                dialogs = JsonConvert.DeserializeObject<DialogsClass>(sr.ReadToEnd());
                ShowDialogs();
                sr.Close();
            } catch (Exception) {
                MessageBox.Show("Такого файла нет");
            }
        }
Exemplo n.º 4
0
 public int searchdialog(DialogsClass d, string t)
 {
     for (int i = 0; i < d.Dialogs.Length; i++)
     {
         if (d.Dialogs[i].Name == t)
         {
             return i;
         }
     }
     return -1;
 }
Exemplo n.º 5
0
        private void enter_Click(object sender, EventArgs e)
        {
            if (LableText.Text == "Введите имя файла") {
                _path = textBox.Text;
                dialogs = new DialogsClass();
                _state = 0;
                ShowDialogs();

            } else {
                switch (_state) {
                    case 0:
                        //if(NowDialog.Questions!=null)
                        _state = 1;
                        break;
                    case 1:
                        //if(NowQuestion.Answers!=null)
                        _state = 2;
                        break;
                    case 2:
                        //if(NowAnswer.JumpTo!=null)
                        _state = 3;
                        break;
                    case 3:
                        break;

                }
                Show1();
            }
        }