File: FileSystemOperationUIQuestion.vb

package info (click to toggle)
mono-basic 2.6.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 18,852 kB
  • ctags: 809
  • sloc: cs: 8,852; makefile: 516; sh: 307
file content (287 lines) | stat: -rw-r--r-- 11,934 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
'
' FileSystemOperationUIQuestion.vb
'
' Authors:
'   Rolf Bjarne Kvinge (RKvinge@novell.com>
'
' Copyright (C) 2007 Novell (http://www.novell.com)
'
' Permission is hereby granted, free of charge, to any person obtaining
' a copy of this software and associated documentation files (the
' "Software"), to deal in the Software without restriction, including
' without limitation the rights to use, copy, modify, merge, publish,
' distribute, sublicense, and/or sell copies of the Software, and to
' permit persons to whom the Software is furnished to do so, subject to
' the following conditions:
' 
' The above copyright notice and this permission notice shall be
' included in all copies or substantial portions of the Software.
' 
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
' EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
' MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
' NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
' LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
' OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
' WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'

#If NET_VER >= 2.0 Then
#If TARGET_JVM = False Then 'Windows.Forms Not Supported by Grasshopper
Imports System.IO
Imports System.Text
Imports System.Collections.ObjectModel

Namespace Microsoft.VisualBasic.FileIO
    Friend Class FileSystemOperationUIQuestion
        Inherits System.Windows.Forms.Form

        Private m_Answer As Answer

        Sub New()
            InitializeComponent()
        End Sub

        Shadows Function ShowDialog() As Answer
            MyBase.ShowDialog()
            Return m_Answer
        End Function

        Public Enum Answer
            Yes
            YesToAll
            No
            NoToAll
            Cancel
        End Enum

        Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
            m_Answer = Answer.Cancel
            Close()
        End Sub

        Private Sub cmdNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNo.Click
            If System.Windows.Forms.Control.ModifierKeys = Windows.Forms.Keys.Shift Then
                m_Answer = Answer.NoToAll
            Else
                m_Answer = Answer.No
            End If
            Close()
        End Sub

        Private Sub cmdYesToAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdYesToAll.Click
            m_Answer = Answer.YesToAll
            Close()
        End Sub

        Private Sub cmdYes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdYes.Click
            m_Answer = Answer.Yes
            Close()
        End Sub


