• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

OpenTweenのfork


Commit MetaInfo

修訂bc8650a5af6dd47a22007777a4e934b28c1ea600 (tree)
時間2012-02-22 19:47:44
作者Kimura Youichi <kim.upsilon@bucy...>
CommiterKimura Youichi

Log Message

Port AdsBrowser.vb to C#

Change Summary

差異

--- a/Tween/AdsBrowser.vb
+++ /dev/null
@@ -1,48 +0,0 @@
1-Imports System.Windows.Forms
2-Imports System.IO
3-
4-Namespace TweenCustomControl
5- Public Class AdsBrowser
6- Inherits WebBrowser
7-
8- Private adsPath As String
9- Private WithEvents refreshTimer As System.Timers.Timer
10-
11- Public Sub New()
12- MyBase.New()
13-
14- adsPath = Path.Combine(Path.GetTempPath, Path.GetRandomFileName)
15- File.WriteAllText(adsPath, My.Resources.ads)
16-
17- Me.Size = New Size(728 + 5, 90)
18- Me.ScrollBarsEnabled = False
19- Me.AllowWebBrowserDrop = False
20- Me.IsWebBrowserContextMenuEnabled = False
21- Me.ScriptErrorsSuppressed = True
22- Me.TabStop = False
23- Me.WebBrowserShortcutsEnabled = False
24- Me.Dock = DockStyle.Fill
25- Me.Visible = False
26- Me.Navigate(adsPath)
27- Me.Visible = True
28-
29- Me.refreshTimer = New System.Timers.Timer(45 * 1000)
30- Me.refreshTimer.AutoReset = True
31- Me.refreshTimer.SynchronizingObject = Me
32- Me.refreshTimer.Enabled = True
33- End Sub
34-
35-
36- Private Sub AdsBrowser_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
37- Me.refreshTimer.Dispose()
38- File.Delete(adsPath)
39- End Sub
40-
41- Private Sub refreshTimer_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles refreshTimer.Elapsed
42- Me.Visible = False
43- Me.Refresh()
44- Me.Visible = True
45- End Sub
46-
47- End Class
48-End Namespace
\ No newline at end of file
--- a/Tween/Tween.vbproj
+++ b/Tween/Tween.vbproj
@@ -115,9 +115,6 @@
115115 <Import Include="System.Windows.Forms" />
116116 </ItemGroup>
117117 <ItemGroup>
118- <Compile Include="AdsBrowser.vb">
119- <SubType>Component</SubType>
120- </Compile>
121118 <Compile Include="AppendSettingDialog.Designer.vb">
122119 <DependentUpon>AppendSettingDialog.vb</DependentUpon>
123120 </Compile>
--- /dev/null
+++ b/TweenCS/AdsBrowser.cs
@@ -0,0 +1,82 @@
1+// Tween - Client of Twitter
2+// Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3+// (c) 2008-2011 Moz (@syo68k)
4+// (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5+// (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6+// (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7+// (c) 2011 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
8+// All rights reserved.
9+//
10+// This file is part of Tween.
11+//
12+// This program is free software; you can redistribute it and/or modify it
13+// under the terms of the GNU General Public License as published by the Free
14+// Software Foundation; either version 3 of the License, or (at your option)
15+// any later version.
16+//
17+// This program is distributed in the hope that it will be useful, but
18+// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20+// for more details.
21+//
22+// You should have received a copy of the GNU General Public License along
23+// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
24+// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
25+// Boston, MA 02110-1301, USA.
26+
27+using System;
28+using System.Collections.Generic;
29+using System.Linq;
30+using System.Text;
31+using System.Windows.Forms;
32+using System.IO;
33+using System.Drawing;
34+using System.Timers;
35+
36+namespace Tween.TweenCustomControl
37+{
38+ public class AdsBrowser : WebBrowser
39+ {
40+ private string adsPath;
41+ private System.Timers.Timer refreshTimer;
42+
43+ public AdsBrowser() : base()
44+ {
45+ adsPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
46+ File.WriteAllText(adsPath, Properties.Resources.ads);
47+
48+ this.Size = new Size(728 + 5, 90);
49+ this.ScrollBarsEnabled = false;
50+ this.AllowWebBrowserDrop = false;
51+ this.IsWebBrowserContextMenuEnabled = false;
52+ this.ScriptErrorsSuppressed = true;
53+ this.TabStop = false;
54+ this.WebBrowserShortcutsEnabled = false;
55+ this.Dock = DockStyle.Fill;
56+ this.Visible = false;
57+ this.Navigate(adsPath);
58+ this.Visible = true;
59+
60+ this.refreshTimer = new System.Timers.Timer(45 * 1000);
61+ this.refreshTimer.AutoReset = true;
62+ this.refreshTimer.SynchronizingObject = this;
63+ this.refreshTimer.Enabled = true;
64+
65+ this.Disposed += this.AdsBrowser_Disposed;
66+ this.refreshTimer.Elapsed += this.refreshTimer_Elapsed;
67+ }
68+
69+ private void AdsBrowser_Disposed(object sender, EventArgs e)
70+ {
71+ this.refreshTimer.Dispose();
72+ File.Delete(adsPath);
73+ }
74+
75+ private void refreshTimer_Elapsed(object sender, ElapsedEventArgs e)
76+ {
77+ this.Visible = false;
78+ this.Refresh();
79+ this.Visible = true;
80+ }
81+ }
82+}
--- a/TweenCS/TweenCS.csproj
+++ b/TweenCS/TweenCS.csproj
@@ -45,6 +45,9 @@
4545 <Reference Include="System.Xml" />
4646 </ItemGroup>
4747 <ItemGroup>
48+ <Compile Include="AdsBrowser.cs">
49+ <SubType>Component</SubType>
50+ </Compile>
4851 <Compile Include="ApiInformation.cs" />
4952 <Compile Include="Connection\IHttpConnection.cs" />
5053 <Compile Include="Connection\IMultimediaShareService.cs" />