Skip to content

Commit

Permalink
Added some file types to open file dialogs. (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
veler authored May 14, 2022
1 parent aa9aa93 commit 0d3df01
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/cs-CZ/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<value>Tento soubor nelze otevřít</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Nelze načíst soubor '{0}'. Více podrobností naleznete v protokolu.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Vrátit zpět</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/de-DE/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>Nicht möglich diese Datei zu öffnen</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Nicht möglich die Datei '{0}' zu laden. Für mehr Details, schauen Sie in den Logs.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Rückgängig</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/en-US/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>Unable to open this file</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Unable to load the file '{0}'. For more details, please check the log.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Undo</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/es-AR/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>No se puede abrir este archivo</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>No se puede abrir el archivo '{0}'. Para mas información, consultá el log.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Deshacer</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/es-ES/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>No se puede abrir este archivo</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>No se puede abrir el archivo '{0}'. Para mas información, consulte el log.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Deshacer</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/fr-FR/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<value>Impossible d’ouvrir ce fichier</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Impossible de charger le fichier '{0}'. Pour plus de détails, veuillez consulter les logs.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Annuler</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/hu-HU/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>Nem lehet ezt a fájlt megnyitni</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Nem lehet a '{0}' fájlt megnyitni. További információkért, ellenőrizd a log fájlokat.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Újra</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/id-ID/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>Tidak dapat membuka file</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Tidak dapat membuka file '{0}'. Untuk detail, silahkan cek log</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Undo</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/it-IT/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>Impossibile aprire il file</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Impossibile caricare il file '{0}'. Per maggiori dettagli, controlla il file di log.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Annulla</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/ja-JP/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>ファイルを開けませんでした</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>ファイルを開けませんでした。詳細はログを参照してください : '{0}'</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>元に戻す</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/ko-KR/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>파일을 열 수 없습니다</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>'{0}' 파일을 열 수 없습니다. 로그를 확인하여 자세한 원인을 확인할 수 있습니다.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>되돌리기</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/pl-PL/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<value>Nie można otworzyć tego pliku</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Nie można otworzyć pliku '{0}'. Po więcej informacji sprawdź dziennik zdarzeń.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Cofnij</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/pt-BR/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<value>Não foi possível abrir este arquivo</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Não foi possível carregar o arquivo '{0}'. Para maiores detalhes, favor verificar o log.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Desfazer</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/pt-PT/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>Incapaz de abrir este ficheiro</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Incapaz de carregar o ficheiro '{0}'. Para mais detalhes, por favor, verifique o registo.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Desfazer</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/ru-RU/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>Невозможно открыть файл</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>Невозможно открыть файл '{0}'. Для получения подробной информации проверьте логи.</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>Отменить</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/zh-Hans/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>抱歉,无法打开这个文件</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>抱歉,无法加载文件 '{0}' 的具体内容。欲了解更多详情,请查看日志文件记录。</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>撤销</value>
Expand Down
2 changes: 1 addition & 1 deletion src/dev/impl/DevToys/Strings/zh-Hant/Common.resw
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<value>無法開啟此檔案</value>
</data>
<data name="UnableOpenFileDescription" xml:space="preserve">
<value>無法載入此檔案 '{0}'。詳情請查看記錄檔。</value>
<value>Unable to load the file '{0}'. Only textual files can be opened. For more details, please check the log.</value>
</data>
<data name="Undo" xml:space="preserve">
<value>復原</value>
Expand Down
9 changes: 9 additions & 0 deletions src/dev/impl/DevToys/UI/Controls/CodeEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,15 @@ private async void OpenFileButton_Click(object sender, RoutedEventArgs e)
};

filePicker.FileTypeFilter.Add("*");
filePicker.FileTypeFilter.Add(".txt");
filePicker.FileTypeFilter.Add(".js");
filePicker.FileTypeFilter.Add(".ts");
filePicker.FileTypeFilter.Add(".cs");
filePicker.FileTypeFilter.Add(".java");
filePicker.FileTypeFilter.Add(".xml");
filePicker.FileTypeFilter.Add(".json");
filePicker.FileTypeFilter.Add(".md");
filePicker.FileTypeFilter.Add(".sql");

StorageFile file = await filePicker.PickSingleFileAsync();
if (file is not null)
Expand Down
9 changes: 9 additions & 0 deletions src/dev/impl/DevToys/UI/Controls/CustomTextBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,15 @@ private async void OpenFileButton_Click(object sender, RoutedEventArgs e)
};

filePicker.FileTypeFilter.Add("*");
filePicker.FileTypeFilter.Add(".txt");
filePicker.FileTypeFilter.Add(".js");
filePicker.FileTypeFilter.Add(".ts");
filePicker.FileTypeFilter.Add(".cs");
filePicker.FileTypeFilter.Add(".java");
filePicker.FileTypeFilter.Add(".xml");
filePicker.FileTypeFilter.Add(".json");
filePicker.FileTypeFilter.Add(".md");
filePicker.FileTypeFilter.Add(".sql");

StorageFile file = await filePicker.PickSingleFileAsync();
if (file is not null)
Expand Down

0 comments on commit 0d3df01

Please sign in to comment.