├── MechaView
├── version
├── MechaView.MahApps
│ ├── content
│ │ └── app.ico
│ ├── tools
│ │ ├── MechaView.psd1
│ │ ├── uninstall.ps1
│ │ ├── init.ps1
│ │ ├── install.ps1
│ │ ├── Mecha.Wpf.Ma.App
│ │ │ ├── packages.config
│ │ │ ├── MainWindow.xaml.cs
│ │ │ ├── App.xaml.cs
│ │ │ ├── MainWindow.xaml
│ │ │ ├── App.xaml
│ │ │ └── Properties
│ │ │ │ └── AssemblyInfo.cs
│ │ └── MechaView.psm1
│ └── MechaView.MahApps.nuspec
├── Mecha.Core
│ ├── packages.config
│ ├── ViewModel
│ │ ├── IAction.cs
│ │ ├── IMessage.cs
│ │ ├── MessageDialog.cs
│ │ ├── IProgress.cs
│ │ ├── Validation.cs
│ │ └── InpcInterceptor.cs
│ ├── Exceptions
│ │ └── ControlNotFoundException.cs
│ ├── ViewModel.Elements
│ │ ├── Button.cs
│ │ ├── CheckBox.cs
│ │ ├── TextView.cs
│ │ ├── TextInput.cs
│ │ ├── DateInput.cs
│ │ ├── EnumInput.cs
│ │ ├── SlideInput.cs
│ │ ├── RangeSlider.cs
│ │ ├── PasswordInput.cs
│ │ ├── TableView.cs
│ │ ├── PathInput.cs
│ │ ├── ActionElement.cs
│ │ ├── StateElement.cs
│ │ ├── Container.cs
│ │ └── Element.cs
│ ├── ViewModel.Attributes
│ │ ├── Action.cs
│ │ ├── DateInput.cs
│ │ ├── Password.cs
│ │ ├── Readonly.cs
│ │ ├── Range.cs
│ │ ├── TextInput.cs
│ │ ├── State.cs
│ │ ├── Path.cs
│ │ ├── Group.cs
│ │ ├── Message.cs
│ │ ├── Progress.cs
│ │ ├── Element.cs
│ │ └── Confirm.cs
│ ├── Mecha.Core.nuspec
│ ├── Helpers
│ │ └── Utils.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Mecha.Core.csproj
├── Mecha.Core.Wpf
│ ├── App.config
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ └── View
│ │ └── Wpf
│ │ ├── Controls
│ │ ├── ILabeled.cs
│ │ ├── RowGrid.xaml
│ │ ├── ActionPanel.xaml
│ │ ├── GroupPanel.xaml
│ │ ├── MainPanel.xaml
│ │ ├── TablePanel.xaml
│ │ ├── ActionPanel.xaml.cs
│ │ ├── GroupPanel.xaml.cs
│ │ ├── TablePanel.xaml.cs
│ │ ├── TextView.xaml
│ │ ├── TextInput.xaml
│ │ ├── PasswordInput.xaml
│ │ ├── EnumInput.xaml
│ │ ├── DateInput.xaml
│ │ ├── PathInput.xaml
│ │ ├── MandatoryInputRule.cs
│ │ ├── RowGrid.xaml.cs
│ │ ├── TextView.xaml.cs
│ │ ├── MainPanel.xaml.cs
│ │ ├── DateInput.xaml.cs
│ │ ├── TextInput.xaml.cs
│ │ ├── EnumInput.xaml.cs
│ │ └── PasswordInput.xaml.cs
│ │ ├── ButtonHandle.cs
│ │ ├── Converters
│ │ ├── IntToVisibilityConverter.cs
│ │ └── CollectionToVisibilityConverter.cs
│ │ ├── Helpers
│ │ └── Utils.cs
│ │ ├── Dialogs.cs
│ │ ├── MergedStylesExtension.cs
│ │ └── Styles.xaml
├── Mecha.Wpf.Ma.Dev
│ ├── App.config
│ ├── packages.config
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── MainWindow.xaml.cs
│ ├── App.xaml.cs
│ ├── MainWindow.xaml
│ ├── App.xaml
│ ├── Mecha.Wpf.Ma.Dev.csproj
│ └── DevApp.cs
├── Mecha.Wpf.Ma
│ ├── packages.config
│ ├── ProgressDialog.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── AppHandler.cs
│ ├── Mecha.Wpf.Ma.csproj
│ ├── WindowHandler.cs
│ └── Resources.xaml
├── Mecha.Wpf.Settings
│ ├── IApp.cs
│ ├── ColorMode.cs
│ ├── AppSettings.cs
│ ├── WindowSettings.cs
│ ├── Accent.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Mecha.Wpf.Settings.csproj
├── SettingManager
│ ├── SettingManager
│ │ ├── SettingManager.projitems
│ │ ├── SettingManagerShared.shproj
│ │ └── SettingManager.cs
│ └── SettingManager.sln
├── publish.ps1
└── MechaView.sln
├── docs
├── basics-dark.png
├── basics-light.png
├── dial-err-light.png
├── dial-msg-light.png
├── grouping-light.png
├── conventions-dark.png
├── conventions-light.png
├── decoration-light.png
├── validation-light.png
├── dial-confirm-light.png
└── dial-dynprog-light.png
├── Samples
├── Samples
│ ├── app.ico
│ ├── packages.config
│ ├── InputValidation.cs
│ ├── App.cs
│ ├── ElementDecoration.cs
│ ├── ActionDialogs.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ElementConventions.cs
│ ├── ElementGrouping.cs
│ └── Samples.csproj
└── Samples.sln
├── LICENSE
├── .gitattributes
├── .gitignore
└── README.md
/MechaView/version:
--------------------------------------------------------------------------------
1 | 0.0.152
2 |
--------------------------------------------------------------------------------
/docs/basics-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/basics-dark.png
--------------------------------------------------------------------------------
/docs/basics-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/basics-light.png
--------------------------------------------------------------------------------
/Samples/Samples/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/Samples/Samples/app.ico
--------------------------------------------------------------------------------
/docs/dial-err-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/dial-err-light.png
--------------------------------------------------------------------------------
/docs/dial-msg-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/dial-msg-light.png
--------------------------------------------------------------------------------
/docs/grouping-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/grouping-light.png
--------------------------------------------------------------------------------
/docs/conventions-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/conventions-dark.png
--------------------------------------------------------------------------------
/docs/conventions-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/conventions-light.png
--------------------------------------------------------------------------------
/docs/decoration-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/decoration-light.png
--------------------------------------------------------------------------------
/docs/validation-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/validation-light.png
--------------------------------------------------------------------------------
/docs/dial-confirm-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/dial-confirm-light.png
--------------------------------------------------------------------------------
/docs/dial-dynprog-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/docs/dial-dynprog-light.png
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/content/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/MechaView/MechaView.MahApps/content/app.ico
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/tools/MechaView.psd1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marktoman/mechaview/HEAD/MechaView/MechaView.MahApps/tools/MechaView.psd1
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/tools/uninstall.ps1:
--------------------------------------------------------------------------------
1 | param($installPath, $toolsPath, $package, $project)
2 |
3 | remove-module $package.id -ErrorAction SilentlyContinue
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Samples/Samples/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/tools/init.ps1:
--------------------------------------------------------------------------------
1 | param($installPath, $toolsPath, $package)
2 |
3 | #import-module (join-path $toolsPath "$($package.id).psm1")
4 | import-module (join-path $toolsPath "MechaView.psm1")
5 |
6 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Ma.Dev/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Ma/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Ma.Dev/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Ma.Dev/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Settings/IApp.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.Wpf.Settings
8 | {
9 | public interface IApp
10 | {
11 | void Init(AppSettings s);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel/IAction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel
8 | {
9 | public interface IMechaAction
10 | {
11 | string Label { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Settings/ColorMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.Wpf.Settings
8 | {
9 | public enum ColorMode
10 | {
11 | Auto,
12 | Light,
13 | Dark
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/ILabeled.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.View.Wpf.Controls
8 | {
9 | public interface ILabeled
10 | {
11 | double LabelWidth { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/Exceptions/ControlNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Mecha.Exceptions
6 | {
7 | public class ControlNotFoundException : Exception
8 | {
9 | public ControlNotFoundException(string message) : base(message) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel/IMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel
8 | {
9 | public interface IMechaMessage
10 | {
11 | string Title { get; set; }
12 | string Message { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/Button.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using System.Text;
5 |
6 | namespace Mecha.ViewModel.Elements
7 | {
8 | internal class Button : ActionElement
9 | {
10 | public Button(Container parent, MethodInfo method, string name) : base(parent, method, name) { }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/CheckBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using System.Text;
5 |
6 | namespace Mecha.ViewModel.Elements
7 | {
8 | internal class CheckBox : StateElement
9 | {
10 | public CheckBox(Container parent, PropertyInfo property, string name) : base(parent, property, name) { }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/TextView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using System.Text;
5 |
6 | namespace Mecha.ViewModel.Elements
7 | {
8 | internal class TextView : StateElement
9 | {
10 | public TextView(Container parent, PropertyInfo property, string name) : base(parent, property, name) { }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel/MessageDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel
8 | {
9 | public class MessageDialog : IMechaMessage
10 | {
11 | public string Message { get; set; }
12 | public string Title { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/tools/install.ps1:
--------------------------------------------------------------------------------
1 | param($installPath, $toolsPath, $package, $project)
2 |
3 | $project.object.references|
4 | Where-Object Name -in `
5 | 'Mecha.Core.Wpf',
6 | 'Mecha.Wpf.Ma',
7 | 'MahApps.Metro',
8 | 'System.Windows.Interactivity',
9 | 'ControlzEx',
10 | 'Castle.Core' |
11 | ForEach-Object Remove
12 |
13 | $project.save()
14 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Action.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Mecha.ViewModel.Attributes
6 | {
7 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
8 | public class ActionAttribute : Attribute
9 | {
10 | public ActionAttribute() { }
11 | public bool DisableValidation { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Settings/AppSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.Wpf.Settings
8 | {
9 | public class AppSettings
10 | {
11 | public WindowSettings Window { get; set; }
12 | public string Title { get; set; }
13 | public Type Content { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/TextInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using System.Text;
5 | using Mecha.ViewModel.Attributes;
6 |
7 | namespace Mecha.ViewModel.Elements
8 | {
9 | internal class TextInput : StateElement
10 | {
11 | public TextInput(Container parent, PropertyInfo property, string name) : base(parent, property, name) { }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/DateInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel.Attributes
8 | {
9 | public class DateInputAttribute : StateAttribute
10 | {
11 | public DateInputAttribute() { }
12 | public DateInputAttribute(string displayName) : base(displayName) { }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Password.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel.Attributes
8 | {
9 | public class PasswordAttribute : StateAttribute
10 | {
11 | public PasswordAttribute() : base() { }
12 | public PasswordAttribute(string displayName) : base(displayName) { }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Readonly.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel.Attributes
8 | {
9 | public class ReadonlyAttribute : StateAttribute
10 | {
11 | public ReadonlyAttribute() : base() { }
12 | public ReadonlyAttribute(string displayName) : base(displayName) { }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/DateInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Mecha.ViewModel.Elements
9 | {
10 | internal class DateInput : StateElement
11 | {
12 | public DateInput(Container parent, PropertyInfo property, string name) : base(parent, property, name) { }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Range.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Mecha.ViewModel.Attributes
6 | {
7 | public class RangeAttribute : StateAttribute
8 | {
9 | public RangeAttribute() { }
10 | public RangeAttribute(string displayName) : base(displayName) { }
11 |
12 | public double Min { get; set; }
13 | public double Max { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Settings/WindowSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.Wpf.Settings
8 | {
9 | public class WindowSettings
10 | {
11 | public ColorMode ColorMode { get; set; }
12 | public Accent Accent { get; set; }
13 | public int Width { get; set; }
14 | public int Height { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/Mecha.Core.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $title$
7 | $author$
8 | $author$
9 | false
10 | $description$
11 | Init.
12 | Copyright 2015
13 |
14 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/EnumInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Mecha.Helpers;
8 |
9 | namespace Mecha.ViewModel.Elements
10 | {
11 | internal class EnumInput : StateElement
12 | {
13 | public EnumInput(Container parent, PropertyInfo property, string name) : base(parent, property, name) { }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Ma.Dev/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using MahApps.Metro.Controls;
2 | using System.Windows;
3 |
4 | namespace Mecha.Wpf.Ma.Dev
5 | {
6 | public partial class MainWindow : MetroWindow
7 | {
8 | readonly WindowHandler handler;
9 |
10 | public MainWindow()
11 | {
12 | InitializeComponent();
13 |
14 | var wpfApp = (App)Application.Current;
15 | handler = new WindowHandler(this, wpfApp.Settings);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/TextInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel.Attributes
8 | {
9 | public class TextInputAttribute : StateAttribute
10 | {
11 | public TextInputAttribute() : base() { }
12 | public TextInputAttribute(string displayName) : base(displayName) { }
13 |
14 | public bool Multiline { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/tools/Mecha.Wpf.Ma.App/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/tools/Mecha.Wpf.Ma.App/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using MahApps.Metro.Controls;
2 | using System.Windows;
3 |
4 | namespace Mecha.Wpf.Ma.App
5 | {
6 | public partial class MainWindow : MetroWindow
7 | {
8 | readonly WindowHandler handler;
9 |
10 | public MainWindow()
11 | {
12 | InitializeComponent();
13 |
14 | var wpfApp = (App)Application.Current;
15 | handler = new WindowHandler(this, wpfApp.Settings);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Ma.Dev/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Mecha.Wpf.Settings;
2 | using System.Windows;
3 |
4 | namespace Mecha.Wpf.Ma.Dev
5 | {
6 | ///
7 | /// Interaction logic for App.xaml
8 | ///
9 | public partial class App : Application
10 | {
11 | readonly AppHandler handler;
12 | public AppSettings Settings => handler.Settings;
13 |
14 | public App()
15 | {
16 | IApp app = new global::MechaApp();
17 | handler = new AppHandler(app, this);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Samples/Samples/InputValidation.cs:
--------------------------------------------------------------------------------
1 | using Mecha.ViewModel.Attributes;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace SampleApp
9 | {
10 | public class InputValidation
11 | {
12 | [TextInput(Mandatory = true, Description = "User name")]
13 | public virtual string User { get; set; }
14 |
15 | public void BoundAction() { }
16 |
17 | [Action(DisableValidation = true)]
18 | public void UnboundAction() { }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/tools/Mecha.Wpf.Ma.App/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Mecha.Wpf.Settings;
2 | using System.Windows;
3 |
4 | namespace Mecha.Wpf.Ma.App
5 | {
6 | ///
7 | /// Interaction logic for App.xaml
8 | ///
9 | public partial class App : Application
10 | {
11 | readonly AppHandler handler;
12 | public AppSettings Settings => handler.Settings;
13 |
14 | public App()
15 | {
16 | IApp app = new global::App();
17 | handler = new AppHandler(app, this);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/tools/Mecha.Wpf.Ma.App/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/State.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel.Attributes
8 | {
9 | public class StateAttribute : ElementAttribute
10 | {
11 | public StateAttribute() { }
12 | public StateAttribute(string displayName) : base(displayName) { }
13 |
14 | public bool Mandatory { get; set; }
15 | public bool Persistent { get; set; }
16 | public double Height { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/SlideInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Reflection;
5 |
6 | namespace Mecha.ViewModel.Elements
7 | {
8 | internal class SlideInput : StateElement
9 | {
10 | public SlideInput(double min, double max, Container parent, PropertyInfo property, string name) : base(parent, property, name)
11 | {
12 | Min = min;
13 | Max = max;
14 | }
15 |
16 | public double Min { get; }
17 | public double Max { get; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/RowGrid.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/ActionPanel.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/GroupPanel.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel/IProgress.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel
8 | {
9 | public interface IMechaProgress
10 | {
11 | string Message { get; set; }
12 | string Title { get; set; }
13 | double Progress { get; set; }
14 | bool IsIndeterminate { get; set; }
15 | bool IsCancelable { get; set; }
16 | bool IsCanceled { get; }
17 |
18 | bool IsOpen { get; }
19 |
20 | Task CloseAsync();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Ma.Dev/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/MainPanel.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/RangeSlider.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using Mecha.ViewModel.Attributes;
3 |
4 | namespace Mecha.ViewModel.Elements
5 | {
6 | internal class RangeSlider : SlideInput
7 | {
8 | public RangeSlider(double min, double max, Container parent, PropertyInfo property, string name) : base(min, max, parent, property, name)
9 | {
10 |
11 | }
12 |
13 | public RangeAttribute RangeAttribute
14 | {
15 | get { return base.StateAttribute as RangeAttribute; }
16 | set { base.StateAttribute = value; }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/ButtonHandle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mecha.ViewModel;
3 | using Mecha.ViewModel.Elements;
4 |
5 | namespace Mecha.View.Wpf
6 | {
7 | internal class ButtonHandle : IMechaAction
8 | {
9 | readonly Button button;
10 | public ButtonHandle(Button button)
11 | {
12 | if (button == null)
13 | throw new ArgumentNullException();
14 |
15 | this.button = button;
16 | }
17 |
18 | public string Label
19 | {
20 | get { return button.DisplayName; }
21 | set { button.DisplayName = value; }
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/Samples/Samples/App.cs:
--------------------------------------------------------------------------------
1 | using Mecha.Wpf.Settings;
2 | using System;
3 |
4 | public class App : IApp
5 | {
6 | public void Init(AppSettings s)
7 | {
8 | s.Title = "Element Grouping";
9 | s.Window.Width = 450;
10 |
11 | s.Content = typeof(SampleApp.ElementGrouping);
12 | //s.Content = typeof(SampleApp.ElementConventions);
13 | //s.Content = typeof(SampleApp.ElementDecoration);
14 | //s.Content = typeof(SampleApp.InputValidation);
15 | //s.Content = typeof(SampleApp.ActionDialogs);
16 |
17 | s.Window.Accent = Accent.Cobalt;
18 | s.Window.ColorMode = ColorMode.Light;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/TablePanel.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/MechaView/SettingManager/SettingManager/SettingManager.projitems:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 | true
6 | 423ab3e4-56e8-4228-93c4-fa169ce18ad9
7 |
8 |
9 | SettingManagement
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/PasswordInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Mecha.ViewModel.Attributes;
8 |
9 | namespace Mecha.ViewModel.Elements
10 | {
11 | internal class PasswordInput : StateElement
12 | {
13 | public PasswordInput(Container parent, PropertyInfo property, string name) : base(parent, property, name) { }
14 |
15 | public PasswordAttribute PasswordAttribute
16 | {
17 | get { return base.Attribute as PasswordAttribute; }
18 | set { base.Attribute = value; }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/TableView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Mecha.ViewModel.Elements
9 | {
10 | internal class TableView : StateElement
11 | {
12 | public TableView(Type itemType, Container parent, PropertyInfo property, string name)
13 | : base(parent, property, name)
14 | {
15 | if (itemType == null)
16 | throw new ArgumentNullException(nameof(itemType));
17 |
18 | ItemType = itemType;
19 | }
20 |
21 | public Type ItemType { get; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/MechaView/SettingManager/SettingManager.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SettingManagerShared", "SettingManager\SettingManagerShared.shproj", "{423AB3E4-56E8-4228-93C4-FA169CE18AD9}"
7 | EndProject
8 | Global
9 | GlobalSection(SharedMSBuildProjectFiles) = preSolution
10 | SettingManager\SettingManager.projitems*{423ab3e4-56e8-4228-93c4-fa169ce18ad9}*SharedItemsImports = 13
11 | EndGlobalSection
12 | GlobalSection(SolutionProperties) = preSolution
13 | HideSolutionNode = FALSE
14 | EndGlobalSection
15 | EndGlobal
16 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Ma.Dev/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Settings/Accent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.Wpf.Settings
8 | {
9 | public enum Accent
10 | {
11 | Blue,
12 | Red,
13 | Green,
14 | Purple,
15 | Orange,
16 | Lime,
17 | Emerald,
18 | Teal,
19 | Cyan,
20 | Cobalt,
21 | Indigo,
22 | Violet,
23 | Pink,
24 | Magenta,
25 | Crimson,
26 | Amber,
27 | Yellow,
28 | Brown,
29 | Olive,
30 | Steel,
31 | Mauve,
32 | Taupe,
33 | Sienna
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/tools/Mecha.Wpf.Ma.App/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/MechaView/MechaView.MahApps/MechaView.MahApps.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | MechaView.MahApps
5 | $version$
6 | MechaView.MahApps
7 | Marek Toman
8 | Marek Toman
9 | false
10 | Automatic WPF UI for single purpose tools
11 |
12 |
13 | Copyright 2019
14 | wpf ui generator mahapps
15 | en-US
16 | MIT
17 | https://github.com/marektoman/mechaview
18 |
19 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/PathInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using System.Text;
5 | using Mecha.ViewModel.Attributes;
6 |
7 | namespace Mecha.ViewModel.Elements
8 | {
9 | internal class PathInput : TextInput
10 | {
11 | public PathInput(Container parent, PropertyInfo property, string name, PathType pathType) : base(parent, property, name)
12 | {
13 | PathType = pathType;
14 | }
15 |
16 | public PathAttribute PathAttribute
17 | {
18 | get { return base.StateAttribute as PathAttribute; }
19 | set { base.StateAttribute = value; }
20 | }
21 |
22 | public PathType PathType { get; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/ActionPanel.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace Mecha.View.Wpf.Controls
17 | {
18 | ///
19 | /// Interaction logic for ActionPanel.xaml
20 | ///
21 | public partial class ActionPanel : WrapPanel
22 | {
23 | public ActionPanel()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/GroupPanel.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace Mecha.View.Wpf.Controls
17 | {
18 | ///
19 | /// Interaction logic for GroupPanel.xaml
20 | ///
21 | public partial class GroupPanel : StackPanel
22 | {
23 | public GroupPanel()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/TablePanel.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace Mecha.View.Wpf.Controls
17 | {
18 | ///
19 | /// Interaction logic for TablePanel.xaml
20 | ///
21 | public partial class TablePanel : UserControl
22 | {
23 | public TablePanel()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Path.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Mecha.ViewModel.Attributes
6 | {
7 | public enum PathType { Auto, Open, Save, Folder }
8 |
9 | [AttributeUsage(AttributeTargets.Property)]
10 | public class PathAttribute : StateAttribute
11 | {
12 | public PathAttribute(PathType type, params string[] ext)
13 | {
14 | Type = type;
15 | }
16 | public PathAttribute(params string[] ext)
17 | {
18 | Type = PathType.Auto;
19 | Ext = ext;
20 | }
21 |
22 | public string[] Ext { get; }
23 |
24 | public bool All { get; set; }
25 |
26 | public PathType Type { get; set; }
27 | public string FileName { get; set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Group.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel.Attributes
8 | {
9 | [AttributeUsage(AttributeTargets.Field)]
10 | public class GroupAttribute : Attribute
11 | {
12 | public GroupAttribute(bool invisible)
13 | {
14 | Invisible = invisible;
15 | }
16 | public GroupAttribute(string displayName)
17 | {
18 | if (string.IsNullOrWhiteSpace(displayName))
19 | throw new ArgumentNullException();
20 |
21 | DisplayName = displayName;
22 | Invisible = false;
23 | }
24 | public string DisplayName { get; }
25 |
26 | public bool Invisible { get; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Message.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel.Attributes
8 | {
9 | [AttributeUsage(AttributeTargets.Method)]
10 | public class MessageAttribute : ActionAttribute
11 | {
12 | public MessageAttribute(string title, string message)
13 | {
14 | if (string.IsNullOrWhiteSpace(title))
15 | throw new ArgumentNullException(nameof(title));
16 | if (string.IsNullOrWhiteSpace(message))
17 | throw new ArgumentNullException(nameof(message));
18 |
19 | Title = title;
20 | Message = message;
21 | }
22 |
23 | public string Title { get; }
24 | public string Message { get; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Progress.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel.Attributes
8 | {
9 | [AttributeUsage(AttributeTargets.Method)]
10 | public class ProgressAttribute : ActionAttribute
11 | {
12 | public ProgressAttribute(string title, string message)
13 | {
14 | if (string.IsNullOrWhiteSpace(title))
15 | throw new ArgumentNullException(nameof(title));
16 | if (string.IsNullOrWhiteSpace(message))
17 | throw new ArgumentNullException(nameof(message));
18 |
19 | Title = title;
20 | Message = message;
21 | }
22 |
23 | public string Title { get; }
24 | public string Message { get; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/TextView.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Elements/ActionElement.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using System.Text;
5 | using Mecha.ViewModel;
6 | using Mecha.ViewModel.Attributes;
7 |
8 | namespace Mecha.ViewModel.Elements
9 | {
10 | internal class ActionElement : Element
11 | {
12 | public ActionElement(Container parent, MethodInfo method, string name) : base(parent, name)
13 | {
14 | if (method == null)
15 | throw new ArgumentNullException(nameof(method));
16 |
17 | this.Method = method;
18 | }
19 |
20 | public object Invoke(params object[] args)
21 | {
22 | return Method.Invoke(Parent.Source, args);
23 | }
24 |
25 | public MethodInfo Method { get; }
26 |
27 | public ActionAttribute[] ActionAttributes { get; set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Element.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Mecha.ViewModel.Attributes
6 | {
7 | [AttributeUsage(
8 | AttributeTargets.Property | AttributeTargets.Method,
9 | Inherited = true,
10 | AllowMultiple = false)]
11 | public class ElementAttribute : Attribute
12 | {
13 | public ElementAttribute() { }
14 | public ElementAttribute(string displayName)
15 | {
16 | DisplayName = displayName;
17 | }
18 |
19 | public string DisplayName { get; set; }
20 | public string Description { get; set; }
21 |
22 | ///
23 | /// A value of a user defined enum
24 | ///
25 | public object Group { get; set; }
26 | public double Position { get; set; } = -1;
27 | public int Width { get; set; } = -1;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Converters/IntToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Data;
9 |
10 | namespace Mecha.View.Wpf.Converters
11 | {
12 | [Localizability(LocalizationCategory.NeverLocalize)]
13 | public class IntToVisibilityConverter : IValueConverter
14 | {
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | return value is int x && x > 0
18 | ? Visibility.Visible
19 | : Visibility.Hidden;
20 | }
21 |
22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
23 | {
24 | throw new InvalidOperationException();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Samples/Samples/ElementDecoration.cs:
--------------------------------------------------------------------------------
1 | using Mecha.ViewModel.Attributes;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace SampleApp
9 | {
10 | public class ElementDecoration
11 | {
12 | [Readonly("Status Label")]
13 | public virtual string Status { get; set; }
14 |
15 | [TextInput(Persistent = true)]
16 | public virtual string User { get; set; }
17 |
18 | [Password(Persistent = true)]
19 | public virtual string Pass { get; set; }
20 |
21 | [TextInput(Persistent = true, Multiline = true)]
22 | public virtual string Description { get; set; }
23 |
24 | [DateInput(Persistent = true)]
25 | public virtual DateTime Start { get; set; } = DateTime.Now;
26 |
27 | [Path("txt", "md", Type = PathType.Open, Persistent = true)]
28 | public virtual string File { get; set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/TextInput.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel.Attributes/Confirm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Mecha.ViewModel.Attributes
8 | {
9 | [AttributeUsage(AttributeTargets.Method)]
10 | public class ConfirmAttribute : ActionAttribute
11 | {
12 | public ConfirmAttribute(string title, string message)
13 | {
14 | if (string.IsNullOrWhiteSpace(title))
15 | throw new ArgumentNullException(nameof(title));
16 | if (string.IsNullOrWhiteSpace(message))
17 | throw new ArgumentNullException(nameof(message));
18 |
19 | Title = title;
20 | Message = message;
21 | }
22 |
23 | public string Title { get; }
24 | public string Message { get; }
25 | public string AffirmativeText { get; set; }
26 | public string DismissiveText { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/PasswordInput.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/EnumInput.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Converters/CollectionToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Data;
9 |
10 | namespace Mecha.View.Wpf.Converters
11 | {
12 | [Localizability(LocalizationCategory.NeverLocalize)]
13 | public class CollectionToVisibilityConverter : IValueConverter
14 | {
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | if (value == null) return Visibility.Hidden;
18 | if (value is ICollection col && col.Count > 0) return Visibility.Visible;
19 | return Visibility.Hidden;
20 | }
21 |
22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
23 | {
24 | throw new InvalidOperationException();
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/DateInput.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Marek Toman
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 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/PathInput.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/MandatoryInputRule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Controls;
8 | using VM = Mecha.ViewModel.Elements;
9 |
10 | namespace Mecha.View.Wpf.Controls
11 | {
12 | internal class MandatoryInputRule : ValidationRule
13 | {
14 | readonly VM.StateElement stateVM;
15 | public MandatoryInputRule(VM.StateElement stateVM)
16 | {
17 | if (stateVM == null)
18 | throw new ArgumentNullException(nameof(stateVM));
19 | this.stateVM = stateVM;
20 | }
21 |
22 | public override ValidationResult Validate(object value, CultureInfo cultureInfo)
23 | {
24 | if (stateVM.StateAttribute?.Mandatory == true)
25 | {
26 | if (string.IsNullOrWhiteSpace(value as string))
27 | return new ValidationResult(false, "Required");
28 | }
29 |
30 | return new ValidationResult(true, value);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/MechaView/SettingManager/SettingManager/SettingManagerShared.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 423ab3e4-56e8-4228-93c4-fa169ce18ad9
5 | 14.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Helpers/Utils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Media;
10 |
11 | namespace Mecha.View.Wpf.Helpers
12 | {
13 | internal static class Utils
14 | {
15 | public static Size MeasureString(this Label ctrl)
16 | {
17 | if (string.IsNullOrEmpty(ctrl.Content?.ToString()))
18 | return new Size();
19 |
20 | return MeasureString(ctrl, ctrl.Content.ToString());
21 | }
22 | public static Size MeasureString(this Label ctrl, string candidate)
23 | {
24 | var ft = new FormattedText(
25 | candidate,
26 | CultureInfo.CurrentUICulture,
27 | FlowDirection.LeftToRight,
28 | new Typeface(ctrl.FontFamily, ctrl.FontStyle, ctrl.FontWeight, ctrl.FontStretch),
29 | ctrl.FontSize,
30 | Brushes.Black);
31 |
32 | return new Size(ft.Width, ft.Height);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Mecha.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/Samples.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29025.244
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples", "Samples\Samples.csproj", "{E78B1A54-4D33-4F25-8BCE-B0B753D42A71}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {E78B1A54-4D33-4F25-8BCE-B0B753D42A71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {E78B1A54-4D33-4F25-8BCE-B0B753D42A71}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {E78B1A54-4D33-4F25-8BCE-B0B753D42A71}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {E78B1A54-4D33-4F25-8BCE-B0B753D42A71}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {58C82D39-A5DC-4542-B8F3-D28D9E98A6A9}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Wpf.Ma.Dev/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Mecha.Wpf.Ma.Dev.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core.Wpf/View/Wpf/Controls/RowGrid.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace Mecha.View.Wpf.Controls
17 | {
18 | ///
19 | /// Interaction logic for RowGrid.xaml
20 | ///
21 | public partial class RowGrid : Grid, ILabeled
22 | {
23 | public RowGrid()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | public double LabelWidth
29 | {
30 | get
31 | {
32 | return (Children.Cast().FirstOrDefault() as ILabeled)?.LabelWidth ?? 0;
33 | }
34 | set
35 | {
36 | var il = Children.Cast().FirstOrDefault() as ILabeled;
37 | if (il != null)
38 | il.LabelWidth = value;
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/MechaView/Mecha.Core/ViewModel/Validation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Mecha.ViewModel.Elements;
7 |
8 | namespace Mecha.ViewModel
9 | {
10 | internal class Validation
11 | {
12 | public IEnumerable