/// <summary> /// Starts the applications logic. Loads libraries, ect. /// </summary> public void Start() { //Load the app settings _settings = new Settings(); _settings.Load(); try { FileInfo dataFile = new FileInfo(_settings.LibraryDatabaseFilePath); if(!dataFile.Directory.Exists ) { dataFile.Directory.Create(); } } catch(Exception e) { //Well this puts us in a pickle // System.Windows.Forms.MessageBox.Show("Unable to start αPlay! Could not find nor create αPlay directory.\r\nError: " + e.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } //Load main library Library mainLib = new Library(_settings.LibraryDatabaseFilePath); _libraries.Add(mainLib); //Start UI thread // _uiThread = new Thread(new ThreadStart(delegate {Application.Run(new MainWindow(this));})); //_uiThread.SetApartmentState(ApartmentState.STA); //_uiThread.IsBackground = false; //_uiThread.Start(); }
static Settings() { string settingFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar + "aPlay"; _defaultSettingsFilePath = settingFolder + Path.DirectorySeparatorChar + "setting.xml"; Default = new Settings(); Default.LibraryDatabaseFilePath = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic) + Path.DirectorySeparatorChar + "aPlay" + Path.DirectorySeparatorChar + "library.db"; Default.MainMusicFolderPath = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.MyMusic)); //TODO Get video path. Default.MainVideoFolderPath = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.MyMusic)); }