public bool Initialize()
        {
            //MediaMonkey autostarts whenever the com object is
            //instantized. If updates happen too frequently
            //it's possible a second instance of MM is created
            //when the com interface is queried shortly after the application was
            //closed, likely because the application is still technically running
            //while it's in the process of shutting down, but the com interface
            //was already disposed and therefore is re-initialized,
            //which results in a second instance of the application

            DateTime CurrentDate = DateTime.Now;

            if (((CurrentDate - DisposeDate).TotalMilliseconds) > DisposeTimeOut)
            {
                try
                {
                    SDBApplication = new SongsDB.SDBApplication();
                    SDBPlayer      = new SongsDB.SDBPlayer();
                    SDBSongData    = new SongsDB.SDBSongData();
                    SDBApplication.ShutdownAfterDisconnect = false;
                    Initialized = true;
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }

            return(false);
        }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();

            // Load in mediamonkey automation object
            SongsDB.SDBApplication SDB = new SongsDB.SDBApplication();

            // Only get the first album selected
            SongsDB.SDBAlbum mmAlbum = SDB.SelectedSongList.Albums.get_Item(0);

            // Add tracks to mediamonkey track list
            for (int i = 0; i < mmAlbum.Tracks.Count; i++)
            {
                mmTrackList.Items.Add(new MMTrack(mmAlbum.Tracks.get_Item(i)));
            }

            // set search box to album and artist
            searchBox.Text = mmAlbum.Artist.Name + ' ' + mmAlbum.Name;
        }
Esempio n. 3
0
        public MainWindow()
        {
            InitializeComponent();

            // Load in mediamonkey automation object
            SongsDB.SDBApplication SDB = new SongsDB.SDBApplication();

            // Only get the first album selected
            SongsDB.SDBAlbum mmAlbum = SDB.SelectedSongList.Albums.get_Item(0);

            // Add tracks to mediamonkey track list
            for (int i = 0; i < mmAlbum.Tracks.Count; i++)
            {
                mmTrackList.Items.Add(new MMTrack(mmAlbum.Tracks.get_Item(i)));
            }

            // set search box to album and artist
            searchBox.Text = mmAlbum.Artist.Name + ' ' + mmAlbum.Name;
        }