public mainForm() { //AllocConsole(); InitializeComponent(); FormBorderStyle = FormBorderStyle.FixedSingle; IOstrobe loading = new IOstrobe(); _settings = new Settings(loading); _strobe = new Strobe(); UpdateUI(); }
private void loadButton_Click(object sender, EventArgs e) { string localPath = System.IO.Directory.GetCurrentDirectory(); OpenFileDialog openFileDialog1 = new OpenFileDialog { Filter = (@"Text Files (*.txt)|*.txt"), InitialDirectory = localPath }; DialogResult result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { string filePath = openFileDialog1.FileName; IOstrobe input = new IOstrobe(); input.LoadData(_settings, filePath); UpdateUI(); } }
private void saveButton_Click(object sender, EventArgs e) { string localPath = System.IO.Directory.GetCurrentDirectory(); SaveFileDialog SaveFileDialog1 = new SaveFileDialog { FileName = "settings", Filter = (@"Text Files (*.txt)|*.txt"), DefaultExt = "txt", AddExtension = true, InitialDirectory = localPath }; DialogResult result = SaveFileDialog1.ShowDialog(); if (result == DialogResult.OK) { string filePath = SaveFileDialog1.FileName; IOstrobe output = new IOstrobe(); output.SaveData(_settings, filePath); } }
public Settings(IOstrobe io) { io.LoadData(this, "settings.txt"); if (!io.IsGood) { IsOnlyLFS = true; IsHorn = true; IsLights = true; IsOnStateOn = true; HornKey = 'B'; const int t = 200; keys = new[] { '3', '8', '3', '0', '3', '7', '3', '0' }; sleep = new[] { t, t, t, t, t, t, t, t }; } else { io.LoadData(this, "settings.txt"); } }