public Presenter(MainForm form) { formsSerializer = new FormsSerializer <List <ExcelWorkModel> >(AppDomain.CurrentDomain.BaseDirectory + @"\data.xml"); view = form; userControls = new UserControls.UserControls() { File = new UserControls.UcFile(), Main = new UserControls.UcMain(), Options = new UserControls.UcOptions() }; #region События view.Load += (s, e) => view.AddControlsToPanel(userControls.File); view.btnFilse.Click += (s, e) => view.AddControlsToPanel(userControls.File); view.btnMain.Click += (s, e) => view.AddControlsToPanel(userControls.Main); view.btnOptions.Click += (s, e) => view.AddControlsToPanel(userControls.Options); userControls.File.CompleteEvent += File_CompleteEvent; userControls.Main.CreatingRows += Main_CreatingRows; userControls.Main.CompleteEvent += Main_CompleteEvent; #endregion }
public UcOptions() { InitializeComponent(); formsSerializer = new FormsSerializer <List <string> >(dataPath); if (File.Exists(dataPath)) { options = formsSerializer.Deserialize(); } if (options == null || options.Count == 0) { SavePath = AppDomain.CurrentDomain.BaseDirectory; } else { SavePath = options[0]; } this.Load += (s, e) => tbPath.Text = SavePath; btnDealog.Click += (s, e) => { SavePath = ShowDialog(); if (!string.IsNullOrEmpty(SavePath)) { options = new List <string>() { SavePath }; formsSerializer.Serialize(options, (error) => MessageBox.Show(error)); tbPath.Text = SavePath; MessageBox.Show("Для применения настроек перезапустипе программу!", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); } }; }