Beispiel #1
0
 private void btnSaveBlob_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         this.txtMessage.Text = "select file!";
         OpenFileDialog openFileDialog = new OpenFileDialog();
         openFileDialog.InitialDirectory = @"C:";
         openFileDialog.Title            = "Browse images";
         openFileDialog.CheckFileExists  = true;
         openFileDialog.CheckPathExists  = true;
         openFileDialog.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
         var result = openFileDialog.ShowDialog();
         if (result == true)
         {
             DataAccess.Blob selectedBlob = (DataAccess.Blob) this.listBlobs.SelectedItem;
             if (selectedBlob == null)
             {
                 throw new Exception("No File selected in List!");
             }
             this.txtMessage.Text = "saving File into " + selectedBlob.filename;
             this.dataAccess.save(selectedBlob, openFileDialog.FileName);
             this.txtMessage.Text = "saved sucessfully";
         }
     }
     catch (Exception ex)
     {
         this.txtMessage.Text = ex.Message;
     }
 }
Beispiel #2
0
 private void listBlobs_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
 {
     try
     {
         DataAccess.Blob b = (DataAccess.Blob) this.listBlobs.SelectedItem;
     }catch (Exception ex)
     {
         this.txtMessage.Text = ex.ToString();
     }
 }
Beispiel #3
0
        private void btn_load_file_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Title = "Select a File";

            if (openFileDialog1.ShowDialog() == true)
            {
                byte[]          array = File.ReadAllBytes(openFileDialog1.FileName);
                DataAccess.Blob blob  = new DataAccess.Blob(0, openFileDialog1.FileName, DataAccess.Blob.convert(openFileDialog1.FileName));
                DataAccess.Blob.insert(blob);
                fillListBlobs();
            }
        }