Inheritance: IWildFile
Esempio n. 1
0
        public void LoadFromCommand( string command, Action<IWildFile> loaded )
        {
            var info = command.Split( ',' );
            if( info.Length < 2 ) return;

            WildFile f = new WildFile( info[Command.Contents.FILE_NAME] );
            f.Lookup = (FileLookup)int.Parse( info[Command.Contents.FILE_LOOKUP] );
            if( (f.Lookup == FileLookup.Other || f.Lookup == FileLookup.Url) && info.Length > 2 )
            {
                f.Path = info[Command.Contents.FILE_PATH];
            }
            else if( f.Lookup == FileLookup.SpecialFolder && info.Length > 3 )
            {
                f.Path = info[Command.Contents.FILE_PATH];
                f.FolderLocationType = (Environment.SpecialFolder)int.Parse( info[Command.Contents.FILE_SPECIAL_DIRECTORY] );
            }

            FileLocator.TryLocate( f, loaded );
        }
Esempio n. 2
0
        private void LocateWebsite( WildFile wFile )
        {
            if( !wFile.IsLocated ) return;

            //HttpClient client = new HttpClient();
            //client.BaseAddress = new Uri( wFile.Path + "/favicon.ico" );
            //try
            //{
            //    using( Stream s = client.GetStreamAsync( wFile.Path + "/favico.ico" ).Result )
            //    {
            //        Bitmap bmp = new Bitmap( Image.FromStream( s ) );
            //        wFile.Icon = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
            //           bmp.GetHbitmap(),
            //           IntPtr.Zero,
            //           System.Windows.Int32Rect.Empty,
            //           BitmapSizeOptions.FromWidthAndHeight( bmp.Size.Width, bmp.Size.Height ) );
            //    }
            //}
            //catch(Exception e){}
        }
Esempio n. 3
0
 void LocateFromRegistry(WildFile file)
 {
     IWildFile found = RegistryApps.FirstOrDefault(f => f.CompareTo(file) == 0);
     if(found != null ) file.Path = found.Path;
 }
Esempio n. 4
0
        void LocateFromSpecialDirectory(WildFile file)
        {
            if (file.FolderLocationType == null) return;

            file.Path = Environment.GetFolderPath(file.FolderLocationType.Value) + file.Path;
        }
        void OpenDialog()
        {
            // Configure open file dialog box
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            dlg.Filter = "Tous le fichiers (*.*)|*.*"; // Filter files by extension

            // Show open file dialog box
            Nullable<bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                SelectedApp = new WildFile(dlg.FileName, false);
            }
        }