Esempio n. 1
0
        private void UpdateProfile_Dowork(object sender, DoWorkEventArgs e)
        {
            UpdateProfileArgs arg = (UpdateProfileArgs)e.Argument;

            e.Result = arg.tw.PostUpdateProfile(arg.name,
                                                arg.url,
                                                arg.location,
                                                arg.description);
        }
Esempio n. 2
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;
            }
        }
Esempio n. 3
0
        private void ButtonEdit_Click(object sender, EventArgs e)
        {
            // 自分以外のプロフィールは変更できない
            if ( MyOwner.TwitterInstance.Username != _info.ScreenName )
                return;

            if ( !IsEditing ) {
                ButtonEditText = ButtonEdit.Text;
                ButtonEdit.Text = Properties.Resources.UserInfoButtonEdit_ClickText1;

                //座標初期化,プロパティ設定
                TextBoxName.Location = LabelName.Location;
                TextBoxName.Height = LabelName.Height;
                TextBoxName.Width = LabelName.Width;
                TextBoxName.BackColor = MyOwner.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 = MyOwner.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 = MyOwner.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 = MyOwner.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 {
                UpdateProfileArgs arg = new UpdateProfileArgs ();

                if ( TextBoxName.Modified ||
                    TextBoxLocation.Modified ||
                    TextBoxWeb.Modified ||
                    TextBoxDescription.Modified ) {
                    arg.tw = MyOwner.TwitterInstance;
                    arg.name = TextBoxName.Text.Trim();
                    arg.url = TextBoxWeb.Text.Trim();
                    arg.location = TextBoxLocation.Text.Trim();
                    arg.description = TextBoxDescription.Text.Trim();

                    using (FormInfo dlg = new FormInfo(this, Properties.Resources.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;
            }
        }