Пример #1
0
        private void EnsurePathExist()
        {
            if (File.Exists(_options.PathToExe))
            {
                return;
            }

            var box = MessageBox.Show("I can't find Visual Studio Code (Code.exe). Would you like to help me find it?", Vsix.Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (box == DialogResult.No)
            {
                return;
            }

            var dialog = new OpenFileDialog();

            dialog.DefaultExt       = ".exe";
            dialog.FileName         = "Code.exe";
            dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            dialog.CheckFileExists  = true;

            var result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                _options.PathToExe = dialog.FileName;
                _options.SaveSettingsToStorage();
            }
        }
Пример #2
0
 private void SaveOptions(Options options, string path)
 {
     options.PathToExe = path;
     options.SaveSettingsToStorage();
 }