#Region "Designer code"
        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
            MyBase.Dispose(disposing)
        End Sub

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.lblTitle = New System.Windows.Forms.Label
            Me.lblText1 = New System.Windows.Forms.Label
            Me.lblText2 = New System.Windows.Forms.Label
            Me.lblDateA = New System.Windows.Forms.Label
            Me.lblSizeA = New System.Windows.Forms.Label
            Me.lblDateB = New System.Windows.Forms.Label
            Me.lblSizeB = New System.Windows.Forms.Label
            Me.cmdYes = New System.Windows.Forms.Button
            Me.cmdYesToAll = New System.Windows.Forms.Button
            Me.cmdNo = New System.Windows.Forms.Button
            Me.cmdCancel = New System.Windows.Forms.Button
            Me.iconA = New System.Windows.Forms.PictureBox
            Me.iconB = New System.Windows.Forms.PictureBox
            CType(Me.iconA, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.iconB, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'lblTitle
            '
            Me.lblTitle.AutoSize = True
            Me.lblTitle.Location = New System.Drawing.Point(29, 9)
            Me.lblTitle.Name = "lblTitle"
            Me.lblTitle.Size = New System.Drawing.Size(193, 13)
            Me.lblTitle.TabIndex = 0
            Me.lblTitle.Text = "This folder already has a file called '{0}'."
            '
            'lblText1
            '
            Me.lblText1.AutoSize = True
            Me.lblText1.Location = New System.Drawing.Point(29, 46)
            Me.lblText1.Name = "lblText1"
            Me.lblText1.Size = New System.Drawing.Size(189, 13)
            Me.lblText1.TabIndex = 1
            Me.lblText1.Text = "Do you want to replace the existing file"
            '
            'lblText2
            '
            Me.lblText2.AutoSize = True
            Me.lblText2.Location = New System.Drawing.Point(29, 110)
            Me.lblText2.Name = "lblText2"
            Me.lblText2.Size = New System.Drawing.Size(94, 13)
            Me.lblText2.TabIndex = 2
            Me.lblText2.Text = "with this other file?"
            '
            'lblDateA
            '
            Me.lblDateA.AutoSize = True
            Me.lblDateA.Location = New System.Drawing.Point(89, 90)
            Me.lblDateA.Name = "lblDateA"
            Me.lblDateA.Size = New System.Drawing.Size(78, 13)
            Me.lblDateA.TabIndex = 3
            Me.lblDateA.Text = "modificado: {0}"
            '
            'lblSizeA
            '
            Me.lblSizeA.AutoSize = True
            Me.lblSizeA.Location = New System.Drawing.Point(89, 71)
            Me.lblSizeA.Name = "lblSizeA"
            Me.lblSizeA.Size = New System.Drawing.Size(34, 13)
            Me.lblSizeA.TabIndex = 4
            Me.lblSizeA.Text = "size a"
            '
            'lblDateB
            '
            Me.lblDateB.AutoSize = True
            Me.lblDateB.Location = New System.Drawing.Point(89, 156)
            Me.lblDateB.Name = "lblDateB"
            Me.lblDateB.Size = New System.Drawing.Size(78, 13)
            Me.lblDateB.TabIndex = 3
            Me.lblDateB.Text = "modificado: {0}"
            '
            'lblSizeB
            '
            Me.lblSizeB.AutoSize = True
            Me.lblSizeB.Location = New System.Drawing.Point(89, 137)
            Me.lblSizeB.Name = "lblSizeB"
            Me.lblSizeB.Size = New System.Drawing.Size(34, 13)
            Me.lblSizeB.TabIndex = 4
            Me.lblSizeB.Text = "size b"
            '
            'cmdYes
            '
            Me.cmdYes.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.cmdYes.Location = New System.Drawing.Point(30, 186)
            Me.cmdYes.Name = "cmdYes"
            Me.cmdYes.Size = New System.Drawing.Size(75, 23)
            Me.cmdYes.TabIndex = 5
            Me.cmdYes.Text = "&Yes"
            Me.cmdYes.UseVisualStyleBackColor = True
            '
            'cmdYesToAll
            '
            Me.cmdYesToAll.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.cmdYesToAll.Location = New System.Drawing.Point(111, 186)
            Me.cmdYesToAll.Name = "cmdYesToAll"
            Me.cmdYesToAll.Size = New System.Drawing.Size(75, 23)
            Me.cmdYesToAll.TabIndex = 6
            Me.cmdYesToAll.Text = "Yes to &all"
            Me.cmdYesToAll.UseVisualStyleBackColor = True
            '
            'cmdNo
            '
            Me.cmdNo.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.cmdNo.Location = New System.Drawing.Point(192, 186)
            Me.cmdNo.Name = "cmdNo"
            Me.cmdNo.Size = New System.Drawing.Size(75, 23)
            Me.cmdNo.TabIndex = 7
            Me.cmdNo.Text = "&No"
            Me.cmdNo.UseVisualStyleBackColor = True
            '
            'cmdCancel
            '
            Me.cmdCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.cmdCancel.Location = New System.Drawing.Point(273, 186)
            Me.cmdCancel.Name = "cmdCancel"
            Me.cmdCancel.Size = New System.Drawing.Size(75, 23)
            Me.cmdCancel.TabIndex = 8
            Me.cmdCancel.Text = "&Cancel"
            Me.cmdCancel.UseVisualStyleBackColor = True
            '
            'iconA
            '
            Me.iconA.Location = New System.Drawing.Point(45, 71)
            Me.iconA.Name = "iconA"
            Me.iconA.Size = New System.Drawing.Size(32, 32)
            Me.iconA.TabIndex = 9
            Me.iconA.TabStop = False
            '
            'iconB
            '
            Me.iconB.Location = New System.Drawing.Point(45, 137)
            Me.iconB.Name = "iconB"
            Me.iconB.Size = New System.Drawing.Size(32, 32)
            Me.iconB.TabIndex = 9
            Me.iconB.TabStop = False
            '
            'FileSystemOperationUIQuestion
            '
            Me.AcceptButton = Me.cmdYes
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.CancelButton = Me.cmdCancel
            Me.ClientSize = New System.Drawing.Size(360, 221)
            Me.Controls.Add(Me.iconB)
            Me.Controls.Add(Me.iconA)
            Me.Controls.Add(Me.cmdCancel)
            Me.Controls.Add(Me.cmdNo)
            Me.Controls.Add(Me.cmdYesToAll)
            Me.Controls.Add(Me.cmdYes)
            Me.Controls.Add(Me.lblSizeB)
            Me.Controls.Add(Me.lblDateB)
            Me.Controls.Add(Me.lblSizeA)
            Me.Controls.Add(Me.lblDateA)
            Me.Controls.Add(Me.lblText2)
            Me.Controls.Add(Me.lblText1)
            Me.Controls.Add(Me.lblTitle)
            Me.MaximizeBox = False
            Me.MinimizeBox = False
            Me.Name = "FileSystemOperationUIQuestion"
            Me.ShowIcon = False
            Me.ShowInTaskbar = False
            Me.Text = "Confirm file overwrite"
            CType(Me.iconA, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.iconB, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)
            Me.PerformLayout()

        End Sub
        Friend WithEvents lblTitle As System.Windows.Forms.Label
        Friend WithEvents lblText1 As System.Windows.Forms.Label
        Friend WithEvents lblText2 As System.Windows.Forms.Label
        Friend WithEvents lblDateA As System.Windows.Forms.Label
        Friend WithEvents lblSizeA As System.Windows.Forms.Label
        Friend WithEvents lblDateB As System.Windows.Forms.Label
        Friend WithEvents lblSizeB As System.Windows.Forms.Label
        Friend WithEvents cmdYes As System.Windows.Forms.Button
        Friend WithEvents cmdYesToAll As System.Windows.Forms.Button
        Friend WithEvents cmdNo As System.Windows.Forms.Button
        Friend WithEvents cmdCancel As System.Windows.Forms.Button
        Friend WithEvents iconA As System.Windows.Forms.PictureBox
        Friend WithEvents iconB As System.Windows.Forms.PictureBox
#End Region

    End Class
End Namespace
#End If
#End If