Exemple #1
0
        private void 今すぐツイートToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                //待機中のツイートを全てキャンセル
                songmanage.StopAllWaitingEvent();
                Trace.WriteLine("[Event 今すぐツイート MainWindow]" + "Stopped all waiting event.");

                Core.iTunesClass song = songmanage.getLatestSong();
                if (song == null)
                {
                    MessageBox.Show("再生されている曲がありません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                Trace.WriteLine("[Event 今すぐツイート MainWindow]" + "Sending tweet...");

                //アカウントのリストを作成する
                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)
                {
                    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 process started!");
            }
            catch (Exception ex)
            {
                Debug.Write(ex.ToString());
            }
        }
        public void ev_OnPlayerPlayEvent(iTunesClass song)
        {
            //iTunesのスレッドで実行されてるから使う時は必ずスレッドを建てること!!
            Trace.WriteLine("[Event OnPlayerPlayEvent(iTunesThread) SongManagement]" + "Title:" + song.SongTitle + ",Artist:" + song.SongArtist);
            // スレッド開始
            SongChangeEventSenderClass senderclass = new SongChangeEventSenderClass(this);
            senderclass.song = song;
            senderclass.EventSetting = EventSetting;

            Thread thread = new Thread(senderclass.SongChangeEventSender);
            ThreadList.Add(thread);
            thread.IsBackground = true;
            thread.Start();
        }
        public void ev_OnPlayerPlayEvent(iTunesClass song)
        {
            //iTunesのスレッドで実行されてるから使う時は必ずスレッドを建てること!!
            Trace.WriteLine("[Event OnPlayerPlayEvent(iTunesThread) SongManagement]" + "Title:" + song.SongTitle + ",Artist:" + song.SongArtist);
            // スレッド開始
            SongChangeEventSenderClass senderclass = new SongChangeEventSenderClass(this);

            senderclass.song         = song;
            senderclass.EventSetting = EventSetting;

            Thread thread = new Thread(senderclass.SongChangeEventSender);

            ThreadList.Add(thread);
            thread.IsBackground = true;
            thread.Start();
        }
 public static String ReplaceText(string text,iTunesClass song)
 {
     String returnText = text;
     returnText = returnText.Replace("$TITLE", song.SongTitle);
     returnText = returnText.Replace("$ARTIST", song.SongArtist);
     returnText = returnText.Replace("$ALBUMARTIST", song.SongAlbumArtist);
     returnText = returnText.Replace("$ALBUMNAME", song.SongAlbum);
     returnText = returnText.Replace("$COMMENT", song.SongComment);
     returnText = returnText.Replace("$COMPOSER", song.SongComposer);
     returnText = returnText.Replace("$DISCCOUNT", song.SongDiscCount.ToString());
     returnText = returnText.Replace("$DISCNUMBER", song.SongDiscNumber.ToString());
     returnText = returnText.Replace("$GENRE", song.SongGenre);
     returnText = returnText.Replace("$LASTPLAYED", song.SongLastPlayed.ToString("F"));
     returnText = returnText.Replace("$PLAYEDTIMES", song.SongPlayedTimes.ToString());
     returnText = returnText.Replace("$RATING", song.SongRating.ToString());
     returnText = returnText.Replace("$TRACKNUMBER", song.SongTrackNumber.ToString());
     returnText = returnText.Replace("$YEAR", song.SongYear.ToString());
     returnText = returnText.Replace("$NEWLINE", System.Environment.NewLine);
     returnText = returnText.Replace("$GROUP", song.Group);
     return returnText;
 }
Exemple #5
0
        public static String ReplaceText(string text, iTunesClass song)
        {
            String returnText = text;

            returnText = returnText.Replace("$TITLE", song.SongTitle);
            returnText = returnText.Replace("$ARTIST", song.SongArtist);
            returnText = returnText.Replace("$ALBUMARTIST", song.SongAlbumArtist);
            returnText = returnText.Replace("$ALBUMNAME", song.SongAlbum);
            returnText = returnText.Replace("$COMMENT", song.SongComment);
            returnText = returnText.Replace("$COMPOSER", song.SongComposer);
            returnText = returnText.Replace("$DISCCOUNT", song.SongDiscCount.ToString());
            returnText = returnText.Replace("$DISCNUMBER", song.SongDiscNumber.ToString());
            returnText = returnText.Replace("$GENRE", song.SongGenre);
            returnText = returnText.Replace("$LASTPLAYED", song.SongLastPlayed.ToString("F"));
            returnText = returnText.Replace("$PLAYEDTIMES", song.SongPlayedTimes.ToString());
            returnText = returnText.Replace("$RATING", song.SongRating.ToString());
            returnText = returnText.Replace("$TRACKNUMBER", song.SongTrackNumber.ToString());
            returnText = returnText.Replace("$YEAR", song.SongYear.ToString());
            returnText = returnText.Replace("$NEWLINE", System.Environment.NewLine);
            returnText = returnText.Replace("$GROUP", song.Group);
            return(returnText);
        }
 public IventHistory(iTunesClass sng, DateTime dt)
 {
     Song = sng;
     Time = dt;
 }
 public IventHistory(iTunesClass sng, DateTime dt)
 {
     Song = sng;
     Time = dt;
 }
        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());
            }
        }
 void externalplayer_onSongChangedEvent(iTunesClass song)
 {
     songmanage.ev_OnPlayerPlayEvent(song);
 }