-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from akesseler/add-initial-code
The initial implementation.
- Loading branch information
Showing
32 changed files
with
2,553 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,44 @@ | ||
# Plexdata.Dialogs | ||
A collection of dialog window especially for WFP projects. | ||
<p align="center"> | ||
<a href="https://github.com/akesseler/Plexdata.Dialogs/blob/master/LICENSE.md" alt="license"> | ||
<img src="https://img.shields.io/github/license/akesseler/Plexdata.Dialogs.svg" /> | ||
</a> | ||
<a href="https://github.com/akesseler/Plexdata.Dialogs/releases/latest" alt="latest"> | ||
<img src="https://img.shields.io/github/release/akesseler/Plexdata.Dialogs.svg" /> | ||
</a> | ||
<a href="https://github.com/akesseler/Plexdata.Dialogs/archive/master.zip" alt="master"> | ||
<img src="https://img.shields.io/github/languages/code-size/akesseler/Plexdata.Dialogs.svg" /> | ||
</a> | ||
</p> | ||
|
||
|
||
# Plexdata Dialogs | ||
|
||
This library represents a collection of dialog windows especially designed to be used in other | ||
WFP projects. | ||
|
||
For the moment, this library supports two dialog windows. The first one is a replacement of the | ||
standard Windows message box. The second one is a open folder dialog window allowing to easily | ||
choose a directory. | ||
|
||
## Dialog Box | ||
|
||
The _Dialog Box_ represents a simple replacement of the standard Windows message box. This dialog | ||
has been implemented because of the fact that in WPF the standard Windows message box looks pretty | ||
ugly. | ||
|
||
## Open Folder Dialog | ||
|
||
The _Open Folder Dialog_ instead represents a dialog window allowing users to choose a particular | ||
directory. This dialog has been implemented because of the fact that such a dialog box does not | ||
exist in WPF. | ||
|
||
# Library Usage | ||
|
||
**First Way** | ||
|
||
Download the compiled library from latest release and include and reference it in your project. | ||
|
||
**Second Way** | ||
|
||
Download all sources and compile them your own way. Thereafter, include the resulting library in | ||
your projects and reference it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
|
||
**1.0.0** | ||
|
||
- Initial draft on _GitHub_. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2020 plexdata.de | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
using System; | ||
using System.Windows; | ||
using System.Windows.Input; | ||
|
||
namespace Plexdata.Dialogs | ||
{ | ||
public static class DialogBox | ||
{ | ||
public static DialogResult Show(String message) | ||
{ | ||
return DialogBox.Show((Window)null, message); | ||
} | ||
|
||
public static DialogResult Show(Window owner, String message) | ||
{ | ||
return DialogBox.Show(owner, message, null); | ||
} | ||
|
||
public static DialogResult Show(String message, DialogSymbol symbol) | ||
{ | ||
return DialogBox.Show((Window)null, message, symbol); | ||
} | ||
|
||
public static DialogResult Show(Window owner, String message, DialogSymbol symbol) | ||
{ | ||
return DialogBox.Show(owner, message, owner?.Title, symbol, DialogButton.Close); | ||
} | ||
|
||
public static DialogResult Show(String message, String caption) | ||
{ | ||
return DialogBox.Show(null, message, caption); | ||
} | ||
|
||
public static DialogResult Show(Window owner, String message, String caption) | ||
{ | ||
return DialogBox.Show(owner, message, caption, DialogSymbol.None); | ||
} | ||
|
||
public static DialogResult Show(String message, String caption, DialogSymbol symbol) | ||
{ | ||
return DialogBox.Show(null, message, caption, symbol); | ||
} | ||
|
||
public static DialogResult Show(Window owner, String message, String caption, DialogSymbol symbol) | ||
{ | ||
return DialogBox.Show(owner, message, caption, symbol, DialogButton.Close); | ||
} | ||
|
||
public static DialogResult Show(String message, String caption, DialogButton buttons) | ||
{ | ||
return DialogBox.Show(null, message, caption, DialogSymbol.None, buttons, null); | ||
} | ||
|
||
public static DialogResult Show(String message, String caption, DialogButton buttons, params DialogOption[] options) | ||
{ | ||
return DialogBox.Show(null, message, caption, DialogSymbol.None, buttons, options); | ||
} | ||
|
||
public static DialogResult Show(Window owner, String message, String caption, DialogButton buttons) | ||
{ | ||
return DialogBox.Show(owner, message, caption, DialogSymbol.None, buttons, null); | ||
} | ||
|
||
public static DialogResult Show(Window owner, String message, String caption, DialogButton buttons, params DialogOption[] options) | ||
{ | ||
return DialogBox.Show(owner, message, caption, DialogSymbol.None, buttons, options); | ||
} | ||
|
||
public static DialogResult Show(String message, String caption, DialogSymbol symbol, DialogButton buttons) | ||
{ | ||
return DialogBox.Show(null, message, caption, symbol, buttons, null); | ||
} | ||
|
||
public static DialogResult Show(String message, String caption, DialogSymbol symbol, DialogButton buttons, params DialogOption[] options) | ||
{ | ||
return DialogBox.Show(null, message, caption, symbol, buttons, options); | ||
} | ||
|
||
public static DialogResult Show(Window owner, String message, String caption, DialogSymbol symbol, DialogButton buttons) | ||
{ | ||
return DialogBox.Show(owner, message, caption, symbol, buttons, null); | ||
} | ||
|
||
public static DialogResult Show(Window owner, String message, String caption, DialogSymbol symbol, DialogButton buttons, params DialogOption[] options) | ||
{ | ||
Mouse.OverrideCursor = null; | ||
|
||
Internal.DialogBox dialog = new Internal.DialogBox(owner, message, caption, buttons, symbol, options); | ||
|
||
dialog.ShowDialog(); | ||
|
||
return dialog.Result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2020 plexdata.de | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
using System; | ||
|
||
namespace Plexdata.Dialogs | ||
{ | ||
[Flags] | ||
public enum DialogButton | ||
{ | ||
/// <summary> | ||
/// The dialog box shows an `Ok` button. | ||
/// </summary> | ||
Ok = 1, | ||
|
||
/// <summary> | ||
/// The dialog box shows a `Yes` button. | ||
/// </summary> | ||
Yes = 2, | ||
|
||
/// <summary> | ||
/// The dialog box shows a `No` button. | ||
/// </summary> | ||
No = 4, | ||
|
||
/// <summary> | ||
/// The dialog box shows a `Close` button. | ||
/// </summary> | ||
Close = 8, | ||
|
||
/// <summary> | ||
/// The dialog box shows a `Cancel` button. | ||
/// </summary> | ||
Cancel = 16, | ||
|
||
/// <summary> | ||
/// The dialog box shows `Ok` and `Close` buttons. | ||
/// </summary> | ||
OkClose = DialogButton.Ok | DialogButton.Close, | ||
|
||
/// <summary> | ||
/// The dialog box shows `Ok` and `Cancel` buttons. | ||
/// </summary> | ||
OkCancel = DialogButton.Ok | DialogButton.Cancel, | ||
|
||
/// <summary> | ||
/// The dialog box shows `Yes` and `No` buttons. | ||
/// </summary> | ||
YesNo = DialogButton.Yes | DialogButton.No, | ||
|
||
/// <summary> | ||
/// The dialog box shows `Yes`, `No` and `Cancel` buttons. | ||
/// </summary> | ||
YesNoCancel = DialogButton.Yes | DialogButton.No | DialogButton.Cancel, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2020 plexdata.de | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
using System; | ||
|
||
namespace Plexdata.Dialogs | ||
{ | ||
public class DialogOption | ||
{ | ||
private DialogButton button; | ||
private String label; | ||
|
||
public DialogOption() | ||
: this(DialogButton.Ok) | ||
{ } | ||
|
||
public DialogOption(DialogButton button) | ||
: this(button, button.ToString()) | ||
{ } | ||
|
||
public DialogOption(DialogButton button, String label) | ||
{ | ||
this.Button = button; | ||
this.Label = label; | ||
} | ||
|
||
public DialogButton Button | ||
{ | ||
get | ||
{ | ||
return this.button; | ||
} | ||
set | ||
{ | ||
if ((value & (value - 1)) != 0) | ||
{ | ||
throw new ArgumentOutOfRangeException(nameof(this.Button), "Apply only one single button flag."); | ||
} | ||
|
||
this.button = value; | ||
} | ||
} | ||
|
||
public String Label | ||
{ | ||
get | ||
{ | ||
return this.label; | ||
} | ||
set | ||
{ | ||
if (String.IsNullOrWhiteSpace(value)) | ||
{ | ||
throw new ArgumentOutOfRangeException(nameof(this.Button), "The label may not be null, empty or consists only of white spaces."); | ||
} | ||
|
||
this.label = value.Trim(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2020 plexdata.de | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
namespace Plexdata.Dialogs | ||
{ | ||
public enum DialogResult | ||
{ | ||
// | ||
// Summary: | ||
// The message box returns no result. | ||
None = 0, | ||
// | ||
// Summary: | ||
// The result value of the message box is OK. | ||
OK = 1, | ||
|
||
Close = 2, | ||
// | ||
// Summary: | ||
// The result value of the message box is Cancel. | ||
Cancel = 3, | ||
// | ||
// Summary: | ||
// The result value of the message box is Yes. | ||
Yes = 4, | ||
// | ||
// Summary: | ||
// The result value of the message box is No. | ||
No = 5 | ||
} | ||
} |
Oops, something went wrong.