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());
            }
        }
Exemple #2
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());
            }
        }
        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());
            }
        }
        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());
            }
        }