Пример #1
0
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileBrowser = new OpenFileDialog();

            switch (currentMode)
            {
            case CurrentMode.Text:
                fileBrowser.Multiselect = false;
                break;

            case CurrentMode.FileList:
                fileBrowser.Multiselect = true;
                break;
            }

            fileBrowser.ShowDialog();
            switch (currentMode)
            {
            case CurrentMode.Text:
                TextUtility.LoadTextToTextBox(textBox_Content, fileBrowser.FileName);
                break;

            case CurrentMode.FileList:
                FileListUtility.AppendFileList(fileListItems, fileBrowser.FileNames);
                break;
            }
        }
Пример #2
0
        private void button_Select_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileBrowser = new OpenFileDialog();

            fileBrowser.Multiselect = true;
            fileBrowser.ShowDialog();
            FileListUtility.AppendFileList(fileListItems, fileBrowser.FileNames);
        }
Пример #3
0
        private void Form_Main_DragDrop(object sender, DragEventArgs e)
        {
            string[] fileNames = (string[])e.Data.GetData(DataFormats.FileDrop, false);
            switch (currentMode)
            {
            case CurrentMode.Text:
                TextUtility.LoadTextToTextBox(textBox_Content, fileNames[0]);
                break;

            case CurrentMode.FileList:
                FileListUtility.AppendFileList(fileListItems, fileNames);
                break;
            }
        }
Пример #4
0
        private void button_Convert_Click(object sender, EventArgs e)
        {
            switch (currentMode)
            {
            case CurrentMode.Text:
                try
                {
                    textBox_Content.Text = Converter.Convert(textBox_Content.Text, configFileName);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }

                break;

            case CurrentMode.FileList:
                FileListUtility.ConvertAndStoreFilesInList(fileListItems, configFileName);
                break;
            }
        }
Пример #5
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog      fileBrowser   = new OpenFileDialog();
            FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
            DialogResult        dialogResult  = DialogResult.None;

            switch (currentMode)
            {
            case CurrentMode.Text:
                dialogResult = fileBrowser.ShowDialog();
                break;

            case CurrentMode.FileList:
                dialogResult = folderBrowser.ShowDialog();
                break;
            }

            if (dialogResult == DialogResult.OK)
            {
                switch (currentMode)
                {
                case CurrentMode.Text:
                    try
                    {
                        string result = Converter.Convert(textBox_Content.Text, configFileName);
                        System.IO.File.WriteAllText(fileBrowser.FileName, result, Encoding.UTF8);
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message);
                    }

                    break;

                case CurrentMode.FileList:
                    FileListUtility.ConvertAndStoreFilesInList(fileListItems, configFileName, folderBrowser.SelectedPath);
                    break;
                }
            }
        }