public ConfigXmlControl(ConfigFile file, OperationsController controller)
        {
            InitializeComponent();

            _dataContext = file;
            _controller = controller;
            labelFileName.Text = file.Path;
            dgvConfig.DataSource = file.ConfigElements;
        }
 public void SaveConfig(ConfigFile file)
 {
     try
     {
         _repository.CommitChanges(file);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error " + ex.Message);
     }
 }
 public void DeleteConfig(ConfigFile file)
 {
     try
     {
         _repository.RemoveFile(file);
         FilesChanged(this, EventArgs.Empty);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error " + ex.Message);
     }
 }
 public void AddNewConfigRec(ConfigFile file)
 {
     try
     {
         file.ConfigElements.Add(new ConfigElementM());
         FilesChanged(this, EventArgs.Empty);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error " + ex.Message);
     }
 }
Ejemplo n.º 5
0
 private void AddConfigXmlControl(ConfigFile configFile)
 {
     var configXmlControl = new ConfigXmlControl(configFile, _controller);
     panelConfigs.Controls.Add(configXmlControl);
     OrderControls(configXmlControl);
 }
 public void RemoveFile(ConfigFile file)
 {
     if (File.Exists(file.Path))
         File.Delete(file.Path);
     FilesList.Remove(file);
 }
 public void CommitChanges(ConfigFile configFile)
 {
     Serialize(configFile.Path, configFile.ConfigElements);
 }
 public ConfigFile AddNew(string fileName)
 {
     var file = new ConfigFile(Path.Combine(_repositoryPath,fileName), new BindingList<ConfigElementM>());
     FilesList.Add(file);
     return file;
 }