示例#1
0
        private void updateTwitterBackgroundWorker_RunWorkerCompleted(object sender, OpenNETCF.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                if (e.Error is WebException)
                {
                    switch (((WebException)e.Error).Status)
                    {
                    case WebExceptionStatus.ProtocolError:
                        errorTextStatusBar = string.Format("{0}{1}", stringResource.GetString("PrefixTwitter"), stringResource.GetString("UserNameORPasswordWrong"));
                        break;

                    case WebExceptionStatus.Timeout:
                        errorTextStatusBar = string.Format("{0}{1}", stringResource.GetString("PrefixTwitter"), stringResource.GetString("ConnectionTimuout"));
                        break;

                    default:
                        errorTextStatusBar = string.Format("{0}{1}", stringResource.GetString("PrefixTwitter"), stringResource.GetString("NotAbleToBeFetch"));
                        break;
                    }
                }
                else if (e.Error is UriFormatException)
                {
                    errorTextStatusBar = string.Format("{0}{1}", stringResource.GetString("PrefixTwitter"), stringResource.GetString("NotAbleToBeUpdate"));
                }
            }

            twitButton.Enabled = true;
        }
示例#2
0
        private void fetchDirectMessageBackgroundWorker_RunWorkerCompleted(object sender, OpenNETCF.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled == true)
            {
                ;
            }
            else if (e.Error == null)
            {
                if (this.InvokeRequired == true)
                {
                    Invoke(new UpdateDirectMessageListViewDelegate(UpdateDirectMessageListView), new object[] { twitterDirectMessages });
                }
                else
                {
                    UpdateDirectMessageListView(twitterDirectMessages);
                }
            }
            else
            {
                if (e.Error is WebException)
                {
                    switch (((WebException)e.Error).Status)
                    {
                    case WebExceptionStatus.ProtocolError:
                        errorTextStatusBar = string.Format("{0}{1}", stringResource.GetString("PrefixDirectMessage"), stringResource.GetString("UserNameORPasswordWrong"));
                        break;

                    case WebExceptionStatus.Timeout:
                        errorTextStatusBar = string.Format("{0}{1}", stringResource.GetString("PrefixDirectMessage"), stringResource.GetString("ConnectionTimuout"));
                        break;

                    default:
                        errorTextStatusBar = string.Format("{0}{1}", stringResource.GetString("PrefixDirectMessage"), stringResource.GetString("NotAbleToBeFetch"));
                        break;
                    }
                }
            }
        }