OSDN Git Service

ListFormGroupをMainFormから出す
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Sun, 3 May 2020 10:47:10 +0000 (19:47 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Sun, 30 Aug 2020 05:58:22 +0000 (14:58 +0900)
KancolleSniffer/KancolleSniffer.csproj
KancolleSniffer/ListFormGroup.cs [new file with mode: 0644]
KancolleSniffer/MainForm.ListFormGroup.cs [deleted file]

index 843117b..8710a7a 100644 (file)
@@ -61,9 +61,7 @@
   <ItemGroup>\r
     <Compile Include="Log\BattleLogger.cs" />\r
     <Compile Include="Main.cs" />\r
-    <Compile Include="MainForm.ListFormGroup.cs">\r
-      <SubType>Form</SubType>\r
-    </Compile>\r
+    <Compile Include="ListFormGroup.cs" />\r
     <Compile Include="Model\AirBattleResult.cs" />\r
     <Compile Include="Model\AirCorpsFighterPower.cs" />\r
     <Compile Include="Model\QuestCounter.cs" />\r
diff --git a/KancolleSniffer/ListFormGroup.cs b/KancolleSniffer/ListFormGroup.cs
new file mode 100644 (file)
index 0000000..0d7a619
--- /dev/null
@@ -0,0 +1,114 @@
+// Copyright (C) 2020 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//    http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+\r
+using System;\r
+using System.Collections.Generic;\r
+using System.Drawing;\r
+using System.Linq;\r
+using System.Windows.Forms;\r
+\r
+namespace KancolleSniffer\r
+{\r
+    public class ListFormGroup\r
+    {\r
+        private readonly MainForm _mainForm;\r
+        private readonly List<ListForm> _listForms = new List<ListForm>();\r
+\r
+        public ListForm Main => _listForms[0];\r
+\r
+        public ListFormGroup(MainForm mainForm)\r
+        {\r
+            _mainForm = mainForm;\r
+            _listForms.Add(new ListForm(mainForm) {IsMaster = true});\r
+            for (var i = 0; i < mainForm.Config.ListFormGroup.Count; i++)\r
+                _listForms.Add(new ListForm(mainForm) {Owner = Main});\r
+        }\r
+\r
+        public void ShowOrCreate()\r
+        {\r
+            foreach (var listForm in _listForms)\r
+            {\r
+                if (listForm.WindowState == FormWindowState.Minimized)\r
+                {\r
+                    listForm.WindowState = FormWindowState.Normal;\r
+                    return;\r
+                }\r
+                if (!listForm.Visible)\r
+                {\r
+                    listForm.Show();\r
+                    return;\r
+                }\r
+            }\r
+            var newForm = new ListForm(_mainForm) {Owner = Main, TopMost = Main.TopMost, Font = Main.Font};\r
+            newForm.Show();\r
+            newForm.UpdateList();\r
+            _listForms.Add(newForm);\r
+        }\r
+\r
+        public void UpdateList()\r
+        {\r
+            InvokeAll(listForm => listForm.UpdateList());\r
+        }\r
+\r
+        public void UpdateAirBattleResult()\r
+        {\r
+            InvokeAll(listForm => listForm.UpdateAirBattleResult());\r
+        }\r
+\r
+        public void UpdateBattleResult()\r
+        {\r
+            InvokeAll(listForm => listForm.UpdateBattleResult());\r
+        }\r
+\r
+        public void UpdateCellInfo()\r
+        {\r
+            InvokeAll(listForm => listForm.UpdateCellInfo());\r
+        }\r
+\r
+        public bool Visible => _listForms.Any(listForm => listForm.Visible);\r
+\r
+        public bool TopMost\r
+        {\r
+            set { InvokeAll(listFrom => { listFrom.TopMost = value; }); }\r
+        }\r
+\r
+        public Font Font\r
+        {\r
+            get => _listForms[0].Font;\r
+            set { InvokeAll(listForm => { listForm.Font = value; }); }\r
+        }\r
+\r
+        public void ShowShip(int id)\r
+        {\r
+            InvokeAll(listForm => listForm.ShowShip(id));\r
+        }\r
+\r
+        public void Show()\r
+        {\r
+            InvokeAll(listForm => listForm.Show());\r
+        }\r
+\r
+        public void Close()\r
+        {\r
+            InvokeAll(listForm => listForm.SaveConfig());\r
+            InvokeAll(listForm => listForm.Close());\r
+        }\r
+\r
+        private void InvokeAll(Action<ListForm> action)\r
+        {\r
+            foreach (var listForm in _listForms)\r
+                action(listForm);\r
+        }\r
+    }\r
+}
\ No newline at end of file
diff --git a/KancolleSniffer/MainForm.ListFormGroup.cs b/KancolleSniffer/MainForm.ListFormGroup.cs
deleted file mode 100644 (file)
index 4585f1e..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (C) 2020 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
-// \r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//    http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-\r
-using System;\r
-using System.Collections.Generic;\r
-using System.Drawing;\r
-using System.Linq;\r
-using System.Windows.Forms;\r
-\r
-namespace KancolleSniffer\r
-{\r
-    public partial class MainForm\r
-    {\r
-        private class ListFormGroup\r
-        {\r
-            private readonly MainForm _mainForm;\r
-            private readonly List<ListForm> _listForms = new List<ListForm>();\r
-\r
-            public ListForm Main => _listForms[0];\r
-\r
-            public ListFormGroup(MainForm mainForm)\r
-            {\r
-                _mainForm = mainForm;\r
-                _listForms.Add(new ListForm(mainForm) {IsMaster = true});\r
-                for (var i = 0; i < mainForm.Config.ListFormGroup.Count; i++)\r
-                    _listForms.Add(new ListForm(mainForm) {Owner = Main});\r
-            }\r
-\r
-            public void ShowOrCreate()\r
-            {\r
-                foreach (var listForm in _listForms)\r
-                {\r
-                    if (listForm.WindowState == FormWindowState.Minimized)\r
-                    {\r
-                        listForm.WindowState = FormWindowState.Normal;\r
-                        return;\r
-                    }\r
-                    if (!listForm.Visible)\r
-                    {\r
-                        listForm.Show();\r
-                        return;\r
-                    }\r
-                }\r
-                var newForm = new ListForm(_mainForm) {Owner = Main, TopMost = Main.TopMost, Font = Main.Font};\r
-                newForm.Show();\r
-                newForm.UpdateList();\r
-                _listForms.Add(newForm);\r
-            }\r
-\r
-            public void UpdateList()\r
-            {\r
-                InvokeAll(listForm => listForm.UpdateList());\r
-            }\r
-\r
-            public void UpdateAirBattleResult()\r
-            {\r
-                InvokeAll(listForm => listForm.UpdateAirBattleResult());\r
-            }\r
-\r
-            public void UpdateBattleResult()\r
-            {\r
-                InvokeAll(listForm => listForm.UpdateBattleResult());\r
-            }\r
-\r
-            public void UpdateCellInfo()\r
-            {\r
-                InvokeAll(listForm => listForm.UpdateCellInfo());\r
-            }\r
-\r
-            public bool Visible => _listForms.Any(listForm => listForm.Visible);\r
-\r
-            public bool TopMost\r
-            {\r
-                set { InvokeAll(listFrom => { listFrom.TopMost = value; }); }\r
-            }\r
-\r
-            public Font Font\r
-            {\r
-                get => _listForms[0].Font;\r
-                set { InvokeAll(listForm => { listForm.Font = value; }); }\r
-            }\r
-\r
-            public void ShowShip(int id)\r
-            {\r
-                InvokeAll(listForm => listForm.ShowShip(id));\r
-            }\r
-\r
-            public void Show()\r
-            {\r
-                InvokeAll(listForm => listForm.Show());\r
-            }\r
-\r
-            public void Close()\r
-            {\r
-                InvokeAll(listForm => listForm.SaveConfig());\r
-                InvokeAll(listForm => listForm.Close());\r
-            }\r
-\r
-            private void InvokeAll(Action<ListForm> action)\r
-            {\r
-                foreach (var listForm in _listForms)\r
-                    action(listForm);\r
-            }\r
-        }\r
-    }\r
-}
\ No newline at end of file