コード例 #1
0
        /// <inheritdoc/>
        async Task IEditorApplication.OnExportJsonAsync(object item)
        {
            try
            {
                var dlg = new SaveFileDialog();
                dlg.Filters.Add(new FileDialogFilter()
                {
                    Name = "Json", Extensions = { "json" }
                });
                dlg.Filters.Add(new FileDialogFilter()
                {
                    Name = "All", Extensions = { "*" }
                });
                dlg.InitialFileName  = _editor?.GetName(item);
                dlg.DefaultExtension = "json";
                var result = await dlg.ShowAsync(_mainWindow);

                if (result != null)
                {
                    _editor?.OnExportJson(result, item);
                }
            }
            catch (Exception ex)
            {
                _log?.LogError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}");
            }
        }
コード例 #2
0
        /// <inheritdoc/>
        async Task IEditorApplication.OnExportJsonAsync(object item)
        {
            var dlg = new SaveFileDialog()
            {
                Filter      = "Xaml (*.xaml)|*.xaml|All (*.*)|*.*",
                FilterIndex = 0,
                FileName    = _editor?.GetName(item)
            };

            if (dlg.ShowDialog(_mainWindow) == true)
            {
                _editor?.OnExportJson(dlg.FileName, item);
            }

            await Task.Delay(0);
        }