OSDN Git Service

Win32ApiクラスをNativeMethodsクラスに名前変更 (CA1060)
authorKimura Youichi <kim.upsilon@bucyou.net>
Sat, 12 Jul 2014 14:41:18 +0000 (23:41 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Mon, 21 Jul 2014 06:26:36 +0000 (15:26 +0900)
http://msdn.microsoft.com/ja-jp/library/ms182161.aspx

OpenTween/ApplicationEvents.cs
OpenTween/Connection/Networking.cs
OpenTween/ControlTransaction.cs
OpenTween/DetailsListView.cs
OpenTween/EventViewerDialog.cs
OpenTween/HookGlobalHotkey.cs
OpenTween/NativeMethods.cs [moved from OpenTween/Win32Api.cs with 99% similarity]
OpenTween/OpenTween.csproj
OpenTween/Tween.cs

index bfe89c3..8af9147 100644 (file)
@@ -149,7 +149,7 @@ namespace OpenTween
             {
                 if (form.WindowState == FormWindowState.Minimized)
                 {
-                    Win32Api.RestoreWindow(form);
+                    NativeMethods.RestoreWindow(form);
                 }
                 form.Activate();
             }
index 4cba411..8372fd6 100644 (file)
@@ -107,7 +107,7 @@ namespace OpenTween.Connection
             Networking.proxyType = proxyType;
             Networking.proxy = proxy;
 
-            Win32Api.SetProxy(proxyType, proxyAddress, proxyPort, proxyUser, proxyPassword);
+            NativeMethods.SetProxy(proxyType, proxyAddress, proxyPort, proxyUser, proxyPassword);
 
             OnWebProxyChanged(EventArgs.Empty);
         }
index 98f289b..1bb9112 100644 (file)
@@ -58,8 +58,8 @@ namespace OpenTween
             // Begin/EndUpdate メソッドを持たないコントロールに対しては、
             // WM_SETREDRAW メッセージを直接コントロールに送信する。
             return new Transaction<Control>(control,
-                x => Win32Api.SetRedrawState(x, false),
-                x => { Win32Api.SetRedrawState(x, true); x.Invalidate(true); });
+                x => NativeMethods.SetRedrawState(x, false),
+                x => { NativeMethods.SetRedrawState(x, true); x.Invalidate(true); });
         }
 
         public static IDisposable Layout(Control control)
index 5439b74..2b91f1a 100644 (file)
@@ -107,8 +107,8 @@ namespace OpenTween.OpenTweenCustomControl
         /// </remarks>
         public int SelectionMark
         {
-            get { return Win32Api.ListView_GetSelectionMark(this.Handle); }
-            set { Win32Api.ListView_SetSelectionMark(this.Handle, value); }
+            get { return NativeMethods.ListView_GetSelectionMark(this.Handle); }
+            set { NativeMethods.ListView_SetSelectionMark(this.Handle, value); }
         }
 
         public void ChangeItemBackColor(int index, Color backColor)
@@ -288,7 +288,7 @@ namespace OpenTween.OpenTweenCustomControl
                 case WM_PAINT:
                     if (this.changeBounds != Rectangle.Empty)
                     {
-                        Win32Api.ValidateRect(this.Handle, IntPtr.Zero);
+                        NativeMethods.ValidateRect(this.Handle, IntPtr.Zero);
                         this.Invalidate(this.changeBounds);
                         this.changeBounds = Rectangle.Empty;
                     }
index dbe4539..f5c80fc 100644 (file)
@@ -53,7 +53,7 @@ namespace OpenTween
             InitializeComponent();
 
             // メイリオフォント指定時にタブの最小幅が広くなる問題の対策
-            this.TabEventType.HandleCreated += (s, e) => Win32Api.SetMinTabWidth((TabControl)s, 40);
+            this.TabEventType.HandleCreated += (s, e) => NativeMethods.SetMinTabWidth((TabControl)s, 40);
         }
 
         private void OK_Button_Click(object sender, EventArgs e)
index 685518a..c277266 100644 (file)
@@ -124,7 +124,7 @@ namespace OpenTween
             {
                 if (kvp.Value.KeyEvent.KeyData == key.KeyData && kvp.Value.Value == hotkeyValue) return true; // 登録済みなら正常終了
             }
-            var hotkeyId = Win32Api.RegisterGlobalHotKey(hotkeyValue, (int)modifiers, this._targetForm);
+            var hotkeyId = NativeMethods.RegisterGlobalHotKey(hotkeyValue, (int)modifiers, this._targetForm);
             if (hotkeyId > 0)
             {
                 this._hotkeyID.Add(hotkeyId, new KeyEventValue(key, hotkeyValue));
@@ -137,7 +137,7 @@ namespace OpenTween
         {
             foreach (ushort hotkeyId in this._hotkeyID.Keys)
             {
-                Win32Api.UnregisterGlobalHotKey(hotkeyId, this._targetForm);
+                NativeMethods.UnregisterGlobalHotKey(hotkeyId, this._targetForm);
             }
             this._hotkeyID.Clear();
         }
similarity index 99%
rename from OpenTween/Win32Api.cs
rename to OpenTween/NativeMethods.cs
index 4cbe35e..57f4c9b 100644 (file)
@@ -35,7 +35,7 @@ using OpenTween.Connection;
 
 namespace OpenTween
 {
-    public static class Win32Api
+    internal static class NativeMethods
     {
         // 指定されたウィンドウへ、指定されたメッセージを送信します
         [DllImport("user32.dll")]
index f49f76f..12927b3 100644 (file)
     <Compile Include="MediaSelector.Designer.cs">
       <DependentUpon>MediaSelector.cs</DependentUpon>
     </Compile>
+    <Compile Include="NativeMethods.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="OTBaseForm.cs">
       <SubType>Form</SubType>
     </Compile>
     <Compile Include="UserInfo.cs" />
     <Compile Include="WebApiException.cs" />
     <Compile Include="WebBrowserController.cs" />
-    <Compile Include="Win32Api.cs" />
     <Compile Include="ControlTransaction.cs" />
   </ItemGroup>
   <ItemGroup>
index cd8d55d..56b20f2 100644 (file)
@@ -1701,7 +1701,7 @@ namespace OpenTween
                     !SettingDialog.LimitBalloon
                     )
                 ) &&
-                !Win32Api.IsScreenSaverRunning())
+                !NativeMethods.IsScreenSaverRunning())
             {
                 return true;
             }
@@ -1918,7 +1918,7 @@ namespace OpenTween
             //mentions新着時に画面ブリンク
             if (!_initial && SettingDialog.BlinkNewMentions && newMentions && Form.ActiveForm == null)
             {
-                Win32Api.FlashMyWindow(this.Handle, Win32Api.FlashSpecification.FlashTray, 3);
+                NativeMethods.FlashMyWindow(this.Handle, NativeMethods.FlashSpecification.FlashTray, 3);
             }
         }
 
@@ -12297,7 +12297,7 @@ namespace OpenTween
             this.gh.NotifyClicked += GrowlHelper_Callback;
 
             // メイリオフォント指定時にタブの最小幅が広くなる問題の対策
-            this.ListTab.HandleCreated += (s, e) => Win32Api.SetMinTabWidth((TabControl)s, 40);
+            this.ListTab.HandleCreated += (s, e) => NativeMethods.SetMinTabWidth((TabControl)s, 40);
 
             this._apiGauge = new ToolStripAPIGauge();
             this._apiGauge.BorderSides = ToolStripStatusLabelBorderSides.Right;