Skip to content

Commit

Permalink
設定画面のアカウント一覧をComboBoxからListBoxに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
upsilon committed Feb 2, 2024
1 parent 13eac99 commit e1d0948
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 156 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
更新履歴

==== Unreleased
* CHG: 設定画面でのアカウント一覧の表示形式を変更

==== Ver 3.13.0(2024/01/27)
* NEW: Cookie使用時のReplyタブの更新に対応(/statuses/mentions_timeline.json 廃止に伴う対応)
Expand Down
39 changes: 7 additions & 32 deletions OpenTween/AppendSettingDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public AppendSettingDialog()
{
this.InitializeComponent();

this.BasedPanel.StartAuthButton.Click += this.StartAuthButton_Click;
this.BasedPanel.CreateAccountButton.Click += this.CreateAccountButton_Click;
this.BasedPanel.AddAccountButton.Click += this.AddAccountButton_Click;
this.GetPeriodPanel.CheckPostAndGet.CheckedChanged += this.CheckPostAndGet_CheckedChanged;
this.ActionPanel.UReadMng.CheckedChanged += this.UReadMng_CheckedChanged;

Expand Down Expand Up @@ -115,7 +114,8 @@ private void Setting_FormClosing(object sender, FormClosingEventArgs e)
{
if (MyCommon.EndingFlag) return;

if (this.BasedPanel.AuthUserCombo.SelectedIndex == -1 && e.CloseReason == CloseReason.None)
var primaryAccountExists = this.BasedPanel.AccountsList.Any(x => x.IsPrimary);
if (!primaryAccountExists && e.CloseReason == CloseReason.None)
{
if (MessageBox.Show(Properties.Resources.Setting_FormClosing1, "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
{
Expand Down Expand Up @@ -151,7 +151,7 @@ private void Setting_Load(object sender, EventArgs e)
this.TreeViewSetting.SelectedNode = this.TreeViewSetting.Nodes[0];
this.TreeViewSetting.ExpandAll();

this.ActiveControl = this.BasedPanel.StartAuthButton;
this.ActiveControl = this.BasedPanel.AddAccountButton;
}

private void UReadMng_CheckedChanged(object sender, EventArgs e)
Expand All @@ -166,9 +166,9 @@ private void UReadMng_CheckedChanged(object sender, EventArgs e)
}
}

private async void StartAuthButton_Click(object sender, EventArgs e)
private async void AddAccountButton_Click(object sender, EventArgs e)
{
using (ControlTransaction.Disabled(this.BasedPanel.StartAuthButton))
using (ControlTransaction.Disabled(this.BasedPanel.AddAccountButton))
{
try
{
Expand Down Expand Up @@ -201,23 +201,7 @@ private async void StartAuthButton_Click(object sender, EventArgs e)
newAccount = account;
}

var authUserCombo = this.BasedPanel.AuthUserCombo;

var oldAccount = authUserCombo.Items.Cast<UserAccount>()
.FirstOrDefault(x => x.UserId == newAccount.UserId);

int idx;
if (oldAccount != null)
{
idx = authUserCombo.Items.IndexOf(oldAccount);
authUserCombo.Items[idx] = newAccount;
}
else
{
idx = authUserCombo.Items.Add(newAccount);
}

authUserCombo.SelectedIndex = idx;
this.BasedPanel.AddAccount(newAccount);

MessageBox.Show(
this,
Expand Down Expand Up @@ -318,15 +302,6 @@ private void Setting_Shown(object sender, EventArgs e)
this.GetPeriodPanel.UpdateTabCounts(TabInformations.GetInstance());
}

private async Task OpenUrl(string url)
{
var browserPathWithArgs = this.ActionPanel.BrowserPathText.Text;
await MyCommon.OpenInBrowserAsync(this, browserPathWithArgs, url);
}

private async void CreateAccountButton_Click(object sender, EventArgs e)
=> await this.OpenUrl("https://twitter.com/signup");

private void GetPeriodPanel_IntervalChanged(object sender, IntervalChangedEventArgs e)
=> this.IntervalChanged?.Invoke(sender, e);
}
Expand Down
11 changes: 10 additions & 1 deletion OpenTween/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion OpenTween/Properties/Resources.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>

<data name="AccountListBoxItem_Primary"><value>(Primary)</value></data>
<data name="AddNewTab_ListView_AccessibleName"><value>PostsList</value></data>
<data name="AddNewTabText1"><value>(New Tab)</value></data>
<data name="AddNewTabText2"><value>Name</value></data>
Expand Down Expand Up @@ -258,7 +259,7 @@ Available service: {1}</value></data>
<data name="SetStatusLabelText2"><value>-]</value></data>
<data name="SetStatusLabelText3"><value>]</value></data>
<data name="SetStatusLabelText4"><value>[Updates: {0:#,0}]</value></data>
<data name="Setting_FormClosing1"><value>Press [Start Authentication] button and [Authorize App]. Key in PIN then press [Finish] button. Will you exit application without validating your account?</value></data>
<data name="Setting_FormClosing1"><value>The primary account has not been set up. Are you sure you want to exit?</value></data>
<data name="SettingPath_Relocation"><value>Failed to write settings to {0}.

Existing setting files are copied to {1}.
Expand Down
3 changes: 2 additions & 1 deletion OpenTween/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

<data name="AccountListBoxItem_Primary"><value>(メイン)</value></data>
<data name="AddNewTab_ListView_AccessibleName"><value>発言一覧</value></data>
<data name="AddNewTabText1"><value>(新規タブ)</value></data>
<data name="AddNewTabText2"><value>名前</value></data>
Expand Down Expand Up @@ -290,7 +291,7 @@
<data name="SetStatusLabelText2"><value>-]</value></data>
<data name="SetStatusLabelText3"><value>]</value></data>
<data name="SetStatusLabelText4"><value>[更新: {0:#,0}]</value></data>
<data name="Setting_FormClosing1"><value>「認証開始」ボタンを押すとブラウザが開きます。「連携アプリを認証」し、表示されたPINを画面上部に入力後、「Finish」ボタンを押してください。認証せずに終了してもよろしいですか?</value></data>
<data name="Setting_FormClosing1"><value>メインのアカウントが設定されていません。このまま終了してもよろしいですか?</value></data>
<data name="SettingPath_Relocation"><value>{0} での設定の書き込みに失敗しました。

既存の設定ファイルは {1} にコピーされます。
Expand Down
73 changes: 36 additions & 37 deletions OpenTween/Setting/Panel/BasedPanel.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e1d0948

Please sign in to comment.