forked from dotnet/project-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenFileWarningDialog.vb
167 lines (150 loc) · 7.08 KB
/
OpenFileWarningDialog.vb
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
' Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information.
Imports System.Drawing
Imports Microsoft.VisualStudio.Editors.DesignerFramework
Namespace Microsoft.VisualStudio.Editors.ResourceEditor
Friend Class OpenFileWarningDialog
Inherits BaseDialog
'Inherits System.Windows.Forms.Form
''' <summary>
''' Constructor.
''' </summary>
''' <param name="ServiceProvider"></param>
Public Sub New(ServiceProvider As IServiceProvider, fileName As String)
MyBase.New(ServiceProvider)
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
alwaysCheckCheckBox.Checked = True
messageLabel.Text = String.Format(messageLabel.Text, fileName)
messageLabel.PerformLayout()
dialogLayoutPanel.PerformLayout()
ClientSize = New Size(ClientSize.Width, dialogLayoutPanel.Size.Height + Padding.Top * 2)
AddHandler dialogLayoutPanel.SizeChanged, AddressOf TableLayoutPanelSizeChanged
F1Keyword = HelpIDs.Dlg_OpenFileWarning
End Sub
Private Sub TableLayoutPanelSizeChanged(sender As Object, e As EventArgs)
ClientSize = New Size(ClientSize.Width, dialogLayoutPanel.Size.Height + Padding.Top * 2)
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(disposing As Boolean)
If disposing AndAlso _components IsNot Nothing Then
RemoveHandler dialogLayoutPanel.SizeChanged, AddressOf TableLayoutPanelSizeChanged
_components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
''' <summary>
''' returns whether we need pop up a warning dialog for this extension again
''' </summary>
Public ReadOnly Property AlwaysCheckForThisExtension As Boolean
Get
Return alwaysCheckCheckBox.Checked
End Get
End Property
''' <summary>
''' Click handler for the OK button
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub ButtonOk_Click(sender As Object, e As EventArgs) Handles buttonOK.Click
Close()
End Sub
Friend WithEvents messageLabel2 As Windows.Forms.Label
''' <summary>
''' Click handler for the Help button
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub DialogQueryName_HelpButtonClicked(sender As Object, e As ComponentModel.CancelEventArgs) Handles MyBase.HelpButtonClicked
e.Cancel = True
ShowHelp()
End Sub
'Required by the Windows Form Designer
Private ReadOnly _components As 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.
<DebuggerStepThrough>
Private Sub InitializeComponent()
Dim resources As ComponentModel.ComponentResourceManager = New ComponentModel.ComponentResourceManager(GetType(OpenFileWarningDialog))
dialogLayoutPanel = New Windows.Forms.TableLayoutPanel
alwaysCheckCheckBox = New Windows.Forms.CheckBox
messageLabel = New Windows.Forms.Label
buttonOK = New Windows.Forms.Button
buttonCancel = New Windows.Forms.Button
messageLabel2 = New Windows.Forms.Label
dialogLayoutPanel.SuspendLayout()
SuspendLayout()
'
'dialogLayoutPanel
'
resources.ApplyResources(dialogLayoutPanel, "dialogLayoutPanel")
dialogLayoutPanel.ColumnStyles.Add(New Windows.Forms.ColumnStyle(Windows.Forms.SizeType.Percent, 100.0!))
dialogLayoutPanel.ColumnStyles.Add(New Windows.Forms.ColumnStyle)
dialogLayoutPanel.Controls.Add(alwaysCheckCheckBox, 0, 2)
dialogLayoutPanel.Controls.Add(messageLabel, 0, 0)
dialogLayoutPanel.Controls.Add(buttonOK, 0, 3)
dialogLayoutPanel.Controls.Add(buttonCancel, 1, 3)
dialogLayoutPanel.Controls.Add(messageLabel2, 0, 1)
dialogLayoutPanel.Name = "dialogLayoutPanel"
dialogLayoutPanel.RowStyles.Add(New Windows.Forms.RowStyle)
dialogLayoutPanel.RowStyles.Add(New Windows.Forms.RowStyle)
dialogLayoutPanel.RowStyles.Add(New Windows.Forms.RowStyle)
dialogLayoutPanel.RowStyles.Add(New Windows.Forms.RowStyle)
'
'alwaysCheckCheckBox
'
resources.ApplyResources(alwaysCheckCheckBox, "alwaysCheckCheckBox")
dialogLayoutPanel.SetColumnSpan(alwaysCheckCheckBox, 2)
alwaysCheckCheckBox.Name = "alwaysCheckCheckBox"
'
'messageLabel
'
resources.ApplyResources(messageLabel, "messageLabel")
dialogLayoutPanel.SetColumnSpan(messageLabel, 2)
messageLabel.Name = "messageLabel"
'
'buttonOK
'
resources.ApplyResources(buttonOK, "buttonOK")
buttonOK.DialogResult = Windows.Forms.DialogResult.OK
buttonOK.Name = "buttonOK"
'
'buttonCancel
'
resources.ApplyResources(buttonCancel, "buttonCancel")
buttonCancel.DialogResult = Windows.Forms.DialogResult.Cancel
buttonCancel.Name = "buttonCancel"
'
'messageLabel2
'
resources.ApplyResources(messageLabel2, "messageLabel2")
dialogLayoutPanel.SetColumnSpan(messageLabel2, 2)
messageLabel2.Name = "messageLabel2"
'
'OpenFileWarningDialog
'
AcceptButton = buttonOK
resources.ApplyResources(Me, "$this")
AutoScaleMode = Windows.Forms.AutoScaleMode.Font
CancelButton = buttonCancel
Controls.Add(dialogLayoutPanel)
FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
HelpButton = True
MaximizeBox = False
MinimizeBox = False
Name = "OpenFileWarningDialog"
ShowIcon = False
SizeGripStyle = Windows.Forms.SizeGripStyle.Hide
dialogLayoutPanel.ResumeLayout(False)
dialogLayoutPanel.PerformLayout()
ResumeLayout(False)
PerformLayout()
End Sub
Friend WithEvents dialogLayoutPanel As Windows.Forms.TableLayoutPanel
Friend WithEvents messageLabel As Windows.Forms.Label
Friend WithEvents alwaysCheckCheckBox As Windows.Forms.CheckBox
Friend WithEvents buttonOK As Windows.Forms.Button
Friend WithEvents buttonCancel As Windows.Forms.Button
End Class
End Namespace