Beispiel #1
0
        private void SettingsForm_Load(object sender, EventArgs e)
        {
            GUIGraphicsContext.form = this;
            // Asynchronously pre-initialize the music engine if we're using the BassMusicPlayer
            if (BassMusicPlayer.IsDefaultMusicPlayer)
            {
                BassMusicPlayer.CreatePlayerAsync();
            }
            Log.Info("Load settings");

            // We load ALL sections - not just those which are visible currently
            foreach (KeyValuePair <string, ConfigPage> singleConfig in settingSections)
            {
                ConfigPage config   = singleConfig.Value;
                TreeNode   loadNode = new SectionTreeNode(config.ConfigSection) as TreeNode;
                if (loadNode != null)
                {
                    // LoadSectionSettings will recursively load all settings
                    if (loadNode.Parent == null)
                    {
                        LoadSectionSettings(loadNode);
                    }
                }
            }

            Log.Info("Load settings done");
        }
        /// <summary>
        /// RegisterSingleton application injection dependency.
        /// Should be used to add more binding between class to interface.
        /// </summary>
        /// <param name="kernel">
        /// application Ninject kernel
        /// </param>
        private static void RegisterDependency(IKernel kernel)
        {
            var window      = System.Windows.Application.Current.MainWindow;
            var application = new WpfApplication(window);

            kernel.Bind <IApplication>().ToConstant(application);
            kernel.Bind <IDispatcher>().ToConstant(new WPFUIDispatcher(window.Dispatcher));
            kernel.Bind <IApplicationLifeCycle>().To <ApplicationLifeCycle>();
            kernel.Bind <MainViewModel>().ToSelf().InSingletonScope();
            kernel.Bind <PlayerViewModel>().ToSelf().InSingletonScope();
            kernel.Bind <IPlayer>().To <Player>().InSingletonScope();
            kernel.Bind <IIoReader>().To <IoReader>().InSingletonScope();
            kernel.Bind <ITrackOrderLogicFactory>().To <TrackOrderLogicFactory>().InSingletonScope();
            kernel.Bind <IRandomProvider>().To <RandomProvider>();
            kernel.Bind <IMusicPlayer>().ToMethod(_ => BassMusicPlayer.Init(BassConfiguration.Email, BassConfiguration.Password)).InSingletonScope();
        }
Beispiel #3
0
        public void EncodeDisc(GUIFacadeControl facadeView, int getID)
        {
            GetID = getID;
            if (File.Exists(Config.GetFile(Config.Dir.Base, "lame_enc.dll")))
            {
                // Release the drives first for CDDRIVE to be able to open them
                BassMusicPlayer.ReleaseCDDrives();
                char[] Drives = CDDrive.GetCDDriveLetters();
                for (int i = 1; i < facadeView.Count; ++i)
                {
                    GUIListItem item = facadeView[i];
                    if ((!item.IsFolder) && (Array.IndexOf(Drives, item.Path[0]) > -1))
                    {
                        TrackInfo trackInfo = new TrackInfo();
                        if ((MusicTag)item.MusicTag == null)
                        {
                            MusicTag musicTag = new MusicTag();
                            musicTag.Artist = "Unknown Artist";
                            musicTag.Album  = "Unknown Album";
                            musicTag.Track  = Convert.ToInt16(item.Label.Substring(5));
                            musicTag.Title  = string.Format("Track {0:00}", musicTag.Track);
                            item.MusicTag   = musicTag;
                        }
                        trackInfo.MusicTag   = (MusicTag)item.MusicTag;
                        trackInfo.TrackCount = facadeView.Count - 1;
                        trackInfo.Item       = item;

                        try
                        {
                            EncodeTrack(trackInfo);
                        }
                        catch {}
                    }
                }
            }
        }