Example #1
0
        private void buttonAddDir_Click(object sender, RoutedEventArgs e)
        {
            var pickedFolder = new FolderPickerDialog();

            try {
                if (pickedFolder.ShowDialog() == true)
                {
                    string path = pickedFolder.SelectedPath;
                    if (path == null)
                    {
                        throw new ActionException("No folder was chosen.", ActionType.Directory);
                    }
                    //DirIdentity did = new DirIdentity(path.Substring(path.LastIndexOf('\\') + 1),
                    //	null, path);
                    DirectoryContents dcNew = new DirectoryContents(
                        path.Substring(path.LastIndexOf('\\') + 1), path, null, null, true);
                    foreach (DirectoryContents dc in Directories)
                    {
                        if (dc.Name.Equals(dcNew.Name) || dc.LocalPath.Equals(dcNew.LocalPath))
                        {
                            throw new ActionException("Folder already exists on this machine.",
                                                      ActionType.Directory);
                        }
                    }
                    Directories.Add(dcNew);
                    machine.Directories.Add(dcNew);
                }
            } catch (ActionException ex) {
                MessageBox.Show(ex.Message, ex.Title);
            }
        }
Example #2
0
        private void OnLocatePsqlCommand(object parameter)
        {
            cancelToken.Cancel();

            var dialog = new FolderPickerDialog();

            if (dialog.ShowDialog() == true && !String.IsNullOrEmpty(dialog.SelectedPath))
            {
                var selectedPath = dialog.SelectedPath;
                var dir          = new DirectoryInfo(selectedPath);
                var psqlFile     = dir.GetFiles(PsqlName).FirstOrDefault();

                if (psqlFile != null)
                {
                    PsqlPath = psqlFile.FullName;
                }
                else
                {
                    MessageBox.Show(
                        String.Format("Can't locate psql executable [{0}]", PsqlName)
                        );
                    PsqlPath = null;
                }
            }
        }
        private void OnSelectExportPathCommand(object parameter)
        {
            var dialog = new FolderPickerDialog();

            if (dialog.ShowDialog() == true)
            {
                ExportPath = dialog.SelectedPath;
            }
        }
Example #4
0
        private void SaveGMSExtractions()
        {
            var dlg = new FolderPickerDialog();

            dlg.Title = "Select a folder where the extraction input files for GMS will be saved";
            if (dlg.ShowDialog() == true)
            {
                AsyncWithWait(() => MsheInputFileWriters.WriteGMSExtraction(dlg.SelectedPath, SortedAndFilteredPlants, SelectionStartTime, SelectionEndTime));
            }
        }
Example #5
0
        public void SaveExtractionPermits(int DistributionYear, int startYear, int endyear)
        {
            var dlg = new FolderPickerDialog();

            dlg.Title = "Select a folder where the extraction input files will be saved";
            if (dlg.ShowDialog() == true)
            {
                AsyncWithWait(() => MsheInputFileWriters.WriteExtractionDFS0Permits(dlg.SelectedPath, SortedAndFilteredPlants, DistributionYear, startYear, endyear));
            }
        }
Example #6
0
        private string getDir()
        {
            var dlg = new FolderPickerDialog();

            if (dlg.ShowDialog() == true)
            {
                return(dlg.SelectedPath);
            }
            return(null);
        }
Example #7
0
        private void SaveLayerStatisticsFiles()
        {
            var dlg = new FolderPickerDialog();

            if (dlg.ShowDialog() == true)
            {
                //remove wells without xy, remove intakes with missing values and then apply ObsInperiodfilter again because there can be wells with multiple intakes where only is acceptable
                var intakes = SortedAndFilteredWells.Where(w => w.X != 0 & w.Y != 0).SelectMany(var => var.Intakes.Where(var2 => !var2.HasMissingdData())).Where(ObsInPeriodFilter);
                AsyncWithWait(() => MsheInputFileWriters.WriteToLSInput(dlg.SelectedPath, intakes, Mshe, _periodFilter, _onlyRoFilter));
            }
        }
Example #8
0
        private void targetButton_Click(object sender, RoutedEventArgs e)
        {
            FolderPickerDialog fpd = new FolderPickerDialog();

            fpd.ShowDialog();
            if ((bool)fpd.DialogResult)
            {
                TargetFolder = fpd.SelectedPath;
            }
            OnTargetSelected();
        }
        private void BrowseForDatabasePath()
        {
            var theDialog = new FolderPickerDialog();

            theDialog.InitialPath = DatabasePath;

            if (theDialog.ShowDialog() == true)
            {
                DatabasePath = theDialog.SelectedPath;
            }
        }
Example #10
0
        private void SaveDetailedTimeSeries()
        {
            var dlg = new FolderPickerDialog();

            if (dlg.ShowDialog() == true)
            {
                var intakes = SortedAndFilteredWells.SelectMany(var => var.Intakes);
                MsheInputFileWriters.WriteDetailedTimeSeriesText(dlg.SelectedPath, intakes, SelectionStartTime, SelectionEndTime);
                MsheInputFileWriters.WriteToDatFile(System.IO.Path.Combine(dlg.SelectedPath, "Timeseries.dat"), intakes, _periodFilter, _onlyRoFilter);
                AsyncWithWait(() => MsheInputFileWriters.WriteDetailedTimeSeriesDfs0(dlg.SelectedPath, intakes, _periodFilter, _onlyRoFilter));
            }
        }
Example #11
0
        private void OnSelectScanPathCommand(object parameter)
        {
            FolderPickerDialog dialog = new FolderPickerDialog()
            {
                InitialPath = ScanPath
            };

            if (dialog.ShowDialog() == true)
            {
                ScanPath = dialog.SelectedPath;
            }
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (button1.Content.ToString() == "Start")
            {
                if (!path)
                {
                    var dlg = new FolderPickerDialog();
                    if (dlg.ShowDialog() == true)
                    {
                        folder = dlg.SelectedPath;
                        path   = true;
                    }
                }
                if (path & training)
                {
                    //startTraining();
                }
                else if (path & !training)
                {
                    startDemo();
                }
                if (path & capture)
                {
                    button1.Background = Brushes.Red;
                    button1.Content    = "End";
                    index1             = KinectDiagnosticViewer.dt1.Rows.Count;
                    timeStamp          = DateTime.Now.ToString();
                }
            }
            else
            {
                index2 = KinectDiagnosticViewer.dt1.Rows.Count;
                DataTable dt1 = KinectDiagnosticViewer.dt1.Copy();

                for (int i = (index1 + 1); i < index2 - 1; i++)
                {
                    for (int j = 0; j < 60; j++)
                    {
                        skelData.Add(dt1.Rows[i][j]);
                    }
                    kinectTilt.Add(dt1.Rows[i][60]);
                    gpVector.Add(dt1.Rows[i][61]);
                    gpVector.Add(dt1.Rows[i][62]);
                    gpVector.Add(dt1.Rows[i][63]);
                    gpVector.Add(dt1.Rows[i][64]);
                }
                if (!training)
                {
                    endDemo();
                }
                else
                {
                    endTraining();
                }

                createMatFile();

                button1.Background = Brushes.Green;
                button1.Content    = "Start";

                skelData.Clear();
                gpVector.Clear();
                kinectTilt.Clear();
            }
            return;
        } //Change to 1 if you only want to view one at a time. Switching will be enabled.