Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void wacotsu_Success(object sender, SuccessEventArgs e)
        {
            var item = this.createLiveListViewItem(e.Live, e.Seat);

            this.Invoke((MethodInvoker) delegate()
            {
                // バルーンチップ&音声通知
                if (this.ballonTipEnabledCheckBox.Checked)
                {
                    System.Media.SystemSounds.Beep.Play();
                    this.notifyIcon.ShowBalloonTip(3000, "<<座席確保>>" + e.Live.Title, e.Seat.ToString(), ToolTipIcon.Info);
                }
                // フォームを点滅させて通知する
                this.Activate();
                this.gotLiveListView.Items.Add(item);
            });
            this.removeItemFromReservedListView(e.Live);
        }
Beispiel #2
0
		/// <summary>
		/// 放送の座席を取得
		/// </summary>
		/// <param name="liveId"></param>
		private void fetch(string liveId)
		{
			try {
				// アクセス
				var status = api.GetLiveStatus(liveId);
				if (status != null) {
					var successArgs = new SuccessEventArgs { LiveId = liveId, LiveStatus = status };
					this.Success(this, successArgs);
					Cancel(liveId);
				}
			}
			catch (Exception ex) {
				// エラーがニコニコ生放送のエラーならこれ以上再試行しても無駄なので中止する
				if (ex is NiconicoApi.Live.StatusException) {
					var errorReason = ((NiconicoApi.Live.StatusException)ex).Reason;
					var failedArgs = new FailedEventArgs { LiveId = liveId, FailReason = errorReason };
					this.Failed(this, failedArgs);
					Cancel(liveId);
				}
				// それ以外のエラーは大抵503なのでそのまま再試行
			}
		}