SampleCrossUi.WinForms 1.0.0.0
SampleCrossUi.WinForms 사용 방법을 보여 주는 예제 프로젝트입니다.
로딩중...
검색중...
일치하는것 없음
PopupPage.cs
이 파일의 문서화 페이지로 가기
1using Dreamine.UI.WinForms;
2using Dreamine.UI.WinForms.Controls;
3using Dreamine.UI.WinForms.MessageBox;
4using Dreamine.UI.WinForms.Popup;
5
7
16public sealed class PopupPage : UserControl
17{
26 private Label _title = null!;
35 private Label _resultLabel = null!;
44 private DreamineButton _btnMsgBox = null!;
53 private DreamineButton _btnBlinkOk = null!;
62 private DreamineButton _btnBlinkAlarm = null!;
71 private FlowLayoutPanel _layout = null!;
72
81 public PopupPage()
82 {
84
85 // DreamineMessageBox — WPF DreamineMessageBox(5초 후 자동 OK)와 동일한 동작.
86 _btnMsgBox.Click += (_, _) =>
87 {
88 DreamineMessageBox.ShowAsync(
89 "DreamineMessageBox 데모입니다.\n버튼을 클릭하거나 기다리면 자동으로 닫힙니다.",
90 "MessageBox Demo",
91 MessageBoxButtons.OKCancel,
92 MessageBoxIcon.Information,
93 autoClick: DialogResult.OK,
94 autoClickDelaySeconds: 5,
95 callback: r => _resultLabel.Text = $"Last result: MessageBox → {r}");
96 };
97
98 // DreamineBlinkPopup(완료 알림) — WPF ShowBlinkAsync(UseBlink=false)와 동일한 동작.
99 _btnBlinkOk.Click += async (_, _) =>
100 {
101 var result = await DreamineBlinkPopup.ShowAsync(FindForm(), new BlinkPopupOptions
102 {
103 Title = "작업 완료",
104 Message = "작업이 성공적으로 완료되었습니다.",
105 UseBlink = false,
106 Color1 = Color.FromArgb(13, 27, 62),
107 Color2 = Color.FromArgb(13, 27, 62),
108 ForegroundColor = Color.White,
109 OkText = "확인",
110 IsModal = true
111 });
112 _resultLabel.Text = $"Last result: BlinkPopup(OK) → {result}";
113 };
114
115 // DreamineBlinkPopup(설비 ALARM, 점멸) — WPF ShowBlinkAsync(UseBlink=true)와 동일한 동작.
116 _btnBlinkAlarm.Click += async (_, _) =>
117 {
118 var result = await DreamineBlinkPopup.ShowAsync(FindForm(), new BlinkPopupOptions
119 {
120 Title = "⚠ ALARM",
121 Message = "설비 이상이 감지되었습니다.\n운영자 확인이 필요합니다.",
122 UseBlink = true,
123 BlinkIntervalMs = 400,
124 Color1 = Color.FromArgb(180, 30, 30),
125 Color2 = Color.FromArgb(80, 10, 10),
126 ForegroundColor = Color.Yellow,
127 OkText = "확인",
128 CancelText = "취소",
129 IsModal = true
130 });
131 _resultLabel.Text = $"Last result: BlinkPopup(Alarm) → {result}";
132 };
133 }
134
143 private void InitializeComponent()
144 {
145 _title = new Label();
146 _resultLabel = new Label();
147 _btnMsgBox = new DreamineButton();
148 _btnBlinkOk = new DreamineButton();
149 _btnBlinkAlarm = new DreamineButton();
150 _layout = new FlowLayoutPanel();
151 _layout.SuspendLayout();
152 SuspendLayout();
153 //
154 // _title
155 //
156 _title.AutoSize = true;
157 _title.Font = new Font("Segoe UI", 18F, FontStyle.Bold);
158 _title.ForeColor = Color.White;
159 _title.Location = new Point(0, 0);
160 _title.Margin = new Padding(0, 0, 0, 24);
161 _title.Name = "_title";
162 _title.Size = new Size(163, 32);
163 _title.TabIndex = 0;
164 _title.Text = "Popup Demo";
165 //
166 // _resultLabel
167 //
168 _resultLabel.AutoSize = true;
169 _resultLabel.Font = new Font("Segoe UI", 10F);
170 _resultLabel.ForeColor = Color.FromArgb(136, 153, 170);
171 _resultLabel.Location = new Point(0, 264);
172 _resultLabel.Margin = new Padding(0, 16, 0, 0);
173 _resultLabel.Name = "_resultLabel";
174 _resultLabel.Size = new Size(93, 19);
175 _resultLabel.TabIndex = 4;
176 _resultLabel.Text = "Last result: —";
177 //
178 // _btnMsgBox
179 //
180 _btnMsgBox.BackColor = Color.FromArgb(13, 27, 62);
181 _btnMsgBox.BorderColor = Color.FromArgb(45, 74, 110);
182 _btnMsgBox.Command = null;
183 _btnMsgBox.CommandParameter = null;
184 _btnMsgBox.Content = "DreamineMessageBox (5s auto-close)";
185 _btnMsgBox.CornerRadius = 6;
186 _btnMsgBox.Font = new Font("Segoe UI", 10F);
187 _btnMsgBox.ForeColor = Color.White;
188 _btnMsgBox.IsSelected = false;
189 _btnMsgBox.Location = new Point(0, 56);
190 _btnMsgBox.Margin = new Padding(0, 0, 0, 8);
191 _btnMsgBox.Name = "_btnMsgBox";
192 _btnMsgBox.ShineColor = Color.Empty;
193 _btnMsgBox.Size = new Size(260, 40);
194 _btnMsgBox.TabIndex = 1;
195 //
196 // _btnBlinkOk
197 //
198 _btnBlinkOk.BackColor = Color.FromArgb(13, 27, 62);
199 _btnBlinkOk.BorderColor = Color.FromArgb(45, 74, 110);
200 _btnBlinkOk.Command = null;
201 _btnBlinkOk.CommandParameter = null;
202 _btnBlinkOk.Content = "BlinkPopup — 완료 알림";
203 _btnBlinkOk.CornerRadius = 6;
204 _btnBlinkOk.Font = new Font("Segoe UI", 10F);
205 _btnBlinkOk.ForeColor = Color.White;
206 _btnBlinkOk.IsSelected = false;
207 _btnBlinkOk.Location = new Point(0, 104);
208 _btnBlinkOk.Margin = new Padding(0, 0, 0, 8);
209 _btnBlinkOk.Name = "_btnBlinkOk";
210 _btnBlinkOk.ShineColor = Color.Empty;
211 _btnBlinkOk.Size = new Size(260, 40);
212 _btnBlinkOk.TabIndex = 2;
213 //
214 // _btnBlinkAlarm
215 //
216 _btnBlinkAlarm.BackColor = Color.FromArgb(13, 27, 62);
217 _btnBlinkAlarm.BorderColor = Color.FromArgb(45, 74, 110);
218 _btnBlinkAlarm.Command = null;
219 _btnBlinkAlarm.CommandParameter = null;
220 _btnBlinkAlarm.Content = "BlinkPopup — 설비 ALARM (점멸)";
221 _btnBlinkAlarm.CornerRadius = 6;
222 _btnBlinkAlarm.Font = new Font("Segoe UI", 10F);
223 _btnBlinkAlarm.ForeColor = Color.White;
224 _btnBlinkAlarm.IsSelected = false;
225 _btnBlinkAlarm.Location = new Point(0, 152);
226 _btnBlinkAlarm.Margin = new Padding(0, 0, 0, 8);
227 _btnBlinkAlarm.Name = "_btnBlinkAlarm";
228 _btnBlinkAlarm.ShineColor = Color.Empty;
229 _btnBlinkAlarm.Size = new Size(260, 40);
230 _btnBlinkAlarm.TabIndex = 3;
231 //
232 // _layout
233 //
234 _layout.AutoSize = true;
235 _layout.Controls.Add(_title);
236 _layout.Controls.Add(_btnMsgBox);
237 _layout.Controls.Add(_btnBlinkOk);
238 _layout.Controls.Add(_btnBlinkAlarm);
239 _layout.Controls.Add(_resultLabel);
240 _layout.Dock = DockStyle.Fill;
241 _layout.FlowDirection = FlowDirection.TopDown;
242 _layout.Location = new Point(24, 24);
243 _layout.Name = "_layout";
244 _layout.Size = new Size(1133, 1225);
245 _layout.TabIndex = 0;
246 _layout.WrapContents = false;
247 //
248 // PopupPage
249 //
250 BackColor = Color.FromArgb(26, 26, 46);
251 Controls.Add(_layout);
252 Name = "PopupPage";
253 Padding = new Padding(24);
254 Size = new Size(1181, 1273);
255 _layout.ResumeLayout(false);
256 _layout.PerformLayout();
257 ResumeLayout(false);
258 PerformLayout();
259 }
260}