Exemplo n.º 1
0
        private void ButtonBrowse_Click(object sender, RoutedEventArgs e)
        {
            // Open file system to select file(s)
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.Multiselect = true;

            // Set filter for file extension and default file extension
            //dlg.DefaultExt = ".png";
            //dlg.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif";


            Nullable <bool> result        = dlg.ShowDialog(); // Display OpenFileDialog by calling ShowDialog method
            List <string>   folderDetails = new List <string>();

            if (result.HasValue == true && result.Value == true)
            {
                folderDetails = getFolderName(); // only prompt for folder once always
            }
            byte[] rawData;

            // Add all files selected into the the db. If multiple files added, project destination is the same.
            foreach (String file in dlg.FileNames)
            {
                // Get the selected file name and display in a TextBox
                if (result.HasValue == true && result.Value == true)
                {
                    rawData = File.ReadAllBytes(file);
                    // Open document
                    string filename = file;
                    string ext      = Path.GetExtension(file);

                    //Stores file in appropriate place in file system
                    //moveFile(filename, databaseRoot  /* + WHATEVER THE NEW LOCATION IS ASK CATH */);

                    executeInsert(filename, ext, dlg, folderDetails, rawData);
                }
            }
            dgl.loadProjects();
            if (!projectSelectedName.Equals(""))
            {
                dgl.loadSpeakers(projectSelectedName);
                rowS = dgl.getCollection("S");

                buildDatagridGroups(new ListCollectionView(rowS));
            }

            //dgl.setUpDataGrids();
        }
Exemplo n.º 2
0
        private void cbChooseProject_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            cbChooseSpeaker.IsEnabled = true;
            rowS.Clear();
            ComboBox cmb = sender as ComboBox;

            dgl.loadSpeakers(cmb.SelectedItem.ToString());

            //foreach (var elem in dgl.getCollection("S"))
            //    ((ObservableCollection<Speaker>)this.rowS).Add((dynamic)elem);


            var rowSAgeList = rowS.Select(s => s.Age).Distinct().ToList();

            cbChooseSpeaker.ItemsSource = rowSAgeList;
            btnAdd.IsEnabled            = true;
        }