From: Kimura Youichi Date: Sat, 12 Jul 2014 14:41:18 +0000 (+0900) Subject: Win32ApiクラスをNativeMethodsクラスに名前変更 (CA1060) X-Git-Tag: OpenTween_v1.2.3~15^2~12 X-Git-Url: http://git.osdn.net/view?p=opentween%2Fopen-tween.git;a=commitdiff_plain;h=2112e58ab8064b289443f21f89d0b4bda4413c45 Win32ApiクラスをNativeMethodsクラスに名前変更 (CA1060) http://msdn.microsoft.com/ja-jp/library/ms182161.aspx --- diff --git a/OpenTween/ApplicationEvents.cs b/OpenTween/ApplicationEvents.cs index bfe89c3f..8af91477 100644 --- a/OpenTween/ApplicationEvents.cs +++ b/OpenTween/ApplicationEvents.cs @@ -149,7 +149,7 @@ namespace OpenTween { if (form.WindowState == FormWindowState.Minimized) { - Win32Api.RestoreWindow(form); + NativeMethods.RestoreWindow(form); } form.Activate(); } diff --git a/OpenTween/Connection/Networking.cs b/OpenTween/Connection/Networking.cs index 4cba411c..8372fd65 100644 --- a/OpenTween/Connection/Networking.cs +++ b/OpenTween/Connection/Networking.cs @@ -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); } diff --git a/OpenTween/ControlTransaction.cs b/OpenTween/ControlTransaction.cs index 98f289b5..1bb91124 100644 --- a/OpenTween/ControlTransaction.cs +++ b/OpenTween/ControlTransaction.cs @@ -58,8 +58,8 @@ namespace OpenTween // Begin/EndUpdate メソッドを持たないコントロールに対しては、 // WM_SETREDRAW メッセージを直接コントロールに送信する。 return new Transaction(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) diff --git a/OpenTween/DetailsListView.cs b/OpenTween/DetailsListView.cs index 5439b749..2b91f1a9 100644 --- a/OpenTween/DetailsListView.cs +++ b/OpenTween/DetailsListView.cs @@ -107,8 +107,8 @@ namespace OpenTween.OpenTweenCustomControl /// 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; } diff --git a/OpenTween/EventViewerDialog.cs b/OpenTween/EventViewerDialog.cs index dbe45398..f5c80fcf 100644 --- a/OpenTween/EventViewerDialog.cs +++ b/OpenTween/EventViewerDialog.cs @@ -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) diff --git a/OpenTween/HookGlobalHotkey.cs b/OpenTween/HookGlobalHotkey.cs index 685518aa..c277266f 100644 --- a/OpenTween/HookGlobalHotkey.cs +++ b/OpenTween/HookGlobalHotkey.cs @@ -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(); } diff --git a/OpenTween/Win32Api.cs b/OpenTween/NativeMethods.cs similarity index 99% rename from OpenTween/Win32Api.cs rename to OpenTween/NativeMethods.cs index 4cbe35ed..57f4c9ba 100644 --- a/OpenTween/Win32Api.cs +++ b/OpenTween/NativeMethods.cs @@ -35,7 +35,7 @@ using OpenTween.Connection; namespace OpenTween { - public static class Win32Api + internal static class NativeMethods { // 指定されたウィンドウへ、指定されたメッセージを送信します [DllImport("user32.dll")] diff --git a/OpenTween/OpenTween.csproj b/OpenTween/OpenTween.csproj index f49f76f9..12927b37 100644 --- a/OpenTween/OpenTween.csproj +++ b/OpenTween/OpenTween.csproj @@ -141,6 +141,9 @@ MediaSelector.cs + + Code + Form @@ -391,7 +394,6 @@ - diff --git a/OpenTween/Tween.cs b/OpenTween/Tween.cs index cd8d55d0..56b20f2b 100644 --- a/OpenTween/Tween.cs +++ b/OpenTween/Tween.cs @@ -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;