//UIからクラスに代入する Core.ApplicationSetting.SettingClass PutSettingToClass() { Core.ApplicationSetting.SettingClass set = new Core.ApplicationSetting.SettingClass(); set.TweetText = TextBoxTweetText.Text; set.EnableAutoPost = CheckBoxEnableAutoPost.Checked; set.EnablePostWait = CheckBoxEnablePostWait.Checked; set.EnableCheckAlbum = CheckBoxEnableCheckAlbum.Checked; set.EnableCheckTime = CheckBoxCheckTime.Checked; set.PostAlbumArtWork = checkBoxPostAlbumArtWork.Checked; set.CheckUpdate = CheckUpdate.Checked; set.NotifyUpdate = NotifyUpdate.Checked; set.WaitSecond = (int)numericUpDownWaitSecond.Value; set.WaitSecond2 = (int)numericUpDownWaitSecond2.Value; set.DeleteText140 = CheckBoxDeleteText140.Checked; set.ExitWithiTunes = CheckBoxExitWithiTunes.Checked; set.NoAlbumArtworkOnSameAlbum = checkBoxSameAlbumNoArtwork.Checked; foreach (ListViewItem item in AccountList.Items) { Core.ApplicationSetting.AccountClass account = new Core.ApplicationSetting.AccountClass(); account.AccountName = item.Text; account.Token = item.SubItems[1].Text; account.TokenSecret = item.SubItems[2].Text; account.Enabled = item.Checked; set.AccountList.Add(account); } return(set); }
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()); } }
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()); } }
//UIからクラスに代入する Core.ApplicationSetting.SettingClass PutSettingToClass() { Core.ApplicationSetting.SettingClass set = new Core.ApplicationSetting.SettingClass(); set.TweetText = TextBoxTweetText.Text; set.EnableAutoPost = CheckBoxEnableAutoPost.Checked; set.EnablePostWait = CheckBoxEnablePostWait.Checked; set.EnableCheckAlbum = CheckBoxEnableCheckAlbum.Checked; set.EnableCheckTime = CheckBoxCheckTime.Checked; set.PostAlbumArtWork = checkBoxPostAlbumArtWork.Checked; set.CheckUpdate = CheckUpdate.Checked; set.NotifyUpdate = NotifyUpdate.Checked; set.WaitSecond = (int)numericUpDownWaitSecond.Value; set.WaitSecond2 = (int)numericUpDownWaitSecond2.Value; set.DeleteText140 = CheckBoxDeleteText140.Checked; set.ExitWithiTunes = CheckBoxExitWithiTunes.Checked; set.NoAlbumArtworkOnSameAlbum = checkBoxSameAlbumNoArtwork.Checked; foreach (ListViewItem item in AccountList.Items) { Core.ApplicationSetting.AccountClass account = new Core.ApplicationSetting.AccountClass(); account.AccountName = item.Text; account.Token = item.SubItems[1].Text; account.TokenSecret = item.SubItems[2].Text; account.Enabled = item.Checked; set.AccountList.Add(account); } return set; }