/// <summary>
        /// Initialisation
        /// </summary>
        /// <param name="manager"></param>
        public IPreviewControl Initialize(RemoteFileInfoManager manager )
        {
            _Current = this;

            this.Manager = manager;
            this.Control = new PreviewDatabaseControl();

            Thread thread = new Thread(new ThreadStart(() =>
            {
                string filename = null;

                try
                {
                    filename = manager.Load();
                }
                catch (FileLoadException ex)
                {
                    MessageBox.Show("This file is locked by the phone application. To access it, quit the phone application and retry to select the file. It's typical in the case of a database file (.sdf)");
                    //Affichage que le fichier est locké !
                    return;
                }

                SqlServerCeHelper.Filename = filename;

                this.RefreshTable();
            }
            ));

            thread.Start();

            return this.Control;
        }
        /// <summary>
        /// Initialisation
        /// </summary>
        /// <param name="manager"></param>
        public IPreviewControl Initialize(RemoteFileInfoManager manager )
        {
            this.Manager = manager;

            PreviewImageControl control = null;

            control = new PreviewImageControl();

            this.Control = control as IPreviewControl;

            Thread thread = new Thread( new ThreadStart( () =>
            {
                try
                {
                    MemoryStream memory = null;

                    using (FileStream reader = manager.DonwloadFile())
                    {
                        byte[] array = new byte[reader.Length];
                        reader.Read(array, 0, array.Length);

                        memory = new MemoryStream(array);
                    }

                    Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        try
                        {
                            BitmapImage source = new BitmapImage();

                            source.BeginInit();

                            source.CacheOption = BitmapCacheOption.OnLoad;
                            source.StreamSource = memory;

                            source.EndInit();

                            memory.Close();
                            memory.Dispose();

                            control.ImageSource = source;
                        }
                        catch
                        {
                        }
                    }
                    ));
                }
                catch
                {
                }
            }
            ));

            thread.Start();

            return this.Control;
        }
        /// <summary>
        /// Initialisation
        /// </summary>
        /// <param name="manager"></param>
        public IPreviewControl Initialize(RemoteFileInfoManager manager )
        {
            this.Manager = manager;

            PreviewTextControl control = null;

            control = new PreviewTextControl();

            control.Plugin = this;

            Thread thread = new Thread( new ThreadStart( () =>
            {
                try
                {
                    using (StreamReader reader = new StreamReader(manager.Load()))
                    {
                        string text = reader.ReadToEnd();
                        if (text.Length > 200)
                            text = text.Substring(0, 200) + "\r\n...";

                        Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                        {
                            control.Text = text;
                        }
                        ));
                    }
                }
                catch
                {
                }
            }
            ));

            thread.Start();

            this.Control = control as IPreviewControl;

            return this.Control;
        }
 /// <summary>
 /// Rafraichir
 /// </summary>
 /// <param name="manager"></param>
 public void Refresh(RemoteFileInfoManager manager)
 {
     this.Manager = manager;
 }
        /// <summary>
        /// Fixer le plugin dans content
        /// </summary>
        /// <param name="?"></param>
        public void SetContentFromSelectedFile()
        {
            RemoteFileInfoViewModel fileInfo = this.SelectedFile;

            if (fileInfo != null)
            {
                // moins de 1 mega

                if (fileInfo.RemoteFileInfo.Length < 1024 * 1024)
                {
                    foreach (IPreviewPlugin plugin in this.Plugins)
                    {
                        if (plugin.CheckFileInfoIsSupported(fileInfo.RemoteFileInfo) == true)
                        {
                            if (this.SelectedFile != null)
                            {
                                RemoteFileInfoManager manager = new RemoteFileInfoManager(
                                    this.ApplicationViewModel.SelectedRemoteApplication.Application,
                                    fileInfo.RemoteFileInfo,
                                    Path.GetTempPath()
                                    );

                                try
                                {
                                    this.SelectedFile.Content = plugin.Initialize(manager);
                                }
                                catch(Exception ex)
                                {
                                    App.ShowError(ex.Message);
                                    this.SelectedFile.Content = null;
                                    return;
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }