Esempio n. 1
0
        private void RefreshLists()
        {
            using (var dlg = new FormInfo(this, "Getting Lists...", RefreshLists_DoWork))
            {
                dlg.ShowDialog();
                var ret = (string)dlg.Result;
                if (string.IsNullOrEmpty(ret))
                {
                    return;
                }

                MessageBox.Show(string.Format("Failed to get lists. ({0})", ret));
            }
        }
Esempio n. 2
0
        private void ShowUserStatus(string id, bool showInputDialog = true)
        {
            if (id == null)
            {
                return;
            }

            var sid = id;
            if (showInputDialog)
            {
                if (!TryUserInputText(ref sid, "Show UserStatus", R.FRMessage1))
                {
                    return;
                }

                id = sid;
            }

            if (string.IsNullOrEmpty(id))
            {
                return;
            }

            var user = new DataModels.Twitter.User();
            var args = new GetUserInfoArgs { Tw = _tw, Id = id, User = user };
            using (var info = new FormInfo(this, R.doShowUserStatusText1, GetUserInfo_DoWork, null, args))
            {
                info.ShowDialog();
                var ret = (string)info.Result;
                if (!string.IsNullOrEmpty(ret))
                {
                    MessageBox.Show(ret);
                    return;
                }
            }

            using (var userinfo = new ShowUserInfo())
            {
                userinfo.Owner = this;
                userinfo.SetUser(args.User);
                userinfo.ShowDialog(this);
                Activate();
                BringToFront();
            }
        }
Esempio n. 3
0
        private void RefreshLists()
        {
            using (var dlg = new FormInfo(this, R.ListsGetting, RefreshLists_Dowork))
            {
                dlg.ShowDialog();
                var result = (string)dlg.Result;
                if (string.IsNullOrEmpty(result))
                {
                    return;
                }

                MessageBox.Show(string.Format(R.ListsDeleteFailed, result));
            }
        }
Esempio n. 4
0
 private void ShowCurrentTweetRtCountBox()
 {
     if (ExistCurrentPost)
     {
         using (var formInfo = new FormInfo(this, R.RtCountMenuItem_ClickText1, GetRetweet_DoWork))
         {
             // ダイアログ表示
             formInfo.ShowDialog();
             var retweetCount = (int)formInfo.Result;
             string msg = retweetCount < 0 ?
                 R.RtCountText2 :
                 string.Format("{0}{1}", retweetCount, R.RtCountText1);
             MessageBox.Show(msg);
         }
     }
 }
Esempio n. 5
0
        private void ShowFriendshipCore(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return;
            }

            id = id.Trim();
            if (id.ToLower() == _tw.Username.ToLower())
            {
                return;
            }

            var args = new ShowFriendshipArgs { Tw = _tw };
            args.Ids.Add(new ShowFriendshipArgs.FriendshipInfo(id));
            string ret;
            using (var formInfo = new FormInfo(this, R.ShowFriendshipText1, ShowFriendship_DoWork, null, args))
            {
                formInfo.ShowDialog();
                ret = (string)formInfo.Result;
            }

            if (!string.IsNullOrEmpty(ret))
            {
                MessageBox.Show(ret);
                return;
            }

            ShowFriendshipArgs.FriendshipInfo frsinfo = args.Ids[0];
            string fing = frsinfo.IsFollowing ?
                R.GetFriendshipInfo1 :
                R.GetFriendshipInfo2;
            string fed = frsinfo.IsFollowed ?
                R.GetFriendshipInfo3 :
                R.GetFriendshipInfo4;
            string result = frsinfo.Id + R.GetFriendshipInfo5 + Environment.NewLine;
            result += "  " + fing + Environment.NewLine;
            result += "  " + fed;
            if (frsinfo.IsFollowing)
            {
                var rslt = MessageBox.Show(R.GetFriendshipInfo7 + Environment.NewLine + result, R.GetFriendshipInfo8, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (rslt == DialogResult.Yes)
                {
                    RemoveCommand(frsinfo.Id, true);
                }
            }
            else
            {
                MessageBox.Show(result);
            }
        }
