Example #1
0
        private void ShowSelectFilesDialog()
        {
            OpenFileDialog dlg = new OpenFileDialog
            {
                Multiselect      = true,
                CheckFileExists  = true,
                RestoreDirectory = true,
                DereferenceLinks = true,
                // Uncomment Lines below to enable KMZ Files to be imported (Current no Code Support)
                Filter = string.Concat("CSV (Comma delimited) (*.csv)|*.csv", "|",
                                       "KML (Keyhole Markup Language) (*.kml)|*.kml")
                         //, "|",
                         //"KMZ (*.kmz)|*.kmz")
            };

            if (!dlg.ShowDialog(Window.GetWindow(Application.Current.MainWindow)).Value)
            {
                return;
            }

            try
            {
                _uploader.AddFiles(dlg.FileNames);

                if (dlg.FileNames.Length == 1)
                {
                    SelectedItem = DataSetInfos[0];
                    OnActivateItem();
                }
            }
            catch (Exception ex)
            {
                Window window = Window.GetWindow(Application.Current.MainWindow);

                if (window == null)
                {
                    throw;
                }

                MessageBox.Show(window, ex.Message, window.Title, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private async Task Upload(string[] files, string destination)
        {
            StartProgressRing();
            Uploader uploader = new Uploader(client);

            uploader.AddFiles(files);
            try
            {
                await uploader.UploadFiles();

                await uploader.Operation("FileManager.Import")
                .SetContext("currentDocument", currentDirectory.Path)
                .Execute();
            }
            catch (Exception ex)
            {
                await DisplayError("Could not upload files.", ex);
            }
            await UpdateView();

            StopProgressRing();
        }