OSDN Git Service

C# 8.0 のnull許容参照型を有効化
[opentween/open-tween.git] / OpenTween / Setting / Panel / TweetPrvPanel.cs
index e158625..03b27c6 100644 (file)
@@ -24,6 +24,8 @@
 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
 // Boston, MA 02110-1301, USA.
 
+#nullable enable
+
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -38,9 +40,7 @@ namespace OpenTween.Setting.Panel
     public partial class TweetPrvPanel : SettingPanelBase
     {
         public TweetPrvPanel()
-        {
-            InitializeComponent();
-        }
+            => this.InitializeComponent();
 
         public void LoadConfig(SettingCommon settingCommon)
         {
@@ -72,7 +72,7 @@ namespace OpenTween.Setting.Panel
             var dateTimeFormat = settingCommon.DateTimeFormat;
             try
             {
-                if (DateTime.Now.ToString(dateTimeFormat).Length == 0)
+                if (DateTimeUtc.Now.ToLocalTimeString(dateTimeFormat).Length == 0)
                 {
                     // このブロックは絶対に実行されないはず
                     // 変換が成功した場合にLengthが0にならない
@@ -126,7 +126,7 @@ namespace OpenTween.Setting.Panel
         {
             try
             {
-                LabelDateTimeFormatApplied.Text = DateTime.Now.ToString(CmbDateTimeFormat.Text);
+                LabelDateTimeFormatApplied.Text = DateTimeUtc.Now.ToLocalTimeString(CmbDateTimeFormat.Text);
             }
             catch (FormatException)
             {
@@ -137,14 +137,10 @@ namespace OpenTween.Setting.Panel
         }
 
         private void CmbDateTimeFormat_TextUpdate(object sender, EventArgs e)
-        {
-            CreateDateTimeFormatSample();
-        }
+            => this.CreateDateTimeFormatSample();
 
         private void CmbDateTimeFormat_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            CreateDateTimeFormatSample();
-        }
+            => this.CreateDateTimeFormatSample();
 
         private void CmbDateTimeFormat_Validating(object sender, CancelEventArgs e)
         {
@@ -156,8 +152,6 @@ namespace OpenTween.Setting.Panel
         }
 
         private void LabelDateTimeFormatApplied_VisibleChanged(object sender, EventArgs e)
-        {
-            CreateDateTimeFormatSample();
-        }
+            => this.CreateDateTimeFormatSample();
     }
 }