Esempio n. 6
0
        private void ShowApiInfoBox()
        {
            var args = new GetApiInfoArgs { Tw = _tw, Info = new ApiInfo() };
            var tmp = new StringBuilder();
            using (var dlg = new FormInfo(this, R.ApiInfo6, GetApiInfo_Dowork, null, args))
            {
                dlg.ShowDialog();
                if ((bool)dlg.Result)
                {
                    tmp.AppendLine(string.Format("{0}{1}", R.ApiInfo1, args.Info.MaxCount));
                    tmp.AppendLine(string.Format("{0}{1}", R.ApiInfo2, args.Info.RemainCount));
                    tmp.AppendLine(string.Format("{0}{1}", R.ApiInfo3, args.Info.ResetTime));
                    tmp.AppendLine(string.Format("{0}{1}", R.ApiInfo7, _tw.UserStreamEnabled ? R.Enable : R.Disable));
                    tmp.AppendLine();
                    tmp.AppendLine(string.Format("{0}{1}", R.ApiInfo8, args.Info.AccessLevel));
                    tmp.AppendLine();
                    tmp.AppendLine(string.Format("{0}{1}", R.ApiInfo9, args.Info.MediaMaxCount < 0 ? R.ApiInfo91 : args.Info.MediaMaxCount.ToString()));
                    tmp.AppendLine(string.Format("{0}{1}", R.ApiInfo10, args.Info.MediaRemainCount < 0 ? R.ApiInfo91 : args.Info.MediaRemainCount.ToString()));
                    tmp.AppendLine(string.Format("{0}{1}", R.ApiInfo11, args.Info.MediaResetTime == new DateTime() ? R.ApiInfo91 : args.Info.MediaResetTime.ToString()));
                    SetStatusLabelUrl();
                }
                else
                {
                    tmp.Append(R.ApiInfo5);
                }
            }

            MessageBox.Show(tmp.ToString(), R.ApiInfo4, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 7
0
        private void RemoveCommand(string id, bool skipInput)
        {
            if (id == null)
            {
                return;
            }

            if (!skipInput)
            {
                var removeid = id;
                if (!TryUserInputText(ref removeid, "Unfollow", R.FRMessage1))
                {
                    return;
                }

                id = removeid;
            }

            if (string.IsNullOrEmpty(id) || id == _tw.Username)
            {
                return;
            }

            var arg = new FollowRemoveCommandArgs { Tw = _tw, Id = id };
            using (var info = new FormInfo(this, R.RemoveCommandText1, RemoveCommand_DoWork, null, arg))
            {
                info.ShowDialog();
                var ret = (string)info.Result;
                MessageBox.Show(!string.IsNullOrEmpty(ret) ? R.FRMessage2 + ret : R.FRMessage3);
            }
        }
Esempio n. 8
0
        private void FollowCommand(string id)
        {
            if (id == null)
            {
                return;
            }

            var followid = id;
            if (!TryUserInputText(ref followid, "Follow", R.FRMessage1))
            {
                return;
            }

            id = followid;
            if (string.IsNullOrEmpty(id) || id == _tw.Username)
            {
                return;
            }

            using (var info = new FormInfo(this, R.FollowCommandText1, FollowCommand_DoWork, null, new FollowRemoveCommandArgs { Tw = _tw, Id = id }))
            {
                info.ShowDialog();
                var ret = (string)info.Result;
                MessageBox.Show(!string.IsNullOrEmpty(ret) ? R.FRMessage2 + ret : R.FRMessage3);
            }
        }
Esempio n. 9
0
        private void ChangeIcon(string filename)
        {
            var arg = new UpdateProfileImageArgs
            {
                Tw = _owner.TwitterInstance,
                FileName = filename
            };

            using (var dlg = new FormInfo(this, R.ChangeIconToolStripMenuItem_ClickText3, UpdateProfileImage_Dowork, UpdateProfileImage_RunWorkerCompleted, arg))
            {
                dlg.ShowDialog();
                var res = dlg.Result as string;
                if (!string.IsNullOrEmpty(res))
                {
                    // "Err:"が付いたエラーメッセージが返ってくる
                    MessageBox.Show(res + Environment.NewLine + R.ChangeIconToolStripMenuItem_ClickText4);
                }
                else
                {
                    MessageBox.Show(R.ChangeIconToolStripMenuItem_ClickText5);
                }
            }
        }
Esempio n. 10
0
        private void ButtonEdit_Click(object sender, EventArgs e)
        {
            // 自分以外のプロフィールは変更できない
            if (_owner.TwitterInstance.Username != _info.ScreenName)
            {
                return;
            }

            if (!_isEditing)
            {
                _buttonEditText = ButtonEdit.Text;
                ButtonEdit.Text = R.UserInfoButtonEdit_ClickText1;

                // 座標初期化,プロパティ設定
                TextBoxName.Location = LabelName.Location;
                TextBoxName.Height = LabelName.Height;
                TextBoxName.Width = LabelName.Width;
                TextBoxName.BackColor = _owner.InputBackColor;
                TextBoxName.MaxLength = 20;
                TextBoxName.Text = LabelName.Text;
                TextBoxName.TabStop = true;
                TextBoxName.Visible = true;
                LabelName.Visible = false;

                TextBoxLocation.Location = LabelLocation.Location;
                TextBoxLocation.Height = LabelLocation.Height;
                TextBoxLocation.Width = LabelLocation.Width;
                TextBoxLocation.BackColor = _owner.InputBackColor;
                TextBoxLocation.MaxLength = 30;
                TextBoxLocation.Text = LabelLocation.Text;
                TextBoxLocation.TabStop = true;
                TextBoxLocation.Visible = true;
                LabelLocation.Visible = false;

                TextBoxWeb.Location = LinkLabelWeb.Location;
                TextBoxWeb.Height = LinkLabelWeb.Height;
                TextBoxWeb.Width = LinkLabelWeb.Width;
                TextBoxWeb.BackColor = _owner.InputBackColor;
                TextBoxWeb.MaxLength = 100;
                TextBoxWeb.Text = _info.Url;
                TextBoxWeb.TabStop = true;
                TextBoxWeb.Visible = true;
                LinkLabelWeb.Visible = false;

                TextBoxDescription.Location = DescriptionBrowser.Location;
                TextBoxDescription.Height = DescriptionBrowser.Height;
                TextBoxDescription.Width = DescriptionBrowser.Width;
                TextBoxDescription.BackColor = _owner.InputBackColor;
                TextBoxDescription.MaxLength = 160;
                TextBoxDescription.Text = _info.Description;
                TextBoxDescription.Multiline = true;
                TextBoxDescription.ScrollBars = ScrollBars.Vertical;
                TextBoxDescription.TabStop = true;
                TextBoxDescription.Visible = true;
                DescriptionBrowser.Visible = false;

                TextBoxName.Focus();
                TextBoxName.Select(TextBoxName.Text.Length, 0);

                _isEditing = true;
            }
            else
            {
                if (TextBoxName.Modified || TextBoxLocation.Modified || TextBoxWeb.Modified || TextBoxDescription.Modified)
                {
                    var arg = new UpdateProfileArgs
                    {
                        Tw = _owner.TwitterInstance,
                        Name = TextBoxName.Text.Trim(),
                        Url = TextBoxWeb.Text.Trim(),
                        Location = TextBoxLocation.Text.Trim(),
                        Description = TextBoxDescription.Text.Trim()
                    };

                    using (var dlg = new FormInfo(this, R.UserInfoButtonEdit_ClickText2, UpdateProfile_Dowork, UpddateProfile_RunWorkerCompleted, arg))
                    {
                        dlg.ShowDialog();
                        if (!string.IsNullOrEmpty(dlg.Result.ToString()))
                        {
                            return;
                        }
                    }
                }

                LabelName.Text = TextBoxName.Text;
                _info.Name = LabelName.Text;
                TextBoxName.TabStop = false;
                TextBoxName.Visible = false;
                LabelName.Visible = true;

                LabelLocation.Text = TextBoxLocation.Text;
                _info.Location = LabelLocation.Text;
                TextBoxLocation.TabStop = false;
                TextBoxLocation.Visible = false;
                LabelLocation.Visible = true;

                SetLinklabelWeb(TextBoxWeb.Text);
                _info.Url = TextBoxWeb.Text;
                TextBoxWeb.TabStop = false;
                TextBoxWeb.Visible = false;
                LinkLabelWeb.Visible = true;

                DescriptionBrowser.DocumentText = MakeDescriptionBrowserText(TextBoxDescription.Text);
                _info.Description = TextBoxDescription.Text;
                TextBoxDescription.TabStop = false;
                TextBoxDescription.Visible = false;
                DescriptionBrowser.Visible = true;

                ButtonEdit.Text = _buttonEditText;

                _isEditing = false;
            }
        }