public AuthenticateWindow(OAuthAuthorization authorization) { InitializeComponent(); if (authorization.Token != null) this.Title += ": " + authorization.Token.Name; this.ViewModel.Authorization = authorization; this.ViewModel.RequestClose += (sender, e) => this.DialogResult = e.Value; this.ViewModel.RequestError += (sender, e) => Application.Current.Dispatcher.BeginInvoke((Action)(() => MessageBoxEx.Show(this, e.Value.Message, this.Title, MessageBoxButton.OK, MessageBoxImage.Exclamation)), DispatcherPriority.Background); }
/// <summary> /// 指定された認証を使用して非同期に User Streams に接続を開始します。 /// </summary> /// <param name="auth">OAuth 認証。</param> /// <returns>接続が開始されたかどうか。</returns> public bool Connect(OAuthAuthorization auth) { if (streamingThread != null) return false; streamingThread = new Thread(ThreadMain) { IsBackground = true, }; streamingThread.Start(auth); return true; }