Example #1
0
        private void startFile(string fileName)
        {
            int count = 0;

            if (fileName.LastIndexOf(".txt") > -1)
            {
                count = EditionTXT.file_readTXT(fileName);
            }
            else if (fileName.LastIndexOf(".html") > -1)
            {
                count = EditionHTML.readHTML(fileName);
            }
            else if (fileName.LastIndexOf(".json") > -1)
            {
                count = EditionJson.ReadJSON(fileName);
            }

            if (count == 0)
            {
                MessageBox.Show($"В данном файле вопросы не обнаруженны!");
            }
            else
            {
                var result = MessageBox.Show($"Добавлено {count} вопросов.\n\n Закрыть окно?", "Успех!", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    this.Close();
                }
            }
        }
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            input_header.Background = Brushes.White;
            nameFile.Background     = Brushes.White;
            string nameANDformat = nameFile.Text;

            if (nameFile.Text == "")
            {
                nameFile.Background = Brushes.Yellow;
                MessageBox.Show("Необходимо указать имя для сохраняемого файла"); return;
            }
            if (ComboBox_FormatSave.SelectedIndex == 0)
            {
                if (input_header.Text == "")
                {
                    input_header.Background = Brushes.Yellow;
                    MessageBox.Show("Не указан заголовок для HTML чек-листа"); return;
                }
                nameANDformat += ".html";
                setupHTML();
                EditionHTML.bilderHTML(nameANDformat);
            }
            else if (ComboBox_FormatSave.SelectedIndex == 1)
            {
                nameANDformat += ".txt";
                EditionTXT.WriteInTXT(nameANDformat);
            }
            else if (ComboBox_FormatSave.SelectedIndex == 2)
            {
                nameANDformat += ".json";
                EditionJson.WriteJSON(nameANDformat, (bool)CB_spoilerIf.IsChecked, (bool)CB_lineThrough.IsChecked);
            }

            var result = MessageBox.Show($"Файл {nameANDformat} успешно создан\n Хотите открыть файл?",
                                         "Информация", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                string forever_papka = Environment.CurrentDirectory + "\\" + nameANDformat;
                System.Diagnostics.Process.Start("explorer", forever_papka);
            }
        }
 private void Windows_HTNLSetup_Loaded(object sender, RoutedEventArgs e)
 {
     EditionHTML.DefaultCSS(); //устанавливает css по умолчанию
     CreateComboBox_FontSize();
     TabHTMLColor.Content = new PageColorHTML();
 }