Exemple #1
0
        private void searchImages( object sender, EventArgs e )
        {
            var g = this.CreateGraphics();

            try
            {
                string strPath = Global.getMemoryCardCacheFolder();

                var imageDatas = _camera.GetImageItems();

                if ( imageDatas==null )
                {
                    Global.showMsgBox( this, "Hittar inga bilder i kameran!" );
                    this.DialogResult = DialogResult.Cancel;
                    return;
                }

                m_progress.setProgress( 0, imageDatas.Length );
                foreach ( var id in imageDatas )
                {
                    System.Diagnostics.Debug.Print( id.Name );
                    if ( id.hasJPG && (m_AktivFlik.FlikKategori!=FlikKategori.Gruppbild || id.hasRAW) )
                    {
                        var strFilename = Path.Combine(strPath, id.Name + ".jpg" );
                        if ( !File.Exists(strFilename) )
                            if ( !id.saveJPG( strFilename ) )
                                continue;
                        var tn = createThumbnail(
                            _thumbnails,
                            strFilename,
                            160,
                            120,
                            m_AktivFlik.FlikKategori == FlikKategori.Porträtt );
                        if ( tn != null )
                        {
                            layout();
                            _thumbnails.paint( g, null );
                            _dicImageData.Add( tn.Key, id );
                        }
                    }
                    m_progress.increaseValue();
                }

            }
            catch ( Exception ex )
            {
                Global.showMsgBox( this, "searchImages:\r\n{0}", ex.ToString() );
            }
            m_progress.Close();
            m_progress.Dispose();
            m_progress = null;
            g.Dispose();
        }
Exemple #2
0
 private void mnuImporteraBilder_Click(object sender, System.EventArgs e)
 {
     try
     {
         using ( var dlg = new FImport(_aktivFlik,_camera) )
             if ( dlg.ShowDialog(this)==DialogResult.OK )
             {
                 var images = dlg.SelectedImages;
                 Refresh();
                 var progress = new frmProgress("Hämtar bilder...",images.Length);
                 progress.Owner = this;
                 progress.Show();
                 foreach ( FImport.SelectedImage si in images )
                 {
                     switch ( _aktivFlik.FlikKategori )
                     {
                         case FlikKategori.Porträtt:
                         case FlikKategori.Vimmel:
                             _aktivFlik.nyttFoto(true, File.ReadAllBytes(si.FileNameJPG), null);
                             break;
                         case FlikKategori.Gruppbild:
                             var fn = Global.GetTempFileName();
                             si.imgData.saveRAW(fn);
                             _aktivFlik.nyttFoto(true, File.ReadAllBytes(si.FileNameJPG), File.ReadAllBytes(fn));
                             Util.safeKillFile(fn);
                             break;
                     }
                     progress.increaseValue();
                 }
                 progress.Close();
                 progress.Dispose();
             }
     }
     catch ( Exception ex )
     {
         Global.showMsgBox( this, "mnuImporteraBilder:\r\n{0}", ex.ToString() );
     }
 }
Exemple #3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad (e);

            var r = SystemInformation.WorkingArea;
            r.Inflate( -r.Width/100, -r.Height/100 );
            this.Location = r.Location;
            this.Size = r.Size;

            m_progress = new frmProgress("Hämtar nya bilder...");
            m_progress.Owner = this;
            m_progress.Show();

            vdUsr.vdOneShotTimer.start( 100, new EventHandler(searchImages), null );
        }