// ReSharper restore FieldCanBeMadeReadOnly.Local public frmMain() { InitializeComponent(); _frmMySettings = new FrmSettings( _mySettings ); _patchIcons = new ImageList(); _patchIcons.Images.Add( Resources.Checked_Shield_Green ); _patchIcons.Images.Add( Resources.Shield_Red ); if ( !File.Exists( _rootProgDir + @"\XML\CenRep.xml" ) ) return; plugin = new XMLPlugin(_rootProgDir + @"\XML\CenRep.xml", "CENREP"); _phones = new XMLPlugin(_rootProgDir + @"\XML\Phones.xml", "PHONES"); plugin.Filter = ""; _phones.Filter = ""; cmbName.Items.Clear(); for (int i = 0; i < _phones.Count; i++) { // ReSharper disable PossibleNullReferenceException cmbName.Items.Add(_phones[i].Attribute("type").Value); // ReSharper restore PossibleNullReferenceException } lstCenRep.LargeImageList = _patchIcons; lstCenRep.SmallImageList = _patchIcons; if (_mySettings.AttachDirectory != "") if (!Directory.Exists(_mySettings.AttachDirectory)) { try { Directory.CreateDirectory(_mySettings.AttachDirectory); } catch (Exception) { MessageBox.Show(Resources.frmMain_AttachDoesnotExists, Resources.frmInternalEditor_frmInternalEditor_WARNING); _mySettings.AttachDirectory = ""; _mySettings.Save(); } } if(_mySettings.BackupPath !="") if (!Directory.Exists(_mySettings.BackupPath)) { try { Directory.CreateDirectory(_mySettings.BackupPath); } catch (Exception) { MessageBox.Show( Resources.frmMain_Backupdoeasnotexists, Resources.frmInternalEditor_frmInternalEditor_WARNING); _mySettings.BackupPath = ""; _mySettings.AutoBackup = false; _mySettings.Save(); throw; } } }
private void ClickSettings(object sender, EventArgs e) { if (null != _frmMySettings) _frmMySettings.Show(); else { _frmMySettings = new FrmSettings(_mySettings); } }