示例#1
0
        /// <inheritdoc/>
        async Task IEditorApplication.OnImportDataAsync()
        {
            try
            {
                if (_editor?.Project != null)
                {
                    var dlg = new OpenFileDialog();
                    dlg.Filters.Add(new FileDialogFilter()
                    {
                        Name = "Csv", Extensions = { "csv" }
                    });
                    dlg.Filters.Add(new FileDialogFilter()
                    {
                        Name = "All", Extensions = { "*" }
                    });
                    var result = await dlg.ShowAsync(_mainWindow);

                    if (result != null)
                    {
                        var path = result.FirstOrDefault();
                        _editor?.OnImportData(path);
                    }
                }
            }
            catch (Exception ex)
            {
                _log?.LogError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}");
            }
        }
示例#2
0
        /// <inheritdoc/>
        async Task IEditorApplication.OnImportDataAsync()
        {
            var dlg = new OpenFileDialog()
            {
                Filter      = "Csv (*.csv)|*.csv|All (*.*)|*.*",
                FilterIndex = 0,
                FileName    = ""
            };

            if (dlg.ShowDialog(_mainWindow) == true)
            {
                _editor?.OnImportData(dlg.FileName);
            }

            await Task.Delay(0);
        }