svnno****@sourc*****
svnno****@sourc*****
2011年 1月 27日 (木) 02:40:55 JST
Revision: 1413 http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1413 Author: syo68k Date: 2011-01-27 02:40:55 +0900 (Thu, 27 Jan 2011) Log Message: ----------- イベントビューアで自分が発生させたイベントを除外して表示できるようにした Modified Paths: -------------- trunk/Tween/EventViewerDialog.Designer.vb trunk/Tween/EventViewerDialog.vb trunk/Tween/Twitter.vb -------------- next part -------------- Modified: trunk/Tween/EventViewerDialog.Designer.vb =================================================================== --- trunk/Tween/EventViewerDialog.Designer.vb 2011-01-26 16:30:04 UTC (rev 1412) +++ trunk/Tween/EventViewerDialog.Designer.vb 2011-01-26 17:40:55 UTC (rev 1413) @@ -28,6 +28,7 @@ Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) Me.ColumnHeader4 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.CheckExcludeMyEvent = New System.Windows.Forms.CheckBox() Me.SuspendLayout() ' 'OK_Button @@ -74,12 +75,23 @@ Me.ColumnHeader4.Text = "Target" Me.ColumnHeader4.Width = 360 ' + 'CheckExcludeMyEvent + ' + Me.CheckExcludeMyEvent.AutoSize = True + Me.CheckExcludeMyEvent.Location = New System.Drawing.Point(12, 261) + Me.CheckExcludeMyEvent.Name = "CheckExcludeMyEvent" + Me.CheckExcludeMyEvent.Size = New System.Drawing.Size(178, 16) + Me.CheckExcludeMyEvent.TabIndex = 2 + Me.CheckExcludeMyEvent.Text = "自分で発生させたイベントを除外" + Me.CheckExcludeMyEvent.UseVisualStyleBackColor = True + ' 'EventViewerDialog ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.OK_Button Me.ClientSize = New System.Drawing.Size(691, 291) + Me.Controls.Add(Me.CheckExcludeMyEvent) Me.Controls.Add(Me.OK_Button) Me.Controls.Add(Me.EventList) Me.DoubleBuffered = True @@ -91,6 +103,7 @@ Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "Events" Me.ResumeLayout(False) + Me.PerformLayout() End Sub Friend WithEvents OK_Button As System.Windows.Forms.Button @@ -99,5 +112,6 @@ Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader Friend WithEvents ColumnHeader4 As System.Windows.Forms.ColumnHeader + Friend WithEvents CheckExcludeMyEvent As System.Windows.Forms.CheckBox End Class Modified: trunk/Tween/EventViewerDialog.vb =================================================================== --- trunk/Tween/EventViewerDialog.vb 2011-01-26 16:30:04 UTC (rev 1412) +++ trunk/Tween/EventViewerDialog.vb 2011-01-26 17:40:55 UTC (rev 1413) @@ -24,6 +24,7 @@ ' Boston, MA 02110-1301, USA. Imports System.Windows.Forms +Imports System.Linq Public Class EventViewerDialog Public Property EventSource As List(Of Twitter.FormattedEvent) @@ -38,15 +39,19 @@ Me.Close() End Sub + Private Function CreateListViewItemArray(ByVal source As Generic.List(Of Twitter.FormattedEvent)) As ListViewItem() + Dim items As New Generic.List(Of ListViewItem) + For Each x As Twitter.FormattedEvent In source + Dim s() As String = {x.CreatedAt.ToString, x.Event.ToUpper, x.Username, x.Target} + items.Add(New ListViewItem(s)) + Next + Return items.ToArray() + End Function + Private Sub EventViewerDialog_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown If EventSource IsNot Nothing AndAlso EventSource.Count > 0 Then - Dim items As New Generic.List(Of ListViewItem) - For Each x As Twitter.FormattedEvent In EventSource - Dim s() As String = {x.CreatedAt.ToString, x.Event.ToUpper, x.Username, x.Target} - items.Add(New ListViewItem(s)) - Next EventList.BeginUpdate() - EventList.Items.AddRange(items.ToArray()) + EventList.Items.AddRange(CreateListViewItemArray(EventSource)) Me.EventList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent) EventList.EndUpdate() End If @@ -61,4 +66,15 @@ End If End If End Sub + + Private Sub CheckExcludeMyEvent_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckExcludeMyEvent.CheckedChanged + EventList.BeginUpdate() + EventList.Items.Clear() + If EventSource IsNot Nothing AndAlso EventSource.Count > 0 Then + EventList.Items.AddRange( + CreateListViewItemArray((From x As Twitter.FormattedEvent In EventSource + Where If(CheckExcludeMyEvent.Checked, Not x.IsMe, True) Select x).ToList())) + End If + EventList.EndUpdate() + End Sub End Class Modified: trunk/Tween/Twitter.vb =================================================================== --- trunk/Tween/Twitter.vb 2011-01-26 16:30:04 UTC (rev 1412) +++ trunk/Tween/Twitter.vb 2011-01-26 17:40:55 UTC (rev 1413) @@ -2740,6 +2740,7 @@ Public Property Username As String Public Property Target As String Public Property Id As Int64 + Public Property IsMe As Boolean End Class Public Property StoredEvent As New List(Of FormattedEvent) @@ -2904,6 +2905,7 @@ evt.CreatedAt = DateTimeParse(eventData.CreatedAt) evt.Event = eventData.Event evt.Username = eventData.Source.ScreenName + evt.IsMe = evt.Username.ToLower().Equals(Me.Username.ToLower()) evt.Eventtype = EventNameToEventType(evt.Event) Select Case eventData.Event Case "follow"