Beispiel #1
0
        void songmanage_OnSongChangedEvent(iTunesClass song)
        {
            try
            {
                Trace.WriteLine("[Event OnSongChangedEvent MainWindow]" + "Title:" + song.SongTitle + ",Artist:" + song.SongArtist);
                Trace.WriteLine("[Event 自動投稿 MainWindow]" + "Sending tweet...");

                //曲が再生されているか確認する
                if (itunes.checkIsPlaying() == false && song.isFoobar == false)
                {
                    Trace.WriteLine("[Event 自動投稿 MainWindow]" + "Not playing... exit thread.");
                    return;
                }

                //アカウントのリストを作成する
                List <Core.ApplicationSetting.AccountClass> acclist = new List <ApplicationSetting.AccountClass>();
                foreach (ListViewItem listviewitem in AccountList.CheckedItems)
                {
                    Core.ApplicationSetting.AccountClass account = new Core.ApplicationSetting.AccountClass();
                    account.AccountName = listviewitem.Text;
                    account.Token       = listviewitem.SubItems[1].Text;
                    account.TokenSecret = listviewitem.SubItems[2].Text;
                    account.Enabled     = true;
                    acclist.Add(account);
                }

                //バックグラウンドで実行する
                Twitter.TwitterPost twitterpost = new Twitter.TwitterPost();
                twitterpost.AccountList        = acclist;
                twitterpost.Song               = song;
                twitterpost.TweetText          = TextBoxTweetText.Text;
                twitterpost.AutoDeleteText     = CheckBoxDeleteText140.Checked;
                twitterpost.onProcessFinished += twitterpost_onProcessFinished;
                if (checkBoxPostAlbumArtWork.Checked == true && song.getAlbumArtworkFileStream() != null && song.AlbumArtworkEnabled == true)
                {
                    Thread thread = new Thread(twitterpost.TweetWithImage);
                    thread.IsBackground = true;
                    thread.Start();
                }
                else
                {
                    Thread thread = new Thread(twitterpost.Tweet);
                    thread.IsBackground = true;
                    thread.Start();
                }

                Trace.WriteLine("[Event 自動投稿 MainWindow]" + "Tweet send thread start...");
            }
            catch (Exception ex)
            {
                Trace.Write(ex.ToString());
            }
        }
Beispiel #2
0
 void externalplayer_onSongChangedEvent(iTunesClass song)
 {
     songmanage.ev_OnPlayerPlayEvent(song);
 }