public void Launch( IWildFile f ) { if( !f.IsLocated ) return; try { Process.Start( f.Path ); } catch { } //Exception can be thrown just by clicking on the cancel button of an install wizard }
public string GetLocationCommand( IWildFile file ) { string cmd = String.Format("{0},{1}", file.FileName, (int) file.Lookup); if (file.FolderLocationType != null) //false if the path does not contains a special location : file.Lookup = SpecialFolder | Registry { string sPath = Environment.GetFolderPath(file.FolderLocationType.Value); string path = file.Path.Substring(sPath.Length); //Get the path without the special location cmd += String.Format(",{0},{1}", path, (int)file.FolderLocationType); } else //file.Lookup = Other { cmd += String.Format(",{0}", file.Path); } return cmd; }
public void TryLocate( IWildFile file, Action<IWildFile> callback ) { WildFile wFile = file as WildFile; switch(file.Lookup) { case FileLookup.Registry: LocateFromRegistry( wFile ); if( !wFile.IsLocated ) //True if found in the registry LocateFromSpecialDirectory( wFile ); break; case FileLookup.SpecialFolder: LocateFromSpecialDirectory( wFile ); break; case FileLookup.Other: LocateFromSpecialDirectory( wFile ); break; case FileLookup.Url: LocateWebsite( wFile ); break; } //Last chance if( !wFile.IsLocated ) { Task.Factory.StartNew( () => { string path = TryLocatePath( wFile.Path ); // if( path != null ) wFile.Path = path; callback( wFile ); } ); } else { callback( wFile ); } }
private void SetSelectedFile( IWildFile value, bool useImg = true ) { _selectedWildFile = value; if( useImg && value != null) { _skinConfigAccessor[Root.EditedKeyMode].Set( "Image", _selectedWildFile.Icon ); _skinConfigAccessor[Root.EditedKeyMode].Set( "DisplayType", "Image" ); } NotifyPropertyChanged( "SelectedApp" ); NotifyPropertyChanged( "SelectedFile" ); NotifyPropertyChanged( "IsValid" ); }