Example #1
0
        private void importButton_Click(object sender, EventArgs e)
        {
            string            message = "";
            string            caption = "";
            MessageBoxButtons buttons = MessageBoxButtons.OK;

            if (filePathImportTextBox.Text != "")
            {
                Preset currentPreset = JsonConverter.ConvertFromJson(_filePathImport);
                string newFilepath;
                #region Checks the value of the imported PresetSettings and requests new ones if needed
                foreach (PresetSetting presetSetting in currentPreset.PresetSettings)
                {
                    if (presetSetting.PresetSettingType == "File" || presetSetting.PresetSettingType == "Background")
                    {
                        if (!File.Exists(presetSetting.Value))
                        {
                            message = "Please select a valid file path for " + presetSetting.Name + "!";
                            caption = presetSetting.Name + " does not contain a valid file path!";
                            DialogResult importRequest = MessageBox.Show(message, caption, buttons);
                            newFilepath         = FileBrowserDialogue.GetFullFilePath();
                            presetSetting.Value = newFilepath;
                        }
                    }
                }
                #endregion
                _presetRepository.Update(currentPreset);
                message = "Successfully imported " + currentPreset.Name + "!";
                caption = "Import successful!";
                DialogResult importSuccessful = MessageBox.Show(message, caption, buttons);
                UpdateGrid();
            }
            else
            {
                message = "Please sellect a valid file path to import from!";
                caption = "Invalid import file path!";
                DialogResult success = MessageBox.Show(message, caption, buttons);
            }
        }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     _filePath            = FileBrowserDialogue.GetFullFilePath();
     FilePathTextBox.Text = _filePath;
 }
Example #3
0
 private void getFilePathButton_Click(object sender, EventArgs e)
 {
     _filePath         = FileBrowserDialogue.GetFullFilePath();
     valueTextBox.Text = _filePath;
 }
Example #4
0
 private void filePathImportButton_Click(object sender, EventArgs e)
 {
     _filePathImport            = FileBrowserDialogue.GetFullFilePath();
     filePathImportTextBox.Text = _filePathImport;
 }
Example #5
0
 private void filePathButton_Click(object sender, EventArgs e)
 {
     _filePathExport      = FileBrowserDialogue.GetFolderPath();
     _filePathExport     += (_filePathExport[_filePathExport.Length - 1] == '\\') ? "Export.json" : "\\Export.json";
     filePathTextBox.Text = _filePathExport;
 }