private void Main_Shown(object sender, EventArgs e) { this.AllowDrop = true; string storedPath = Properties.Settings.Default.VlcPath; if (string.IsNullOrEmpty(storedPath)) { storedPath = ConfigManager.GetValue("defaultVlcPath"); } if (!string.IsNullOrEmpty(storedPath) && File.Exists(storedPath)) { this.vlcPath = storedPath; } else if (!TryGetVlcPath(out this.vlcPath)) { using (var fileDialog = new OpenFileDialog()) { fileDialog.Filter = @"exe|*.exe"; fileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); fileDialog.CheckFileExists = true; fileDialog.RestoreDirectory = true; if (fileDialog.ShowDialog() != DialogResult.OK) { Close(); } else { vlcPath = fileDialog.FileName; } } } Properties.Settings.Default.VlcPath = vlcPath; Properties.Settings.Default.Save(); commander = new VlcCommander(vlcPath); }
private void Main_Shown(object sender, EventArgs e) { this.AllowDrop = true; string storedPath = Properties.Settings.Default.VlcPath; if (string.IsNullOrEmpty(storedPath)) storedPath = ConfigManager.GetValue("defaultVlcPath"); if (!string.IsNullOrEmpty(storedPath) && File.Exists(storedPath)) { this.vlcPath = storedPath; } else if (!TryGetVlcPath(out this.vlcPath)) { using (var fileDialog = new OpenFileDialog()) { fileDialog.Filter = @"exe|*.exe"; fileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); fileDialog.CheckFileExists = true; fileDialog.RestoreDirectory = true; if (fileDialog.ShowDialog() != DialogResult.OK) { Close(); } else { vlcPath = fileDialog.FileName; } } } Properties.Settings.Default.VlcPath = vlcPath; Properties.Settings.Default.Save(); commander = new VlcCommander(vlcPath); }