this.InitializeShortcuts();
this.ignoreConfigSave = true;
- this.Visible = false;
this.TraceOutToolStripMenuItem.Checked = MyCommon.TraceFlag;
this.SetMainWindowTitle();
this.SetNotifyIconText();
- if (!this.settings.Common.MinimizeToTray || this.WindowState != FormWindowState.Minimized)
+ if (this.settings.Common.MinimizeToTray && this.WindowState == FormWindowState.Minimized)
{
- this.Visible = true;
+ this.Visible = false;
}
// タイマー設定
this.TimerRefreshIcon.Enabled = false;
this.ignoreConfigSave = false;
- this.TweenMain_Resize(this, EventArgs.Empty);
-
- if (this.settings.IsFirstRun)
- {
- // 初回起動時だけ右下のメニューを目立たせる
- this.HashStripSplitButton.ShowDropDown();
- }
+ this.ApplyLayoutFromSettings();
}
private void TweenMain_Activated(object sender, EventArgs e)
// http://msdn.microsoft.com/ja-jp/library/microsoft.win32.systemevents.powermodechanged.aspx
Microsoft.Win32.SystemEvents.PowerModeChanged -= this.SystemEvents_PowerModeChanged;
Microsoft.Win32.SystemEvents.TimeChanged -= this.SystemEvents_TimeChanged;
+ MyCommon.TwitterApiInfo.AccessLimitUpdated -= this.TwitterApiStatus_AccessLimitUpdated;
this.disposed = true;
}
var status = new PostStatusParams();
var statusTextCompat = this.FormatStatusText(this.StatusText.Text);
- if (this.GetRestStatusCount(statusTextCompat) >= 0 && this.tw.Api.AppToken.AuthType == APIAuthType.OAuth1)
+ if (this.GetRestStatusCount(statusTextCompat) >= 0 && this.tw.Api.AuthType == APIAuthType.OAuth1)
{
// auto_populate_reply_metadata や attachment_url を使用しなくても 140 字以内に
// 収まる場合はこれらのオプションを使用せずに投稿する
var account = this.settings.Common.SelectedAccount;
if (account != null)
- this.tw.Initialize(account.GetTwitterAppToken(), account.Token, account.TokenSecret, account.Username, account.UserId);
+ this.tw.Initialize(account.GetTwitterCredential(), account.Username, account.UserId);
else
- this.tw.Initialize(TwitterAppToken.GetDefault(), "", "", "", 0L);
+ this.tw.Initialize(new TwitterCredentialNone(), "", 0L);
this.tw.RestrictFavCheck = this.settings.Common.RestrictFavCheck;
this.tw.ReadOwnPost = this.settings.Common.ReadOwnPost;
/// <summary>
/// ツイート投稿前のフッター付与などの前処理を行います
/// </summary>
- private string FormatStatusText(string statusText)
+ internal string FormatStatusText(string statusText)
{
statusText = statusText.Replace("\r\n", "\n");
this.ModifySettingCommon = false;
lock (this.syncObject)
{
- this.settings.Common.UserName = this.tw.Username;
- this.settings.Common.UserId = this.tw.UserId;
- this.settings.Common.Token = this.tw.AccessToken;
- this.settings.Common.TokenSecret = this.tw.AccessTokenSecret;
this.settings.Common.SortOrder = (int)this.statuses.SortOrder;
this.settings.Common.SortColumn = this.statuses.SortMode switch
{
if (endpointName == null)
{
- var authByCookie = this.tw.Api.AppToken.AuthType == APIAuthType.TwitterComCookie;
+ var authByCookie = this.tw.Api.AuthType == APIAuthType.TwitterComCookie;
// 表示中のタブに応じて更新
endpointName = tabType switch
{
this.Visible = false;
}
- if (this.initialLayout && this.settings.Local != null && this.WindowState == FormWindowState.Normal && this.Visible)
+ if (this.WindowState != FormWindowState.Minimized)
{
- // 現在の DPI と設定保存時の DPI との比を取得する
- var configScaleFactor = this.settings.Local.GetConfigScaleFactor(this.CurrentAutoScaleDimensions);
+ this.formWindowState = this.WindowState;
+ }
+ }
- this.ClientSize = ScaleBy(configScaleFactor, this.settings.Local.FormSize);
+ private void ApplyLayoutFromSettings()
+ {
+ // 現在の DPI と設定保存時の DPI との比を取得する
+ var configScaleFactor = this.settings.Local.GetConfigScaleFactor(this.CurrentAutoScaleDimensions);
- // Splitterの位置設定
- var splitterDistance = ScaleBy(configScaleFactor.Height, this.settings.Local.SplitterDistance);
- if (splitterDistance > this.SplitContainer1.Panel1MinSize &&
- splitterDistance < this.SplitContainer1.Height - this.SplitContainer1.Panel2MinSize - this.SplitContainer1.SplitterWidth)
- {
- this.SplitContainer1.SplitterDistance = splitterDistance;
- }
+ this.ClientSize = ScaleBy(configScaleFactor, this.settings.Local.FormSize);
- // 発言欄複数行
- this.StatusText.Multiline = this.settings.Local.StatusMultiline;
- if (this.StatusText.Multiline)
- {
- var statusTextHeight = ScaleBy(configScaleFactor.Height, this.settings.Local.StatusTextHeight);
- var dis = this.SplitContainer2.Height - statusTextHeight - this.SplitContainer2.SplitterWidth;
- if (dis > this.SplitContainer2.Panel1MinSize && dis < this.SplitContainer2.Height - this.SplitContainer2.Panel2MinSize - this.SplitContainer2.SplitterWidth)
- {
- this.SplitContainer2.SplitterDistance = this.SplitContainer2.Height - statusTextHeight - this.SplitContainer2.SplitterWidth;
- }
- this.StatusText.Height = statusTextHeight;
- }
- else
+ // Splitterの位置設定
+ var splitterDistance = ScaleBy(configScaleFactor.Height, this.settings.Local.SplitterDistance);
+ if (splitterDistance > this.SplitContainer1.Panel1MinSize &&
+ splitterDistance < this.SplitContainer1.Height - this.SplitContainer1.Panel2MinSize - this.SplitContainer1.SplitterWidth)
+ {
+ this.SplitContainer1.SplitterDistance = splitterDistance;
+ }
+
+ // 発言欄複数行
+ this.StatusText.Multiline = this.settings.Local.StatusMultiline;
+ if (this.StatusText.Multiline)
+ {
+ var statusTextHeight = ScaleBy(configScaleFactor.Height, this.settings.Local.StatusTextHeight);
+ var dis = this.SplitContainer2.Height - statusTextHeight - this.SplitContainer2.SplitterWidth;
+ if (dis > this.SplitContainer2.Panel1MinSize && dis < this.SplitContainer2.Height - this.SplitContainer2.Panel2MinSize - this.SplitContainer2.SplitterWidth)
{
- if (this.SplitContainer2.Height - this.SplitContainer2.Panel2MinSize - this.SplitContainer2.SplitterWidth > 0)
- {
- this.SplitContainer2.SplitterDistance = this.SplitContainer2.Height - this.SplitContainer2.Panel2MinSize - this.SplitContainer2.SplitterWidth;
- }
+ this.SplitContainer2.SplitterDistance = this.SplitContainer2.Height - statusTextHeight - this.SplitContainer2.SplitterWidth;
}
-
- var previewDistance = ScaleBy(configScaleFactor.Width, this.settings.Local.PreviewDistance);
- if (previewDistance > this.SplitContainer3.Panel1MinSize && previewDistance < this.SplitContainer3.Width - this.SplitContainer3.Panel2MinSize - this.SplitContainer3.SplitterWidth)
+ this.StatusText.Height = statusTextHeight;
+ }
+ else
+ {
+ if (this.SplitContainer2.Height - this.SplitContainer2.Panel2MinSize - this.SplitContainer2.SplitterWidth > 0)
{
- this.SplitContainer3.SplitterDistance = previewDistance;
+ this.SplitContainer2.SplitterDistance = this.SplitContainer2.Height - this.SplitContainer2.Panel2MinSize - this.SplitContainer2.SplitterWidth;
}
-
- // Panel2Collapsed は SplitterDistance の設定を終えるまで true にしない
- this.SplitContainer3.Panel2Collapsed = true;
-
- this.initialLayout = false;
}
- if (this.WindowState != FormWindowState.Minimized)
+
+ var previewDistance = ScaleBy(configScaleFactor.Width, this.settings.Local.PreviewDistance);
+ if (previewDistance > this.SplitContainer3.Panel1MinSize && previewDistance < this.SplitContainer3.Width - this.SplitContainer3.Panel2MinSize - this.SplitContainer3.SplitterWidth)
{
- this.formWindowState = this.WindowState;
+ this.SplitContainer3.SplitterDistance = previewDistance;
}
+
+ // Panel2Collapsed は SplitterDistance の設定を終えるまで true にしない
+ this.SplitContainer3.Panel2Collapsed = true;
+ this.initialLayout = false;
}
private void PlaySoundMenuItem_CheckedChanged(object sender, EventArgs e)
this.NotifyIcon1.Visible = true;
this.StartTimers();
+ if (this.settings.IsFirstRun)
+ {
+ // 初回起動時だけ右下のメニューを目立たせる
+ this.HashStripSplitButton.ShowDropDown();
+ }
+
if (this.IsNetworkAvailable())
{
var loadTasks = new TaskCollection();