private void TextBoxName_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            String str = TextBoxName.Text.Trim();

            if (str.Length > 12)
            {
                TextBoxName.Text = str.Remove(12);
                MessageBox.Show("用户名长度不能超过12个字符!", "操作提示");
                TextBoxName.Select(str.Length, 0);
            }
        }
Example #2
0
 private void InputTextDialog_Load(object sender, EventArgs e)
 {
     try
     {
         if (Path.HasExtension(TextBoxName.Text))
         {
             TextBoxName.Select(0, TextBoxName.Text.IndexOf(Path.GetExtension(TextBoxName.Text)));
         }
     }
     catch { }
 }
Example #3
0
 private void TextBoxName_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (TextBoxName.Text.Count() > 255)
     {
         string textBlock = TextBoxName.Text;
         textBlock        = textBlock.Remove(textBlock.Length - 1);
         TextBoxName.Text = textBlock;
         TextBoxName.Select(TextBoxName.Text.Length, 0);
     }
     Bizz.TempEnterprise.Name = TextBoxName.Text;
 }
Example #4
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            TextBoxName.Focus();

            if (IsEditMode)
            {
                var genreInformation = _connectionManager.GetDataTable(CommandFactory.GetGenreInformation(_genreId)).Rows[0];

                TextBoxName.Text = genreInformation["genre_name"].ToString();
                TextBoxName.Select(TextBoxName.Text.Length, 0);
            }
        }
Example #5
0
        private void TextBoxName_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (TextBoxName.Text.Count() > 255)
            {
                string textBlock = TextBoxName.Text;
                textBlock        = textBlock.Remove(textBlock.Length - 1);
                TextBoxName.Text = textBlock;
                TextBoxName.Select(TextBoxName.Text.Length, 0);
            }
            CBZ.TempEnterprise.Name = TextBoxName.Text;

            //Set CBZ.UcMainEdited
            if (!CBZ.UcMainEdited)
            {
                CBZ.UcMainEdited = true;
            }
        }
Example #6
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;
            }
        }
Example #7
0
        private async void ButtonEdit_Click(object sender, EventArgs e)
        {
            // 自分以外のプロフィールは変更できない
            if (this.twitterApi.CurrentUserId != this._displayUser.Id)
            {
                return;
            }

            using (ControlTransaction.Disabled(this.ButtonEdit))
            {
                if (!IsEditing)
                {
                    ButtonEditText  = ButtonEdit.Text;
                    ButtonEdit.Text = Properties.Resources.UserInfoButtonEdit_ClickText1;

                    TextBoxName.Text    = LabelName.Text;
                    TextBoxName.Enabled = true;
                    TextBoxName.Visible = true;
                    LabelName.Visible   = false;

                    TextBoxLocation.Text    = LabelLocation.Text;
                    TextBoxLocation.Enabled = true;
                    TextBoxLocation.Visible = true;
                    LabelLocation.Visible   = false;

                    TextBoxWeb.Text      = this._displayUser.Url;
                    TextBoxWeb.Enabled   = true;
                    TextBoxWeb.Visible   = true;
                    LinkLabelWeb.Visible = false;

                    TextBoxDescription.Text    = this._displayUser.Description;
                    TextBoxDescription.Enabled = true;
                    TextBoxDescription.Visible = true;
                    DescriptionBrowser.Visible = false;

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

                    IsEditing = true;
                }
                else
                {
                    Task showUserTask = null;

                    if (TextBoxName.Modified ||
                        TextBoxLocation.Modified ||
                        TextBoxWeb.Modified ||
                        TextBoxDescription.Modified)
                    {
                        try
                        {
                            var response = await this.twitterApi.AccountUpdateProfile(
                                this.TextBoxName.Text,
                                this.TextBoxWeb.Text,
                                this.TextBoxLocation.Text,
                                this.TextBoxDescription.Text);

                            var user = await response.LoadJsonAsync();

                            showUserTask = this.ShowUserAsync(user);
                        }
                        catch (WebApiException ex)
                        {
                            MessageBox.Show($"Err:{ex.Message}(AccountUpdateProfile)");
                            return;
                        }
                    }

                    TextBoxName.Enabled = false;
                    TextBoxName.Visible = false;
                    LabelName.Visible   = true;

                    TextBoxLocation.Enabled = false;
                    TextBoxLocation.Visible = false;
                    LabelLocation.Visible   = true;

                    TextBoxWeb.Enabled   = false;
                    TextBoxWeb.Visible   = false;
                    LinkLabelWeb.Visible = true;

                    TextBoxDescription.Enabled = false;
                    TextBoxDescription.Visible = false;
                    DescriptionBrowser.Visible = true;

                    ButtonEdit.Text = ButtonEditText;

                    IsEditing = false;

                    if (showUserTask != null)
                    {
                        await showUserTask;
                    }
                }
            }
        }