├── .editorconfig
├── .github
├── dependabot.yml
└── workflows
│ └── dotnet.yml
├── .gitignore
├── Exmaple2.0
├── App.axaml
├── App.axaml.cs
├── Assets
│ └── avalonia-logo.ico
├── Exmaple2.0.csproj
├── Program.cs
├── ViewLocator.cs
├── ViewModels
│ ├── MainWindowViewModel.cs
│ └── ViewModelBase.cs
├── Views
│ ├── MainWindow.axaml
│ └── MainWindow.axaml.cs
└── app.manifest
├── Images
├── Base2.png
├── Untitled1.jpg
├── custom.png
├── customImage.png
├── jetbrains-variant-4.png
├── link.png
├── markdown.png
├── stadard.png
├── standart-messagebox.png
└── window-icon.png
├── LICENSE
├── MessageBox.Avalonia.sln
├── MessageBox.Avalonia.sln.DotSettings
├── MsBox.Avalonia.Markdown
├── Controls
│ └── MarkdownView.axaml
├── MsBox.Avalonia.Markdown.csproj
└── icon.jpg
├── MsBox.Avalonia
├── Assets
│ ├── battery.png
│ ├── bluetooth.png
│ ├── database.png
│ ├── error.png
│ ├── eye.ttf
│ ├── folder.png
│ ├── forbidden.png
│ ├── info.png
│ ├── lock.png
│ ├── plus.png
│ ├── question.png
│ ├── setting.png
│ ├── speakerless.png
│ ├── speakermore.png
│ ├── stop.png
│ ├── stopwatch.png
│ ├── success.png
│ ├── warning.png
│ └── wifi.png
├── AttachadProperty
│ └── HyperLinkCommand.cs
├── Base
│ ├── IClose.cs
│ ├── ICopy.cs
│ ├── IFullApi.cs
│ ├── IInput.cs
│ ├── IMsBox.cs
│ ├── ISetCloseAction.cs
│ └── ISetFullApi.cs
├── Controls
│ ├── MarkdownView.axaml
│ ├── MarkdownView.axaml.cs
│ ├── MsBoxCustomView.axaml
│ ├── MsBoxCustomView.axaml.cs
│ ├── MsBoxStandardView.axaml
│ └── MsBoxStandardView.axaml.cs
├── Converters
│ └── ConditionalGridLengthStarConverter.cs
├── Dto
│ ├── AbstractMessageBoxParams.cs
│ ├── MessageBoxCustomParams.cs
│ └── MessageBoxStandardParams.cs
├── Enums
│ ├── ButtonEnum.cs
│ ├── ButtonResult.cs
│ ├── ClickEnum.cs
│ └── Icon.cs
├── MessageBoxManager.cs
├── Models
│ └── ButtonDefinition.cs
├── MsBox.Avalonia.csproj
├── MsBox.cs
├── ViewModels
│ ├── AbstractMsBoxViewModel.cs
│ ├── Commands
│ │ └── RelayCommand.cs
│ ├── DesignDataContexts.cs
│ ├── MsBoxCustomViewModel.cs
│ └── MsBoxStandardViewModel.cs
├── Windows
│ ├── MsBoxWindow.axaml
│ └── MsBoxWindow.axaml.cs
├── icon.jpg
└── strong-key.snk
├── README.md
└── XTest
├── .gitignore
├── Directory.Build.props
├── XTest.Android
├── Icon.png
├── MainActivity.cs
├── Properties
│ └── AndroidManifest.xml
├── Resources
│ ├── drawable
│ │ └── splash_screen.xml
│ ├── values-night
│ │ └── colors.xml
│ └── values
│ │ ├── colors.xml
│ │ └── styles.xml
└── XTest.Android.csproj
├── XTest.Browser
├── AppBundle
│ ├── Logo.svg
│ ├── app.css
│ ├── favicon.ico
│ ├── index.html
│ └── main.js
├── Program.cs
├── Properties
│ └── launchSettings.json
├── XTest.Browser.csproj
└── runtimeconfig.template.json
├── XTest.Desktop
├── Program.cs
├── XTest.Desktop.csproj
└── app.manifest
├── XTest.iOS
├── AppDelegate.cs
├── Entitlements.plist
├── Info.plist
├── Main.cs
├── Resources
│ └── LaunchScreen.xib
└── XTest.iOS.csproj
├── XTest.sln
└── XTest
├── App.axaml
├── App.axaml.cs
├── Assets
└── avalonia-logo.ico
├── ViewLocator.cs
├── ViewModels
├── MainViewModel.cs
└── ViewModelBase.cs
├── Views
├── MainView.axaml
├── MainView.axaml.cs
├── MainWindow.axaml
└── MainWindow.axaml.cs
└── XTest.csproj
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | # All files
4 | [*]
5 | indent_style = space
6 |
7 | # Xml files
8 | [*.xml]
9 | indent_size = 2
10 |
11 | # C# files
12 | [*.cs]
13 |
14 | #### Core EditorConfig Options ####
15 |
16 | # Indentation and spacing
17 | indent_size = 4
18 | tab_width = 4
19 |
20 | # New line preferences
21 | end_of_line = crlf
22 | insert_final_newline = false
23 |
24 | #### .NET Coding Conventions ####
25 | [*.{cs,vb}]
26 |
27 | # Organize usings
28 | dotnet_separate_import_directive_groups = true
29 | dotnet_sort_system_directives_first = true
30 | file_header_template = unset
31 |
32 | # this. and Me. preferences
33 | dotnet_style_qualification_for_event = false:silent
34 | dotnet_style_qualification_for_field = false:silent
35 | dotnet_style_qualification_for_method = false:silent
36 | dotnet_style_qualification_for_property = false:silent
37 |
38 | # Language keywords vs BCL types preferences
39 | dotnet_style_predefined_type_for_locals_parameters_members = true:silent
40 | dotnet_style_predefined_type_for_member_access = true:silent
41 |
42 | # Parentheses preferences
43 | dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
44 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
45 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
46 | dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
47 |
48 | # Modifier preferences
49 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
50 |
51 | # Expression-level preferences
52 | dotnet_style_coalesce_expression = true:suggestion
53 | dotnet_style_collection_initializer = true:suggestion
54 | dotnet_style_explicit_tuple_names = true:suggestion
55 | dotnet_style_null_propagation = true:suggestion
56 | dotnet_style_object_initializer = true:suggestion
57 | dotnet_style_operator_placement_when_wrapping = beginning_of_line
58 | dotnet_style_prefer_auto_properties = true:suggestion
59 | dotnet_style_prefer_compound_assignment = true:suggestion
60 | dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
61 | dotnet_style_prefer_conditional_expression_over_return = true:suggestion
62 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
63 | dotnet_style_prefer_inferred_tuple_names = true:suggestion
64 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
65 | dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
66 | dotnet_style_prefer_simplified_interpolation = true:suggestion
67 |
68 | # Field preferences
69 | dotnet_style_readonly_field = true:warning
70 |
71 | # Parameter preferences
72 | dotnet_code_quality_unused_parameters = all:suggestion
73 |
74 | # Suppression preferences
75 | dotnet_remove_unnecessary_suppression_exclusions = none
76 |
77 | #### C# Coding Conventions ####
78 | [*.cs]
79 |
80 | # var preferences
81 | csharp_style_var_elsewhere = false:silent
82 | csharp_style_var_for_built_in_types = false:silent
83 | csharp_style_var_when_type_is_apparent = false:silent
84 |
85 | # Expression-bodied members
86 | csharp_style_expression_bodied_accessors = true:silent
87 | csharp_style_expression_bodied_constructors = false:silent
88 | csharp_style_expression_bodied_indexers = true:silent
89 | csharp_style_expression_bodied_lambdas = true:suggestion
90 | csharp_style_expression_bodied_local_functions = false:silent
91 | csharp_style_expression_bodied_methods = false:silent
92 | csharp_style_expression_bodied_operators = false:silent
93 | csharp_style_expression_bodied_properties = true:silent
94 |
95 | # Pattern matching preferences
96 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
97 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
98 | csharp_style_prefer_not_pattern = true:suggestion
99 | csharp_style_prefer_pattern_matching = true:silent
100 | csharp_style_prefer_switch_expression = true:suggestion
101 |
102 | # Null-checking preferences
103 | csharp_style_conditional_delegate_call = true:suggestion
104 |
105 | # Modifier preferences
106 | csharp_prefer_static_local_function = true:warning
107 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
108 |
109 | # Code-block preferences
110 | csharp_prefer_braces = true:silent
111 | csharp_prefer_simple_using_statement = true:suggestion
112 |
113 | # Expression-level preferences
114 | csharp_prefer_simple_default_expression = true:suggestion
115 | csharp_style_deconstructed_variable_declaration = true:suggestion
116 | csharp_style_inlined_variable_declaration = true:suggestion
117 | csharp_style_pattern_local_over_anonymous_function = true:suggestion
118 | csharp_style_prefer_index_operator = true:suggestion
119 | csharp_style_prefer_range_operator = true:suggestion
120 | csharp_style_throw_expression = true:suggestion
121 | csharp_style_unused_value_assignment_preference = discard_variable:suggestion
122 | csharp_style_unused_value_expression_statement_preference = discard_variable:silent
123 |
124 | # 'using' directive preferences
125 | csharp_using_directive_placement = outside_namespace:silent
126 |
127 | #### C# Formatting Rules ####
128 |
129 | # New line preferences
130 | csharp_new_line_before_catch = true
131 | csharp_new_line_before_else = true
132 | csharp_new_line_before_finally = true
133 | csharp_new_line_before_members_in_anonymous_types = true
134 | csharp_new_line_before_members_in_object_initializers = true
135 | csharp_new_line_before_open_brace = all
136 | csharp_new_line_between_query_expression_clauses = true
137 |
138 | # Indentation preferences
139 | csharp_indent_block_contents = true
140 | csharp_indent_braces = false
141 | csharp_indent_case_contents = true
142 | csharp_indent_case_contents_when_block = true
143 | csharp_indent_labels = one_less_than_current
144 | csharp_indent_switch_labels = true
145 |
146 | # Space preferences
147 | csharp_space_after_cast = false
148 | csharp_space_after_colon_in_inheritance_clause = true
149 | csharp_space_after_comma = true
150 | csharp_space_after_dot = false
151 | csharp_space_after_keywords_in_control_flow_statements = true
152 | csharp_space_after_semicolon_in_for_statement = true
153 | csharp_space_around_binary_operators = before_and_after
154 | csharp_space_around_declaration_statements = false
155 | csharp_space_before_colon_in_inheritance_clause = true
156 | csharp_space_before_comma = false
157 | csharp_space_before_dot = false
158 | csharp_space_before_open_square_brackets = false
159 | csharp_space_before_semicolon_in_for_statement = false
160 | csharp_space_between_empty_square_brackets = false
161 | csharp_space_between_method_call_empty_parameter_list_parentheses = false
162 | csharp_space_between_method_call_name_and_opening_parenthesis = false
163 | csharp_space_between_method_call_parameter_list_parentheses = false
164 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
165 | csharp_space_between_method_declaration_name_and_open_parenthesis = false
166 | csharp_space_between_method_declaration_parameter_list_parentheses = false
167 | csharp_space_between_parentheses = false
168 | csharp_space_between_square_brackets = false
169 |
170 | # Wrapping preferences
171 | csharp_preserve_single_line_blocks = true
172 | csharp_preserve_single_line_statements = true
173 | csharp_style_namespace_declarations = block_scoped:silent
174 | csharp_style_prefer_method_group_conversion = true:silent
175 | csharp_style_prefer_top_level_statements = true:silent
176 | csharp_style_prefer_primary_constructors = true:suggestion
177 | csharp_style_prefer_null_check_over_type_check = true:suggestion
178 | csharp_style_prefer_local_over_anonymous_function = true:suggestion
179 | csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
180 | csharp_style_prefer_tuple_swap = true:suggestion
181 | csharp_style_prefer_utf8_string_literals = true:suggestion
182 |
183 | #### Naming styles ####
184 | [*.{cs,vb}]
185 |
186 | # Naming rules
187 |
188 | dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion
189 | dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces
190 | dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase
191 |
192 | dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion
193 | dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces
194 | dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase
195 |
196 | dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion
197 | dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters
198 | dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase
199 |
200 | dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion
201 | dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods
202 | dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase
203 |
204 | dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion
205 | dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties
206 | dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase
207 |
208 | dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion
209 | dotnet_naming_rule.events_should_be_pascalcase.symbols = events
210 | dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase
211 |
212 | dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion
213 | dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables
214 | dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase
215 |
216 | dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion
217 | dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants
218 | dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase
219 |
220 | dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion
221 | dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
222 | dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase
223 |
224 | dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion
225 | dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields
226 | dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase
227 |
228 | dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion
229 | dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields
230 | dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase
231 |
232 | dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion
233 | dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields
234 | dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase
235 |
236 | dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
237 | dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
238 | dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase
239 |
240 | dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
241 | dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
242 | dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
243 |
244 | dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion
245 | dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields
246 | dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase
247 |
248 | dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion
249 | dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
250 | dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase
251 |
252 | dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
253 | dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
254 | dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase
255 |
256 | dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion
257 | dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions
258 | dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase
259 |
260 | dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion
261 | dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members
262 | dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase
263 |
264 | # Symbol specifications
265 |
266 | dotnet_naming_symbols.interfaces.applicable_kinds = interface
267 | dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
268 | dotnet_naming_symbols.interfaces.required_modifiers =
269 |
270 | dotnet_naming_symbols.enums.applicable_kinds = enum
271 | dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
272 | dotnet_naming_symbols.enums.required_modifiers =
273 |
274 | dotnet_naming_symbols.events.applicable_kinds = event
275 | dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
276 | dotnet_naming_symbols.events.required_modifiers =
277 |
278 | dotnet_naming_symbols.methods.applicable_kinds = method
279 | dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
280 | dotnet_naming_symbols.methods.required_modifiers =
281 |
282 | dotnet_naming_symbols.properties.applicable_kinds = property
283 | dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
284 | dotnet_naming_symbols.properties.required_modifiers =
285 |
286 | dotnet_naming_symbols.public_fields.applicable_kinds = field
287 | dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
288 | dotnet_naming_symbols.public_fields.required_modifiers =
289 |
290 | dotnet_naming_symbols.private_fields.applicable_kinds = field
291 | dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
292 | dotnet_naming_symbols.private_fields.required_modifiers =
293 |
294 | dotnet_naming_symbols.private_static_fields.applicable_kinds = field
295 | dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
296 | dotnet_naming_symbols.private_static_fields.required_modifiers = static
297 |
298 | dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
299 | dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
300 | dotnet_naming_symbols.types_and_namespaces.required_modifiers =
301 |
302 | dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
303 | dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
304 | dotnet_naming_symbols.non_field_members.required_modifiers =
305 |
306 | dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
307 | dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
308 | dotnet_naming_symbols.type_parameters.required_modifiers =
309 |
310 | dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
311 | dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
312 | dotnet_naming_symbols.private_constant_fields.required_modifiers = const
313 |
314 | dotnet_naming_symbols.local_variables.applicable_kinds = local
315 | dotnet_naming_symbols.local_variables.applicable_accessibilities = local
316 | dotnet_naming_symbols.local_variables.required_modifiers =
317 |
318 | dotnet_naming_symbols.local_constants.applicable_kinds = local
319 | dotnet_naming_symbols.local_constants.applicable_accessibilities = local
320 | dotnet_naming_symbols.local_constants.required_modifiers = const
321 |
322 | dotnet_naming_symbols.parameters.applicable_kinds = parameter
323 | dotnet_naming_symbols.parameters.applicable_accessibilities = *
324 | dotnet_naming_symbols.parameters.required_modifiers =
325 |
326 | dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
327 | dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
328 | dotnet_naming_symbols.public_constant_fields.required_modifiers = const
329 |
330 | dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field
331 | dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal
332 | dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static
333 |
334 | dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
335 | dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
336 | dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static
337 |
338 | dotnet_naming_symbols.local_functions.applicable_kinds = local_function
339 | dotnet_naming_symbols.local_functions.applicable_accessibilities = *
340 | dotnet_naming_symbols.local_functions.required_modifiers =
341 |
342 | # Naming styles
343 |
344 | dotnet_naming_style.pascalcase.required_prefix =
345 | dotnet_naming_style.pascalcase.required_suffix =
346 | dotnet_naming_style.pascalcase.word_separator =
347 | dotnet_naming_style.pascalcase.capitalization = pascal_case
348 |
349 | dotnet_naming_style.ipascalcase.required_prefix = I
350 | dotnet_naming_style.ipascalcase.required_suffix =
351 | dotnet_naming_style.ipascalcase.word_separator =
352 | dotnet_naming_style.ipascalcase.capitalization = pascal_case
353 |
354 | dotnet_naming_style.tpascalcase.required_prefix = T
355 | dotnet_naming_style.tpascalcase.required_suffix =
356 | dotnet_naming_style.tpascalcase.word_separator =
357 | dotnet_naming_style.tpascalcase.capitalization = pascal_case
358 |
359 | dotnet_naming_style._camelcase.required_prefix = _
360 | dotnet_naming_style._camelcase.required_suffix =
361 | dotnet_naming_style._camelcase.word_separator =
362 | dotnet_naming_style._camelcase.capitalization = camel_case
363 |
364 | dotnet_naming_style.camelcase.required_prefix =
365 | dotnet_naming_style.camelcase.required_suffix =
366 | dotnet_naming_style.camelcase.word_separator =
367 | dotnet_naming_style.camelcase.capitalization = camel_case
368 |
369 | dotnet_naming_style.s_camelcase.required_prefix = s_
370 | dotnet_naming_style.s_camelcase.required_suffix =
371 | dotnet_naming_style.s_camelcase.word_separator =
372 | dotnet_naming_style.s_camelcase.capitalization = camel_case
373 | dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
374 | dotnet_style_namespace_match_folder = true:suggestion
375 | tab_width = 4
376 | indent_size = 4
377 | end_of_line = crlf
378 |
379 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | # Enable version updates for nuget
4 | - package-ecosystem: "nuget"
5 | # Look for NuGet dependency info from the `root` directory
6 | directory: "/"
7 | schedule:
8 | interval: "weekly"
9 |
10 | - package-ecosystem: "github-actions"
11 | # Workflow files stored in the
12 | # default location of `.github/workflows`
13 | directory: "/"
14 | schedule:
15 | interval: "weekly"
16 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 |
2 | name: .NET Core
3 |
4 | on:
5 | push:
6 | branches-ignore:
7 | - 'master'
8 | pull_request:
9 | branches:
10 | - '**:**'
11 |
12 |
13 | jobs:
14 | build:
15 |
16 | runs-on: ubuntu-latest
17 |
18 | steps:
19 | - uses: actions/checkout@v2
20 | - name: Setup .NET
21 | uses: actions/setup-dotnet@v1
22 | with:
23 | dotnet-version: 6.0.x
24 | - name: Restore dependencies
25 | run: dotnet restore
26 | - name: Build
27 | run: dotnet build --no-restore
28 | - name: Test
29 | run: dotnet test --no-build --verbosity normal
30 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 | [Ll]ogs/
33 | /.idea
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # StyleCop
66 | StyleCopReport.xml
67 |
68 | # Files built by Visual Studio
69 | *_i.c
70 | *_p.c
71 | *_h.h
72 | *.ilk
73 | *.meta
74 | *.obj
75 | *.iobj
76 | *.pch
77 | *.pdb
78 | *.ipdb
79 | *.pgc
80 | *.pgd
81 | *.rsp
82 | *.sbr
83 | *.tlb
84 | *.tli
85 | *.tlh
86 | *.tmp
87 | *.tmp_proj
88 | *_wpftmp.csproj
89 | *.log
90 | *.vspscc
91 | *.vssscc
92 | .builds
93 | *.pidb
94 | *.svclog
95 | *.scc
96 |
97 | # Chutzpah Test files
98 | _Chutzpah*
99 |
100 | # Visual C++ cache files
101 | ipch/
102 | *.aps
103 | *.ncb
104 | *.opendb
105 | *.opensdf
106 | *.sdf
107 | *.cachefile
108 | *.VC.db
109 | *.VC.VC.opendb
110 |
111 | # Visual Studio profiler
112 | *.psess
113 | *.vsp
114 | *.vspx
115 | *.sap
116 |
117 | # Visual Studio Trace Files
118 | *.e2e
119 |
120 | # TFS 2012 Local Workspace
121 | $tf/
122 |
123 | # Guidance Automation Toolkit
124 | *.gpState
125 |
126 | # ReSharper is a .NET coding add-in
127 | _ReSharper*/
128 | *.[Rr]e[Ss]harper
129 | *.DotSettings.user
130 |
131 | # JustCode is a .NET coding add-in
132 | .JustCode
133 |
134 | # TeamCity is a build add-in
135 | _TeamCity*
136 |
137 | # DotCover is a Code Coverage Tool
138 | *.dotCover
139 |
140 | # AxoCover is a Code Coverage Tool
141 | .axoCover/*
142 | !.axoCover/settings.json
143 |
144 | # Visual Studio code coverage results
145 | *.coverage
146 | *.coveragexml
147 |
148 | # NCrunch
149 | _NCrunch_*
150 | .*crunch*.local.xml
151 | nCrunchTemp_*
152 |
153 | # MightyMoose
154 | *.mm.*
155 | AutoTest.Net/
156 |
157 | # Web workbench (sass)
158 | .sass-cache/
159 |
160 | # Installshield output folder
161 | [Ee]xpress/
162 |
163 | # DocProject is a documentation generator add-in
164 | DocProject/buildhelp/
165 | DocProject/Help/*.HxT
166 | DocProject/Help/*.HxC
167 | DocProject/Help/*.hhc
168 | DocProject/Help/*.hhk
169 | DocProject/Help/*.hhp
170 | DocProject/Help/Html2
171 | DocProject/Help/html
172 |
173 | # Click-Once directory
174 | publish/
175 |
176 | # Publish Web Output
177 | *.[Pp]ublish.xml
178 | *.azurePubxml
179 | # Note: Comment the next line if you want to checkin your web deploy settings,
180 | # but database connection strings (with potential passwords) will be unencrypted
181 | *.pubxml
182 | *.publishproj
183 |
184 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
185 | # checkin your Azure Web App publish settings, but sensitive information contained
186 | # in these scripts will be unencrypted
187 | PublishScripts/
188 |
189 | # NuGet Packages
190 | *.nupkg
191 | # NuGet Symbol Packages
192 | *.snupkg
193 | # The packages folder can be ignored because of Package Restore
194 | **/[Pp]ackages/*
195 | # except build/, which is used as an MSBuild target.
196 | !**/[Pp]ackages/build/
197 | # Uncomment if necessary however generally it will be regenerated when needed
198 | #!**/[Pp]ackages/repositories.config
199 | # NuGet v3's project.json files produces more ignorable files
200 | *.nuget.props
201 | *.nuget.targets
202 |
203 | # Microsoft Azure Build Output
204 | csx/
205 | *.build.csdef
206 |
207 | # Microsoft Azure Emulator
208 | ecf/
209 | rcf/
210 |
211 | # Windows Store app package directories and files
212 | AppPackages/
213 | BundleArtifacts/
214 | Package.StoreAssociation.xml
215 | _pkginfo.txt
216 | *.appx
217 | *.appxbundle
218 | *.appxupload
219 |
220 | # Visual Studio cache files
221 | # files ending in .cache can be ignored
222 | *.[Cc]ache
223 | # but keep track of directories ending in .cache
224 | !?*.[Cc]ache/
225 |
226 | # Others
227 | ClientBin/
228 | ~$*
229 | *~
230 | *.dbmdl
231 | *.dbproj.schemaview
232 | *.jfm
233 | *.pfx
234 | *.publishsettings
235 | orleans.codegen.cs
236 |
237 | # Including strong name files can present a security risk
238 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
239 | #*.snk
240 |
241 | # Since there are multiple workflows, uncomment next line to ignore bower_components
242 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
243 | #bower_components/
244 |
245 | # RIA/Silverlight projects
246 | Generated_Code/
247 |
248 | # Backup & report files from converting an old project file
249 | # to a newer Visual Studio version. Backup files are not needed,
250 | # because we have git ;-)
251 | _UpgradeReport_Files/
252 | Backup*/
253 | UpgradeLog*.XML
254 | UpgradeLog*.htm
255 | ServiceFabricBackup/
256 | *.rptproj.bak
257 |
258 | # SQL Server files
259 | *.mdf
260 | *.ldf
261 | *.ndf
262 |
263 | # Business Intelligence projects
264 | *.rdl.data
265 | *.bim.layout
266 | *.bim_*.settings
267 | *.rptproj.rsuser
268 | *- [Bb]ackup.rdl
269 | *- [Bb]ackup ([0-9]).rdl
270 | *- [Bb]ackup ([0-9][0-9]).rdl
271 |
272 | # Microsoft Fakes
273 | FakesAssemblies/
274 |
275 | # GhostDoc plugin setting file
276 | *.GhostDoc.xml
277 |
278 | # Node.js Tools for Visual Studio
279 | .ntvs_analysis.dat
280 | node_modules/
281 |
282 | # Visual Studio 6 build log
283 | *.plg
284 |
285 | # Visual Studio 6 workspace options file
286 | *.opt
287 |
288 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
289 | *.vbw
290 |
291 | # Visual Studio LightSwitch build output
292 | **/*.HTMLClient/GeneratedArtifacts
293 | **/*.DesktopClient/GeneratedArtifacts
294 | **/*.DesktopClient/ModelManifest.xml
295 | **/*.Server/GeneratedArtifacts
296 | **/*.Server/ModelManifest.xml
297 | _Pvt_Extensions
298 |
299 | # Paket dependency manager
300 | .paket/paket.exe
301 | paket-files/
302 |
303 | # FAKE - F# Make
304 | .fake/
305 |
306 | # CodeRush personal settings
307 | .cr/personal
308 |
309 | # Python Tools for Visual Studio (PTVS)
310 | __pycache__/
311 | *.pyc
312 |
313 | # Cake - Uncomment if you are using it
314 | # tools/**
315 | # !tools/packages.config
316 |
317 | # Tabs Studio
318 | *.tss
319 |
320 | # Telerik's JustMock configuration file
321 | *.jmconfig
322 |
323 | # BizTalk build output
324 | *.btp.cs
325 | *.btm.cs
326 | *.odx.cs
327 | *.xsd.cs
328 |
329 | # OpenCover UI analysis results
330 | OpenCover/
331 |
332 | # Azure Stream Analytics local run output
333 | ASALocalRun/
334 |
335 | # MSBuild Binary and Structured Log
336 | *.binlog
337 |
338 | # NVidia Nsight GPU debugger configuration file
339 | *.nvuser
340 |
341 | # MFractors (Xamarin productivity tool) working folder
342 | .mfractor/
343 |
344 | # Local History for Visual Studio
345 | .localhistory/
346 |
347 | # BeatPulse healthcheck temp database
348 | healthchecksdb
349 |
350 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
351 | MigrationBackup/
352 |
353 | # Ionide (cross platform F# VS Code tools) working folder
354 | .ionide/
355 |
356 | #Ignore idea files
357 | .idea/
358 | #Ignore special
359 | .directory
--------------------------------------------------------------------------------
/Exmaple2.0/App.axaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Exmaple2.0/App.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.ApplicationLifetimes;
3 | using Avalonia.Markup.Xaml;
4 |
5 | using Exmaple2._0.ViewModels;
6 | using Exmaple2._0.Views;
7 |
8 | namespace Exmaple2._0;
9 |
10 | public partial class App : Application
11 | {
12 | public override void Initialize()
13 | {
14 | AvaloniaXamlLoader.Load(this);
15 | }
16 |
17 | public override void OnFrameworkInitializationCompleted()
18 | {
19 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
20 | {
21 | desktop.MainWindow = new MainWindow
22 | {
23 | DataContext = new MainWindowViewModel(),
24 | };
25 | }
26 |
27 | base.OnFrameworkInitializationCompleted();
28 | }
29 | }
--------------------------------------------------------------------------------
/Exmaple2.0/Assets/avalonia-logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Exmaple2.0/Assets/avalonia-logo.ico
--------------------------------------------------------------------------------
/Exmaple2.0/Exmaple2.0.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0
5 | enable
6 | enable
7 | true
8 | app.manifest
9 | true
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 | Always
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Exmaple2.0/Program.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 |
3 | namespace Exmaple2._0;
4 |
5 | class Program
6 | {
7 | // Initialization code. Don't use any Avalonia, third-party APIs or any
8 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
9 | // yet and stuff might break.
10 | [STAThread]
11 | public static void Main(string[] args) => BuildAvaloniaApp()
12 | .StartWithClassicDesktopLifetime(args);
13 |
14 | // Avalonia configuration, don't remove; also used by visual designer.
15 | public static AppBuilder BuildAvaloniaApp()
16 | => AppBuilder.Configure()
17 | .UsePlatformDetect()
18 | .LogToTrace();
19 | }
--------------------------------------------------------------------------------
/Exmaple2.0/ViewLocator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Avalonia.Controls;
3 | using Avalonia.Controls.Templates;
4 | using Exmaple2._0.ViewModels;
5 |
6 | namespace Exmaple2._0;
7 |
8 | public class ViewLocator : IDataTemplate
9 | {
10 | public Control Build(object data)
11 | {
12 | var name = data.GetType().FullName!.Replace("ViewModel", "View");
13 | var type = Type.GetType(name);
14 |
15 | if (type != null)
16 | {
17 | return (Control)Activator.CreateInstance(type)!;
18 | }
19 |
20 | return new TextBlock { Text = "Not Found: " + name };
21 | }
22 |
23 | public bool Match(object data)
24 | {
25 | return data is ViewModelBase;
26 | }
27 | }
--------------------------------------------------------------------------------
/Exmaple2.0/ViewModels/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace Exmaple2._0.ViewModels;
2 |
3 | public class MainWindowViewModel : ViewModelBase
4 | {
5 | public string Greeting => "Welcome to Avalonia!";
6 | }
--------------------------------------------------------------------------------
/Exmaple2.0/ViewModels/ViewModelBase.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.ComponentModel;
2 |
3 | namespace Exmaple2._0.ViewModels;
4 |
5 | public class ViewModelBase : ObservableObject
6 | {
7 | }
--------------------------------------------------------------------------------
/Exmaple2.0/Views/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
15 |
16 |
17 |
18 |
19 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Exmaple2.0/Views/MainWindow.axaml.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Runtime.InteropServices;
3 |
4 | using Avalonia;
5 | using Avalonia.Controls;
6 | using Avalonia.Interactivity;
7 |
8 | using MsBox.Avalonia;
9 | using MsBox.Avalonia.Dto;
10 | using MsBox.Avalonia.Enums;
11 | using MsBox.Avalonia.Models;
12 |
13 | namespace Exmaple2._0.Views;
14 |
15 | public partial class MainWindow : Window
16 | {
17 | public MainWindow()
18 | {
19 | InitializeComponent();
20 | #if DEBUG
21 | this.AttachDevTools();
22 |
23 | #endif
24 | }
25 |
26 | private async void Standard_Show_OnClick(object sender, RoutedEventArgs e)
27 | {
28 | var box = MessageBoxManager
29 | .GetMessageBoxStandard("Caption", "Are you sure you would like to delete appender_replace_page_1?",
30 | ButtonEnum.YesNo);
31 |
32 | var result = await box.ShowAsPopupAsync(this);
33 | }
34 |
35 | private async void Standard_Dialog_OnClick(object sender, RoutedEventArgs e)
36 | {
37 | int maxWidth = 500;
38 | int maxHeight = 800;
39 | var box = MessageBoxManager.GetMessageBoxStandard(
40 | new MessageBoxStandardParams
41 | {
42 | ButtonDefinitions = ButtonEnum.Ok,
43 | ContentTitle = "title",
44 | //ContentHeader = header,
45 | ContentMessage = "Informative note:\n\n" +
46 | string.Concat(Enumerable.Repeat(
47 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ut pulvinar est, eget porttitor magna. Maecenas nunc elit, pretium nec mauris vel, cursus faucibus leo. Mauris consequat magna vel mi malesuada semper. Donec nunc justo, rhoncus vel viverra a, ultrices vel nibh. Praesent ut libero a nunc placerat vulputate. Morbi ullamcorper pharetra lectus, ut lobortis ex consequat sit amet. Vestibulum pellentesque quam at justo hendrerit, et tincidunt nisl mattis. Curabitur eu nibh enim.\n",
48 | 50)),
49 | Icon = MsBox.Avalonia.Enums.Icon.Question,
50 | WindowStartupLocation = WindowStartupLocation.CenterOwner,
51 | CanResize = false,
52 | MaxWidth = maxWidth,
53 | MaxHeight = maxHeight,
54 | SizeToContent = SizeToContent.WidthAndHeight,
55 | ShowInCenter = true,
56 | Topmost = false
57 | });
58 |
59 | var result = await box.ShowWindowDialogAsync(this);
60 | var i = 0;
61 | }
62 |
63 |
64 | private async void Standard_Popup_OnClick(object sender, RoutedEventArgs e)
65 | {
66 | int maxWidth = 500;
67 | int maxHeight = 800;
68 | var box = MessageBoxManager.GetMessageBoxStandard(
69 | new MessageBoxStandardParams
70 | {
71 | ButtonDefinitions = ButtonEnum.Ok,
72 | ContentTitle = "title",
73 | //ContentHeader = header,
74 | ContentMessage = "Informative note:\n\n" +
75 | string.Concat(Enumerable.Repeat(
76 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ut pulvinar est, eget porttitor magna. Maecenas nunc elit, pretium nec mauris vel, cursus faucibus leo. Mauris consequat magna vel mi malesuada semper. Donec nunc justo, rhoncus vel viverra a, ultrices vel nibh. Praesent ut libero a nunc placerat vulputate. Morbi ullamcorper pharetra lectus, ut lobortis ex consequat sit amet. Vestibulum pellentesque quam at justo hendrerit, et tincidunt nisl mattis. Curabitur eu nibh enim.\n",
77 | 50)),
78 | Icon = MsBox.Avalonia.Enums.Icon.Question,
79 | WindowStartupLocation = WindowStartupLocation.CenterOwner,
80 | CanResize = false,
81 | MaxWidth = maxWidth,
82 | MaxHeight = maxHeight,
83 | SizeToContent = SizeToContent.WidthAndHeight,
84 | ShowInCenter = true,
85 | Topmost = false
86 | });
87 |
88 | var result = await box.ShowAsPopupAsync(this);
89 | }
90 |
91 | private void Custom_Dialog_OnClick(object sender, RoutedEventArgs e)
92 | {
93 | var dialog = MessageBoxManager.GetMessageBoxCustom(
94 | new MessageBoxCustomParams
95 | {
96 | ButtonDefinitions = new List
97 | {
98 | new ButtonDefinition { Name = "Yes", },
99 | new ButtonDefinition { Name = "No", },
100 | new ButtonDefinition { Name = "Cancel", }
101 | },
102 | ContentTitle = "title",
103 | ContentMessage = "Informative note:" +
104 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ut pulvinar est, eget porttitor magna. Maecenas nunc elit, pretium nec mauris vel, cursus faucibus leo. Mauris consequat magna vel mi malesuada semper. Donec nunc justo, rhoncus vel viverra a, ultrices vel nibh. Praesent ut libero a nunc placerat vulputate. Morbi ullamcorper pharetra lectus, ut lobortis ex consequat sit amet. Vestibulum pellentesque quam at justo hendrerit, et tincidunt nisl mattis. Curabitur eu nibh enim.\n",
105 | Icon = MsBox.Avalonia.Enums.Icon.Question,
106 | WindowStartupLocation = WindowStartupLocation.CenterOwner,
107 | CanResize = false,
108 | MaxWidth = 500,
109 | MaxHeight = 800,
110 | SizeToContent = SizeToContent.WidthAndHeight,
111 | ShowInCenter = true,
112 | Topmost = false,
113 | HyperLinkParams = new HyperLinkParams
114 | {
115 | Text = "https://docs.avaloniaui.net/",
116 | Action = new Action(() =>
117 | {
118 | var desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
119 | var url = "https://docs.avaloniaui.net/";
120 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
121 | {
122 | //https://stackoverflow.com/a/2796367/241446
123 | using var proc = new Process { StartInfo = { UseShellExecute = true, FileName = url } };
124 | proc.Start();
125 |
126 | return;
127 | }
128 |
129 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
130 | {
131 | Process.Start("x-www-browser", url);
132 | return;
133 | }
134 |
135 | if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
136 | throw new Exception("invalid url: " + url);
137 | Process.Start("open", url);
138 | return;
139 | })
140 | }
141 | });
142 |
143 | dialog.ShowWindowDialogAsync(this);
144 | }
145 |
146 | private void Custom_Show_OnClick(object sender, RoutedEventArgs e)
147 | {
148 | throw new NotImplementedException();
149 | }
150 |
151 | private void Custom_PopUp_OnClick(object sender, RoutedEventArgs e)
152 | {
153 | throw new NotImplementedException();
154 | }
155 |
156 | private void Custom_MarkDown_OnClick(object sender, RoutedEventArgs e)
157 | {
158 | throw new NotImplementedException();
159 | }
160 |
161 | private async void Custom_CloseClickAway_OnClick(object sender, RoutedEventArgs e)
162 | {
163 | var result = await MessageBoxManager.GetMessageBoxCustom(
164 | new MessageBoxCustomParams
165 | {
166 | ButtonDefinitions = new List{
167 | new ButtonDefinition { Name = "Yes", },
168 | new ButtonDefinition { Name = "No", },
169 | new ButtonDefinition { Name = "Cancel", }
170 | },
171 | ContentTitle = "title",
172 | ContentMessage = "Informative note:" +
173 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ut pulvinar est, eget porttitor magna. Maecenas nunc elit, pretium nec mauris vel, cursus faucibus leo. Mauris consequat magna vel mi malesuada semper. Donec nunc justo, rhoncus vel viverra a, ultrices vel nibh. Praesent ut libero a nunc placerat vulputate. Morbi ullamcorper pharetra lectus, ut lobortis ex consequat sit amet. Vestibulum pellentesque quam at justo hendrerit, et tincidunt nisl mattis. Curabitur eu nibh enim.\n",
174 | Icon = MsBox.Avalonia.Enums.Icon.Question,
175 | WindowStartupLocation = WindowStartupLocation.CenterOwner,
176 | CanResize = false,
177 | MaxWidth = 500,
178 | MaxHeight = 800,
179 | SizeToContent = SizeToContent.WidthAndHeight,
180 | ShowInCenter = true,
181 | Topmost = false,
182 | }).ShowAsPopupAsync(this);
183 | await MessageBoxManager.GetMessageBoxCustom(
184 | new MessageBoxCustomParams
185 | {
186 | ButtonDefinitions = new List{
187 | new ButtonDefinition { Name = "OK", }
188 | },
189 | ContentTitle = "Result",
190 | ContentMessage = "You Selected:" + result,
191 | Icon = MsBox.Avalonia.Enums.Icon.Question,
192 | WindowStartupLocation = WindowStartupLocation.CenterOwner,
193 | CanResize = false,
194 | MaxWidth = 500,
195 | MaxHeight = 800,
196 | SizeToContent = SizeToContent.WidthAndHeight,
197 | ShowInCenter = true,
198 | Topmost = false,
199 | CloseOnClickAway = true
200 | }).ShowAsPopupAsync(this);
201 | }
202 | }
--------------------------------------------------------------------------------
/Exmaple2.0/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Images/Base2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/Base2.png
--------------------------------------------------------------------------------
/Images/Untitled1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/Untitled1.jpg
--------------------------------------------------------------------------------
/Images/custom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/custom.png
--------------------------------------------------------------------------------
/Images/customImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/customImage.png
--------------------------------------------------------------------------------
/Images/jetbrains-variant-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/jetbrains-variant-4.png
--------------------------------------------------------------------------------
/Images/link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/link.png
--------------------------------------------------------------------------------
/Images/markdown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/markdown.png
--------------------------------------------------------------------------------
/Images/stadard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/stadard.png
--------------------------------------------------------------------------------
/Images/standart-messagebox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/standart-messagebox.png
--------------------------------------------------------------------------------
/Images/window-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/Images/window-icon.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 CreateLab
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/MessageBox.Avalonia.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.4.32916.344
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MsBox.Avalonia", "MsBox.Avalonia\MsBox.Avalonia.csproj", "{CF50D8C1-A6E7-4844-970A-2820860BF65C}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exmaple2.0", "Exmaple2.0\Exmaple2.0.csproj", "{4C6432E6-3C50-4D7F-9BBB-BB3AD3F8BF06}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MsBox.Avalonia.Markdown", "MsBox.Avalonia.Markdown\MsBox.Avalonia.Markdown.csproj", "{1DA4B9CE-47E5-4708-BF2F-15316528905B}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {CF50D8C1-A6E7-4844-970A-2820860BF65C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {CF50D8C1-A6E7-4844-970A-2820860BF65C}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {CF50D8C1-A6E7-4844-970A-2820860BF65C}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {CF50D8C1-A6E7-4844-970A-2820860BF65C}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {4C6432E6-3C50-4D7F-9BBB-BB3AD3F8BF06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {4C6432E6-3C50-4D7F-9BBB-BB3AD3F8BF06}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {4C6432E6-3C50-4D7F-9BBB-BB3AD3F8BF06}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {4C6432E6-3C50-4D7F-9BBB-BB3AD3F8BF06}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {1DA4B9CE-47E5-4708-BF2F-15316528905B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {1DA4B9CE-47E5-4708-BF2F-15316528905B}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {1DA4B9CE-47E5-4708-BF2F-15316528905B}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {1DA4B9CE-47E5-4708-BF2F-15316528905B}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {7B8582AF-3103-48B2-8DF1-65F0F783C5CF}
36 | EndGlobalSection
37 | GlobalSection(NestedProjects) = preSolution
38 | EndGlobalSection
39 | EndGlobal
40 |
--------------------------------------------------------------------------------
/MessageBox.Avalonia.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/MsBox.Avalonia.Markdown/Controls/MarkdownView.axaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
--------------------------------------------------------------------------------
/MsBox.Avalonia.Markdown/MsBox.Avalonia.Markdown.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3.2.0.0
5 | MessageBox.Avalonia.Markdown
6 | Lary
7 | Mardkown support for Messagebox AvaloniaUI
8 | https://github.com/CreateLab/MessageBox.Avalonia
9 | MIT
10 | messagebox.avalonia
11 | true
12 | Avalonia MessageBox Markdown
13 | netstandard2.0
14 | latest
15 | enable
16 | enable
17 | true
18 | ../MsBox.Avalonia/strong-key.snk
19 | true
20 | true
21 | MessageBox.Avalonia.Markdown
22 | icon.jpg
23 |
24 |
25 |
26 | Designer
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | True
36 |
37 |
38 |
39 | True
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/MsBox.Avalonia.Markdown/icon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia.Markdown/icon.jpg
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/battery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/battery.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/bluetooth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/bluetooth.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/database.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/database.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/error.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/eye.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/eye.ttf
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/folder.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/forbidden.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/forbidden.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/info.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/lock.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/plus.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/question.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/question.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/setting.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/speakerless.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/speakerless.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/speakermore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/speakermore.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/stop.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/stopwatch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/stopwatch.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/success.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/warning.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/Assets/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AvaloniaCommunity/MessageBox.Avalonia/205196634f30a946073544a48a6757c2a525c6e1/MsBox.Avalonia/Assets/wifi.png
--------------------------------------------------------------------------------
/MsBox.Avalonia/AttachadProperty/HyperLinkCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Input;
2 |
3 | using Avalonia;
4 | using Avalonia.Data;
5 | using Avalonia.Input;
6 | using Avalonia.Interactivity;
7 | using Avalonia.Reactive;
8 |
9 | namespace MsBox.Avalonia.AttachadProperty;
10 |
11 | public class HyperLinkCommand : AvaloniaObject
12 | {
13 | static HyperLinkCommand()
14 | {
15 | CommandProperty.Changed.Subscribe(new AnonymousObserver>(x =>
16 | HandleCommandChanged(x.Sender, x.NewValue.GetValueOrDefault())));
17 | }
18 |
19 | public static readonly AttachedProperty CommandProperty =
20 | AvaloniaProperty.RegisterAttached(
21 | "Command", default(ICommand), false, BindingMode.OneWay);
22 |
23 | private static void HandleCommandChanged(AvaloniaObject element, ICommand commandValue)
24 | {
25 | if (element is Interactive interactElem)
26 | {
27 | if (commandValue != null)
28 | {
29 | // Add non-null value
30 | interactElem.AddHandler(InputElement.PointerPressedEvent, Handler);
31 | }
32 | else
33 | {
34 | // remove prev value
35 | interactElem.RemoveHandler(InputElement.PointerPressedEvent, Handler);
36 | }
37 | }
38 |
39 | // local handler fcn
40 | static void Handler(object s, RoutedEventArgs e)
41 | {
42 | if (s is Interactive interactElem)
43 | {
44 | // This is how we get the parameter off of the gui element.
45 | var commandValue = interactElem.GetValue(CommandProperty);
46 | commandValue.Execute(null);
47 | }
48 | }
49 | }
50 |
51 | ///
52 | /// Accessor for Attached property .
53 | ///
54 | public static void SetCommand(AvaloniaObject element, ICommand commandValue)
55 | {
56 | element.SetValue(CommandProperty, commandValue);
57 | }
58 |
59 | ///
60 | /// Accessor for Attached property .
61 | ///
62 | public static ICommand GetCommand(AvaloniaObject element)
63 | {
64 | return element.GetValue(CommandProperty);
65 | }
66 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Base/IClose.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Base;
2 |
3 | public interface IClose
4 | {
5 | void Close();
6 |
7 | void CloseWindow(object sender, EventArgs eventArgs);
8 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Base/ICopy.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Base;
2 |
3 | public interface ICopy
4 | {
5 | Task Copy();
6 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Base/IFullApi.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Base;
2 |
3 | public interface IFullApi : ICopy, IClose
4 | {
5 | void SetButtonResult(T bdName);
6 | T GetButtonResult();
7 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Base/IInput.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Base;
2 |
3 | public interface IInput
4 | {
5 | string InputValue { get; }
6 | }
7 |
--------------------------------------------------------------------------------
/MsBox.Avalonia/Base/IMsBox.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 |
3 | namespace MsBox.Avalonia.Base;
4 |
5 | public interface IMsBox
6 | {
7 | ///
8 | /// Show messagebox depending on the type of application
9 | /// If application is SingleViewApplicationLifetime (Mobile or Browses) then show messagebox as popup
10 | /// If application is ClassicDesktopStyleApplicationLifetime (Desktop) then show messagebox as window
11 | ///
12 | ///
13 | ///
14 | Task ShowAsync();
15 |
16 | ///
17 | /// Show messagebox as window
18 | ///
19 | ///
20 | Task ShowWindowAsync();
21 |
22 | ///
23 | /// Show messagebox as window with owner
24 | ///
25 | /// Window owner
26 | ///
27 | Task ShowWindowDialogAsync(Window owner);
28 |
29 | ///
30 | /// Show messagebox as popup
31 | ///
32 | ///
33 | ///
34 | Task ShowAsPopupAsync(ContentControl owner);
35 |
36 | ///
37 | /// Show messagebox as popup with owner
38 | ///
39 | ///
40 | ///
41 | Task ShowAsPopupAsync(Window owner);
42 |
43 | string InputValue { get; }
44 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Base/ISetCloseAction.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Base;
2 |
3 | public interface ISetCloseAction
4 | {
5 | void SetCloseAction(Action closeAction);
6 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Base/ISetFullApi.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Base;
2 |
3 | public interface ISetFullApi
4 | {
5 | void SetFullApi(IFullApi fullApi);
6 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Controls/MarkdownView.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/MsBox.Avalonia/Controls/MarkdownView.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.Primitives;
3 |
4 | namespace MsBox.Avalonia.Controls;
5 |
6 | public class MarkdownView : TemplatedControl
7 | {
8 | public static readonly StyledProperty MarkdownProperty =
9 | AvaloniaProperty.Register(nameof(Markdown));
10 |
11 | public string? Markdown
12 | {
13 | get => GetValue(MarkdownProperty);
14 | set => SetValue(MarkdownProperty, value);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MsBox.Avalonia/Controls/MsBoxCustomView.axaml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
36 |
39 |
42 |
46 |
50 |
53 |
58 |
61 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
87 |
88 |
89 |
91 |
92 |
94 |
97 |
98 |
99 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
114 |
115 |
116 |
120 |
121 |
122 |
125 |
126 |
127 |
128 |
129 |
140 |
141 |
142 |
143 |
144 |
--------------------------------------------------------------------------------
/MsBox.Avalonia/Controls/MsBoxCustomView.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 |
3 | using MsBox.Avalonia.Base;
4 | using MsBox.Avalonia.ViewModels;
5 |
6 | namespace MsBox.Avalonia.Controls;
7 |
8 | public partial class MsBoxCustomView : UserControl, IFullApi, ISetCloseAction
9 | {
10 | private string _buttonResult;
11 | private Action _closeAction;
12 |
13 | public MsBoxCustomView()
14 | {
15 | InitializeComponent();
16 | }
17 |
18 | public void SetButtonResult(string bdName)
19 | {
20 | _buttonResult = bdName;
21 | }
22 |
23 | public string GetButtonResult()
24 | {
25 | return _buttonResult;
26 | }
27 |
28 | public Task Copy()
29 | {
30 | var clipboard = TopLevel.GetTopLevel(this).Clipboard;
31 | var text = ContentTextBox.SelectedText;
32 | if (string.IsNullOrEmpty(text))
33 | {
34 | text = (DataContext as AbstractMsBoxViewModel)?.ContentMessage;
35 | }
36 | return clipboard?.SetTextAsync(text);
37 | }
38 |
39 | public void Close()
40 | {
41 | _closeAction?.Invoke();
42 | }
43 |
44 | public void CloseWindow(object sender, EventArgs eventArgs)
45 | {
46 | ((IClose)this).Close();
47 | }
48 |
49 |
50 | public void SetCloseAction(Action closeAction)
51 | {
52 | _closeAction = closeAction;
53 | }
54 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Controls/MsBoxStandardView.axaml:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
33 |
43 |
46 |
49 |
53 |
57 |
61 |
69 |
72 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
103 |
104 |
106 |
109 |
110 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
124 |
125 |
126 |
128 |
133 |
137 |
141 |
145 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/MsBox.Avalonia/Controls/MsBoxStandardView.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 |
3 | using MsBox.Avalonia.Base;
4 | using MsBox.Avalonia.Enums;
5 | using MsBox.Avalonia.ViewModels;
6 |
7 | namespace MsBox.Avalonia.Controls;
8 |
9 | public partial class MsBoxStandardView : UserControl, IFullApi, ISetCloseAction
10 | {
11 | private ButtonResult _buttonResult = ButtonResult.None;
12 | private Action _closeAction;
13 |
14 | public MsBoxStandardView()
15 | {
16 | InitializeComponent();
17 | }
18 |
19 | public void SetButtonResult(ButtonResult bdName)
20 | {
21 | _buttonResult = bdName;
22 | }
23 |
24 | public ButtonResult GetButtonResult()
25 | {
26 | return _buttonResult;
27 | }
28 |
29 | public Task Copy()
30 | {
31 | var clipboard = TopLevel.GetTopLevel(this).Clipboard;
32 | var text = ContentTextBox.SelectedText;
33 | if (string.IsNullOrEmpty(text))
34 | {
35 | text = (DataContext as AbstractMsBoxViewModel)?.ContentMessage;
36 | }
37 | return clipboard?.SetTextAsync(text);
38 | }
39 |
40 | public void Close()
41 | {
42 | _closeAction?.Invoke();
43 | }
44 |
45 | public void CloseWindow(object sender, EventArgs eventArgs)
46 | {
47 | ((IClose)this).Close();
48 | }
49 |
50 | public void SetCloseAction(Action closeAction)
51 | {
52 | _closeAction = closeAction;
53 | }
54 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Converters/ConditionalGridLengthStarConverter.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 |
3 | using Avalonia.Controls;
4 | using Avalonia.Data.Converters;
5 |
6 | namespace MsBox.Avalonia.Converters;
7 |
8 | public class ConditionalGridLengthStarConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | if ((bool)value)
13 | {
14 | return GridLength.Star;
15 | }
16 | else
17 | {
18 | return GridLength.Auto;
19 | }
20 | }
21 |
22 | public object ConvertBack(object value, Type targetType, object Parameter, CultureInfo culture)
23 | {
24 | throw new NotImplementedException();
25 | }
26 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Dto/AbstractMessageBoxParams.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.Media;
3 |
4 | namespace MsBox.Avalonia.Dto;
5 |
6 | public abstract class AbstractMessageBoxParams
7 | {
8 | ///
9 | /// Window icon of app in title bar
10 | ///
11 | public WindowIcon WindowIcon { get; set; } = null;
12 |
13 | ///
14 | /// Ability of resizing window
15 | ///
16 | public bool CanResize { get; set; } = false;
17 |
18 | ///
19 | /// Show in center screen
20 | ///
21 | public bool ShowInCenter { get; set; } = true;
22 |
23 | ///
24 | /// Font in messagebox text
25 | ///
26 | public FontFamily FontFamily { get; set; } = FontFamily.Default;
27 |
28 | ///
29 | /// Title of window in title bar
30 | ///
31 | public string ContentTitle { get; set; } = string.Empty;
32 |
33 | ///
34 | /// Header of messagebox window
35 | ///
36 | public string ContentHeader { get; set; } = null;
37 |
38 | ///
39 | /// Main text of messagebox body
40 | ///
41 | public string ContentMessage { get; set; } = string.Empty;
42 |
43 | ///
44 | /// Whether to render the main text of messagebox body as Markdown text
45 | ///
46 | public bool Markdown { get; set; } = false;
47 |
48 | ///
49 | /// Minimal width of window (default 200)
50 | ///
51 | public double MinWidth { get; set; } = 200;
52 |
53 | ///
54 | /// Max width of window
55 | ///
56 | public double MaxWidth { get; set; } = double.PositiveInfinity;
57 |
58 | ///
59 | /// Actual width of window
60 | ///
61 | public double Width { get; set; } = double.NaN;
62 |
63 | ///
64 | /// Minimum height of window (default 100)
65 | ///
66 | public double MinHeight { get; set; } = 100;
67 |
68 | ///
69 | /// Max height of window
70 | ///
71 | public double MaxHeight { get; set; } = double.PositiveInfinity;
72 |
73 | ///
74 | /// Actual height of window
75 | ///
76 | public double Height { get; set; } = double.NaN;
77 |
78 | ///
79 | /// Setup height and weight based on content
80 | ///
81 | ///
82 | /// Content - text size and icon (image) size
83 | ///
84 | public SizeToContent SizeToContent { get; set; } = SizeToContent.WidthAndHeight;
85 |
86 | ///
87 | /// Position window
88 | ///
89 | public WindowStartupLocation WindowStartupLocation { get; set; } = WindowStartupLocation.Manual;
90 |
91 | ///
92 | /// Determines system decorations (title bar, border, etc)
93 | ///
94 | public SystemDecorations SystemDecorations { get; set; } = SystemDecorations.Full;
95 |
96 | ///
97 | /// Window under all windows
98 | ///
99 | public bool Topmost { get; set; } = false;
100 |
101 | ///
102 | /// Hyperlink
103 | ///
104 | public HyperLinkParams HyperLinkParams { get; set; }
105 |
106 | ///
107 | /// Input
108 | ///
109 | public InputParams InputParams { get; set; }
110 |
111 | ///
112 | /// param to set closeOnClickAway
113 | ///
114 | public bool CloseOnClickAway { get; set; } = false;
115 | }
116 |
117 | public class HyperLinkParams
118 | {
119 | ///
120 | /// Hyperlink text
121 | ///
122 | public string Text { get; set; }
123 |
124 | ///
125 | /// Hyperlink callback
126 | ///
127 | public Action Action { get; set; }
128 | }
129 |
130 | public class InputParams
131 | {
132 | ///
133 | /// Input label
134 | ///
135 | public string Label { get; set; }
136 | ///
137 | /// Input default text
138 | ///
139 | public string DefaultValue { get; set; } = "";
140 | ///
141 | /// Input multiline
142 | ///
143 | public bool Multiline { get; set; }
144 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Dto/MessageBoxCustomParams.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Media.Imaging;
2 |
3 | using MsBox.Avalonia.Enums;
4 | using MsBox.Avalonia.Models;
5 |
6 | namespace MsBox.Avalonia.Dto;
7 |
8 | public class MessageBoxCustomParams : AbstractMessageBoxParams
9 | {
10 | ///
11 | /// Image of window
12 | /// Only if Icon is None
13 | ///
14 | public Bitmap ImageIcon { get; set; }
15 |
16 | ///
17 | /// Icon of window
18 | /// Higher priority than ImageIcon
19 | ///
20 | public Icon Icon { get; set; } = Icon.None;
21 |
22 | ///
23 | /// Buttons
24 | ///
25 | public IEnumerable ButtonDefinitions { get; set; }
26 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Dto/MessageBoxStandardParams.cs:
--------------------------------------------------------------------------------
1 | using MsBox.Avalonia.Enums;
2 |
3 | namespace MsBox.Avalonia.Dto;
4 |
5 | public class MessageBoxStandardParams : AbstractMessageBoxParams
6 | {
7 | ///
8 | /// Icon of window
9 | ///
10 | public Icon Icon { get; set; } = Icon.None;
11 |
12 | ///
13 | /// Default buttons
14 | ///
15 | public ButtonEnum ButtonDefinitions { get; set; } = ButtonEnum.Ok;
16 |
17 | public ClickEnum EnterDefaultButton { get; set; } = ClickEnum.Default;
18 | public ClickEnum EscDefaultButton { get; set; } = ClickEnum.Default;
19 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Enums/ButtonEnum.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Enums;
2 |
3 | ///
4 | /// Buttons in message box window
5 | ///
6 | public enum ButtonEnum
7 | {
8 | Ok,
9 |
10 | YesNo,
11 |
12 | OkCancel,
13 |
14 | OkAbort,
15 |
16 | YesNoCancel,
17 |
18 | YesNoAbort,
19 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Enums/ButtonResult.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Enums;
2 |
3 | ///
4 | /// Result on click in message box button
5 | ///
6 | public enum ButtonResult
7 | {
8 | Ok,
9 | Yes,
10 | No,
11 | Abort,
12 | Cancel,
13 | None,
14 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Enums/ClickEnum.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Enums;
2 |
3 | public enum ClickEnum
4 | {
5 | Ok,
6 | Yes,
7 | No,
8 | Abort,
9 | Cancel,
10 | None,
11 | Default,
12 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Enums/Icon.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Enums;
2 |
3 | public enum Icon
4 | {
5 | None = 0,
6 | Battery,
7 | Database,
8 | Error,
9 | Folder,
10 | Forbidden,
11 | Info,
12 | Plus,
13 | Question,
14 | Setting,
15 | SpeakerLess,
16 | SpeakerMore,
17 | Stop,
18 | Stopwatch,
19 | Success,
20 | Warning,
21 | Wifi,
22 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/MessageBoxManager.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 |
3 | using MsBox.Avalonia.Base;
4 | using MsBox.Avalonia.Controls;
5 | using MsBox.Avalonia.Dto;
6 | using MsBox.Avalonia.Enums;
7 | using MsBox.Avalonia.ViewModels;
8 |
9 | namespace MsBox.Avalonia;
10 |
11 | public static class MessageBoxManager
12 | {
13 | public static IMsBox GetMessageBoxCustom(MessageBoxCustomParams @params)
14 | {
15 | var msBoxCustomViewModel = new MsBoxCustomViewModel(@params);
16 | var msBoxCustomView = new MsBoxCustomView
17 | {
18 | DataContext = msBoxCustomViewModel
19 | };
20 | return new MsBox(msBoxCustomView, msBoxCustomViewModel);
21 | }
22 |
23 | public static IMsBox GetMessageBoxStandard(MessageBoxStandardParams @params)
24 | {
25 | var msBoxStandardViewModel = new MsBoxStandardViewModel(@params);
26 | var msBoxStandardView = new MsBoxStandardView
27 | {
28 | DataContext = msBoxStandardViewModel
29 | };
30 | return new MsBox(msBoxStandardView,
31 | msBoxStandardViewModel);
32 | }
33 |
34 | ///
35 | /// Create instance of standard messagebox window
36 | ///
37 | /// Windows title
38 | /// Text of messagebox body
39 | /// Buttons of messagebox (default OK)
40 | /// Icon of messagebox (default no icon)
41 | /// Startup location of messagebox (default center screen)
42 | ///
43 | ///
44 | ///
45 | /// Recommended method for message box
46 | ///
47 | public static IMsBox GetMessageBoxStandard(string title, string text,
48 | ButtonEnum @enum = ButtonEnum.Ok, Icon icon = Icon.None,
49 | WindowStartupLocation windowStartupLocation = WindowStartupLocation.CenterScreen) =>
50 | GetMessageBoxStandard(new MessageBoxStandardParams
51 | {
52 | ContentTitle = title,
53 | ContentMessage = text,
54 | ButtonDefinitions = @enum,
55 | Icon = icon,
56 | WindowStartupLocation = windowStartupLocation
57 | });
58 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/Models/ButtonDefinition.cs:
--------------------------------------------------------------------------------
1 | namespace MsBox.Avalonia.Models;
2 |
3 | public class ButtonDefinition
4 | {
5 | ///
6 | /// Text in button
7 | ///
8 | public string Name { get; set; } = "OK";
9 |
10 | ///
11 | /// When true and if ENTER key is pressed, the button will be called
12 | ///
13 | public bool IsDefault { get; set; }
14 |
15 | ///
16 | /// When true and if ESC key is pressed, the button will be called
17 | ///
18 | public bool IsCancel { get; set; }
19 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/MsBox.Avalonia.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3.2.0.0
5 | MessageBox.Avalonia
6 | Lary
7 | Messagebox for AvaloniaUI
8 | https://github.com/CreateLab/MessageBox.Avalonia
9 | MIT
10 | messagebox.avalonia
11 | true
12 | Avalonia MessageBox
13 | netstandard2.0
14 | latest
15 | enable
16 | enable
17 | true
18 | strong-key.snk
19 | true
20 | true
21 | MessageBox.Avalonia
22 | icon.jpg
23 |
24 |
25 |
26 | Designer
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | True
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/MsBox.Avalonia/MsBox.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Controls.ApplicationLifetimes;
4 |
5 | using DialogHostAvalonia;
6 |
7 | using MsBox.Avalonia.Base;
8 | using MsBox.Avalonia.ViewModels;
9 | using MsBox.Avalonia.Windows;
10 |
11 | namespace MsBox.Avalonia;
12 |
13 | public class MsBox : IMsBox where V : UserControl, IFullApi, ISetCloseAction where VM : ISetFullApi, IInput
14 | {
15 | private readonly V _view;
16 | private readonly VM _viewModel;
17 |
18 | public string InputValue { get { return _viewModel.InputValue; } }
19 |
20 | public MsBox(V view, VM viewModel)
21 | {
22 | _view = view;
23 | _viewModel = viewModel;
24 | }
25 |
26 | ///
27 | /// Show messagebox depending on the type of application
28 | /// If application is SingleViewApplicationLifetime (Mobile or Browses) then show messagebox as popup
29 | /// If application is ClassicDesktopStyleApplicationLifetime (Desktop) then show messagebox as window
30 | ///
31 | ///
32 | ///
33 | public Task ShowAsync()
34 | {
35 | if (Application.Current != null &&
36 | Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
37 | {
38 | return ShowWindowAsync();
39 | }
40 |
41 | if (Application.Current != null &&
42 | Application.Current.ApplicationLifetime is ISingleViewApplicationLifetime lifetime)
43 | {
44 | return ShowAsPopupAsync(lifetime.MainView as ContentControl);
45 | }
46 |
47 | throw new NotSupportedException("ApplicationLifetime is not supported");
48 | }
49 |
50 | ///
51 | /// Show messagebox as window
52 | ///
53 | ///
54 | public Task ShowWindowAsync()
55 | {
56 | _viewModel.SetFullApi(_view);
57 | var window = new MsBoxWindow
58 | {
59 | Content = _view,
60 | DataContext = _viewModel
61 | };
62 | window.Closed += _view.CloseWindow;
63 |
64 | var tcs = new TaskCompletionSource();
65 |
66 | _view.SetCloseAction(() =>
67 | {
68 | tcs.TrySetResult(_view.GetButtonResult());
69 | window.Close();
70 | });
71 |
72 | window.Show();
73 | return tcs.Task;
74 | }
75 |
76 | ///
77 | /// Show messagebox as window with owner
78 | ///
79 | /// Window owner
80 | ///
81 | public Task ShowWindowDialogAsync(Window owner)
82 | {
83 | _viewModel.SetFullApi(_view);
84 | var window = new MsBoxWindow
85 | {
86 | Content = _view,
87 | DataContext = _viewModel
88 | };
89 | window.Closed += _view.CloseWindow;
90 | var tcs = new TaskCompletionSource();
91 |
92 | _view.SetCloseAction(() =>
93 | {
94 | tcs.TrySetResult(_view.GetButtonResult());
95 | window.Close();
96 | });
97 |
98 | window.ShowDialog(owner);
99 | return tcs.Task;
100 | }
101 |
102 | private readonly string ClickAwayParam = "MsBoxIdentifier_Cancel";
103 | ///
104 | /// Show messagebox as popup
105 | ///
106 | ///
107 | ///
108 | public Task ShowAsPopupAsync(ContentControl owner)
109 | {
110 | DialogHostStyles style = null;
111 | if (!owner.Styles.OfType().Any())
112 | {
113 | style = [];
114 | owner.Styles.Add(style);
115 | }
116 |
117 |
118 | var parentContent = owner.Content;
119 | var dh = new DialogHost
120 | {
121 | Identifier = "MsBoxIdentifier" + Guid.NewGuid()
122 | };
123 | _viewModel.SetFullApi(_view);
124 | owner.Content = null;
125 | dh.Content = parentContent;
126 |
127 | dh.CloseOnClickAway = false;
128 | if (_viewModel is AbstractMsBoxViewModel abv) dh.CloseOnClickAway = abv.CloseOnClickAway;
129 | dh.CloseOnClickAwayParameter = ClickAwayParam;
130 | dh.DialogClosing += (ss, ee) =>
131 | {
132 | if (ee.Parameter?.ToString() == ClickAwayParam)
133 | {
134 | _view.Close();
135 | }
136 | };
137 |
138 | owner.Content = dh;
139 | var tcs = new TaskCompletionSource();
140 | _view.SetCloseAction(() =>
141 | {
142 | var r = _view.GetButtonResult();
143 |
144 | if (dh.CurrentSession != null && dh.CurrentSession.IsEnded == false)
145 | {
146 | DialogHost.Close(dh.Identifier);
147 | }
148 |
149 | owner.Content = null;
150 | dh.Content = null;
151 | owner.Content = parentContent;
152 | if (style != null)
153 | {
154 | owner.Styles.Remove(style);
155 | }
156 | tcs.TrySetResult(r);
157 | });
158 | DialogHost.Show(_view, dh.Identifier);
159 | return tcs.Task;
160 | }
161 |
162 | ///
163 | /// Show messagebox as popup with owner
164 | ///
165 | ///
166 | ///
167 | public Task ShowAsPopupAsync(Window owner)
168 | {
169 | return ShowAsPopupAsync(owner as ContentControl);
170 | }
171 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/ViewModels/AbstractMsBoxViewModel.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Runtime.CompilerServices;
3 |
4 | using Avalonia.Controls;
5 | using Avalonia.Media;
6 | using Avalonia.Media.Imaging;
7 | using Avalonia.Platform;
8 |
9 | using MsBox.Avalonia.Base;
10 | using MsBox.Avalonia.Dto;
11 | using MsBox.Avalonia.Enums;
12 | using MsBox.Avalonia.ViewModels.Commands;
13 |
14 | namespace MsBox.Avalonia.ViewModels;
15 |
16 | public abstract class AbstractMsBoxViewModel : INotifyPropertyChanged, IInput
17 | {
18 | private ICopy _copy;
19 |
20 | protected void SetCopy(ICopy copy)
21 | {
22 | _copy = copy;
23 | }
24 | protected AbstractMsBoxViewModel(AbstractMessageBoxParams @params, Icon icon = Icon.None, Bitmap bitmap = null)
25 | {
26 | if (bitmap != null)
27 | {
28 | ImagePath = bitmap;
29 | }
30 | else if (icon != Icon.None)
31 | {
32 | ImagePath = new Bitmap(AssetLoader
33 | .Open(new Uri(
34 | $" avares://MsBox.Avalonia/Assets/{icon.ToString().ToLowerInvariant()}.png")));
35 | }
36 |
37 | MinWidth = @params.MinWidth;
38 | MaxWidth = @params.MaxWidth;
39 | Width = @params.Width;
40 | MinHeight = @params.MinHeight;
41 | MaxHeight = @params.MaxHeight;
42 | Height = @params.Height;
43 | CanResize = @params.CanResize;
44 | FontFamily = @params.FontFamily;
45 | ContentTitle = @params.ContentTitle;
46 | ContentHeader = @params.ContentHeader;
47 | ContentMessage = @params.ContentMessage;
48 | Markdown = @params.Markdown;
49 | WindowIconPath = @params.WindowIcon;
50 | SizeToContent = @params.SizeToContent;
51 | LocationOfMyWindow = @params.WindowStartupLocation;
52 | SystemDecorations = @params.SystemDecorations;
53 | Topmost = @params.Topmost;
54 | CloseOnClickAway = @params.CloseOnClickAway;
55 |
56 | if (@params.HyperLinkParams != null)
57 | {
58 | HyperLinkText = @params.HyperLinkParams.Text;
59 | HyperLinkCommand = new RelayCommand(_ => @params.HyperLinkParams.Action());
60 | IsHyperLinkVisible = true;
61 | }
62 |
63 | if (@params.InputParams != null)
64 | {
65 | InputLabel = @params.InputParams.Label;
66 | InputValue = @params.InputParams.DefaultValue;
67 | IsInputMultiline = @params.InputParams.Multiline;
68 | IsInputVisible = true;
69 | }
70 | }
71 |
72 | public bool CanResize { get; }
73 | public bool HasHeader => !string.IsNullOrEmpty(ContentHeader);
74 | public bool HasIcon => ImagePath is not null;
75 | public FontFamily FontFamily { get; }
76 | public string ContentTitle { get; }
77 | public string ContentHeader { get; }
78 | public string ContentMessage { get; set; }
79 | public bool Markdown { get; set; }
80 | public WindowIcon WindowIconPath { get; }
81 | public Bitmap ImagePath { get; }
82 | public double MinWidth { get; set; }
83 | public double MaxWidth { get; set; }
84 | public double Width { get; set; }
85 |
86 | public double MinHeight { get; set; }
87 | public double MaxHeight { get; set; }
88 | public double Height { get; set; }
89 |
90 | public SystemDecorations SystemDecorations { get; set; }
91 | public bool Topmost { get; set; }
92 |
93 | public SizeToContent SizeToContent { get; set; } = SizeToContent.Height;
94 |
95 | public WindowStartupLocation LocationOfMyWindow { get; }
96 |
97 | public event PropertyChangedEventHandler PropertyChanged;
98 | public bool CloseOnClickAway { get; private set; }
99 |
100 | #region Hyperlink properties
101 | public abstract RelayCommand HyperLinkCommand { get; internal set; }
102 | public abstract string HyperLinkText { get; internal set; }
103 |
104 | public abstract bool IsHyperLinkVisible { get; internal set; }
105 |
106 | #endregion
107 |
108 | #region Input properties
109 |
110 | public abstract string InputLabel { get; internal set; }
111 | public abstract string InputValue { get; set; }
112 | public abstract bool IsInputMultiline { get; internal set; }
113 | public abstract bool IsInputVisible { get; internal set; }
114 |
115 | #endregion
116 |
117 | public Task Copy()
118 | {
119 | return _copy.Copy();
120 | }
121 |
122 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
123 | {
124 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
125 | }
126 | }
--------------------------------------------------------------------------------
/MsBox.Avalonia/ViewModels/Commands/RelayCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Input;
2 |
3 | namespace MsBox.Avalonia.ViewModels.Commands;
4 |
5 | public class RelayCommand : ICommand
6 | {
7 | private readonly Func