├── CreateNugetPackage.bat
├── .github
├── FUNDING.yml
└── workflows
│ └── dotnet-core.yml
├── WpfApp
├── icon.ico
├── WpfApp.csproj
└── Program.cs
├── docs
└── example1.gif
├── WpfApp.Gui
├── Resources
│ └── icon.png
├── App.xaml.cs
├── Views
│ ├── Basics
│ │ ├── PlcButton.xaml.cs
│ │ ├── PlcVariable.xaml.cs
│ │ ├── PlcSignalOkNok.xaml.cs
│ │ ├── PlcSignalOnOff.xaml.cs
│ │ ├── PlcErrorBar.xaml.cs
│ │ ├── PlcErrorDetails.xaml.cs
│ │ ├── PlcErrorDetails.xaml
│ │ ├── PlcButton.xaml
│ │ ├── PlcErrorBar.xaml
│ │ ├── PlcVariable.xaml
│ │ ├── PlcSignalOkNok.xaml
│ │ ├── PlcSignalOnOff.xaml
│ │ └── PlcUserControl.cs
│ ├── Pages
│ │ ├── GraphView.xaml.cs
│ │ ├── MainView.xaml.cs
│ │ ├── SettingsView.xaml.cs
│ │ ├── GraphView.xaml
│ │ ├── SettingsView.xaml
│ │ └── MainView.xaml
│ ├── MainWindow.xaml.cs
│ └── MainWindow.xaml
├── Design
│ ├── DesignSettingsProvider.cs
│ ├── DesignPlcProvider.cs
│ └── DesignPlcEventService.cs
├── GuiModuleCatalog.cs
├── ViewModels
│ ├── MainViewModel.cs
│ ├── SettingsViewModel.cs
│ ├── Basics
│ │ ├── PlcErrorDetailsViewModel.cs
│ │ ├── PlcErrorBarViewModel.cs
│ │ └── PlcVariableViewModel.cs
│ ├── GraphViewModel.cs
│ ├── ViewModelBase.cs
│ └── MainWindowViewModel.cs
├── Converters
│ ├── ConnectionStateToVisibilityConverter.cs
│ ├── BoolToStyleConverter.cs
│ ├── BoolToBrushConverter.cs
│ ├── BoolToVisibilityConverter.cs
│ ├── RoleToVisibilityConverter.cs
│ └── MinimalRoleToVisibilityConverter.cs
├── Contents.resx
├── Contents.de.resx
├── Services
│ └── PresentationService.cs
├── WpfApp.Gui.csproj
├── ViewModelLocator.cs
├── App.xaml
├── Contents.Designer.cs
└── Contents.de.Designer.cs
├── WpfApp.Interfaces
├── Commons
│ ├── IInitializable.cs
│ ├── IInstanceCreator.cs
│ └── IViewModelFactory.cs
├── Models
│ ├── DatabaseObject.cs
│ ├── User.cs
│ └── PlcEvent.cs
├── Ui
│ ├── IViewModel.cs
│ └── IPresentationService.cs
├── Enums
│ ├── Role.cs
│ └── Severity.cs
├── Services
│ ├── ISelectionService.cs
│ ├── IPlcProvider.cs
│ ├── ISettingsProvider.cs
│ ├── IPlcEventLogService.cs
│ ├── IDirectoryService.cs
│ ├── IPlcEventService.cs
│ ├── IUserService.cs
│ └── IDatabaseService.cs
├── Settings
│ ├── HardwareSetting.cs
│ ├── ErrorSetting.cs
│ ├── PlcSetting.cs
│ ├── ErrorCodeDescription.cs
│ ├── ApplicationSetting.cs
│ ├── CultureSetting.cs
│ ├── ErrorCodeSetting.cs
│ └── SettingRoot.cs
├── Exceptions
│ └── LoginFailedException.cs
├── Constants.cs
├── Extensions
│ ├── DisposableExtensions.cs
│ └── RandomExtensions.cs
├── WpfApp.Interfaces.csproj
└── Hardware
│ ├── IPlc.cs
│ └── MockPlc.cs
├── .template.config
└── template.json
├── WpfApp.Logic
├── Services
│ ├── SelectionService.cs
│ ├── PlcEventLogService.cs
│ ├── DirectoryService.cs
│ ├── PlcProvider.cs
│ ├── SettingsService.cs
│ ├── DatabaseService.cs
│ ├── PlcEventService.cs
│ └── UserService.cs
├── WpfApp.Logic.csproj
├── LogicModuleCatalog.cs
└── Hardware
│ ├── BeckhoffConversions.cs
│ └── BeckhoffPlc.cs
├── TwincatWpfHMI.template.nuspec
├── LICENSE
├── WpfApp.sln
├── README.md
└── .gitignore
/CreateNugetPackage.bat:
--------------------------------------------------------------------------------
1 | nuget pack TwincatWpfHMI.template.nuspec -NoDefaultExcludes
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: fbarresi
4 |
--------------------------------------------------------------------------------
/WpfApp/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fbarresi/twincat-wpf-boilerplate/HEAD/WpfApp/icon.ico
--------------------------------------------------------------------------------
/docs/example1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fbarresi/twincat-wpf-boilerplate/HEAD/docs/example1.gif
--------------------------------------------------------------------------------
/WpfApp.Gui/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fbarresi/twincat-wpf-boilerplate/HEAD/WpfApp.Gui/Resources/icon.png
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Commons/IInitializable.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Interfaces.Commons
2 | {
3 | public interface IInitializable
4 | {
5 | void Init();
6 | }
7 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Models/DatabaseObject.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Interfaces.Models
2 | {
3 | public class DatabaseObjectBase
4 | {
5 | public int Id { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Ui/IViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using WpfApp.Interfaces.Commons;
3 |
4 | namespace WpfApp.Interfaces.Ui
5 | {
6 | public interface IViewModel : IDisposable, IInitializable
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Enums/Role.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Interfaces.Enums
2 | {
3 | public enum Role
4 | {
5 | Root = 0,
6 | Technician = 10,
7 | Service = 20,
8 | Operator = 30
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace WpfApp.Gui
4 | {
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Commons/IInstanceCreator.cs:
--------------------------------------------------------------------------------
1 | using Ninject.Parameters;
2 |
3 | namespace WpfApp.Interfaces.Commons
4 | {
5 | public interface IInstanceCreator
6 | {
7 | T CreateInstance(ConstructorArgument[] arguments);
8 | }
9 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/Basics/PlcButton.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Gui.Views.Basics
2 | {
3 | public partial class PlcButton : PlcUserControl
4 | {
5 | public PlcButton()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Services/ISelectionService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WpfApp.Interfaces.Services
4 | {
5 | public interface ISelectionService
6 | {
7 | IObservable Current { get; }
8 | void Select(T step);
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/Basics/PlcVariable.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Gui.Views.Basics
2 | {
3 | public partial class PlcVariable : PlcUserControl
4 | {
5 | public PlcVariable()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Services/IPlcProvider.cs:
--------------------------------------------------------------------------------
1 | using WpfApp.Interfaces.Hardware;
2 |
3 | namespace WpfApp.Interfaces.Services
4 | {
5 | public interface IPlcProvider
6 | {
7 | IPlc GetHardware(string name);
8 | IPlc GetHardware();
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Settings/HardwareSetting.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace WpfApp.Interfaces.Settings
4 | {
5 | public class HardwareSetting
6 | {
7 | public List PlcSettings { get; set; } = new List();
8 | }
9 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/Basics/PlcSignalOkNok.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Gui.Views.Basics
2 | {
3 | public partial class PlcSignalOkNok : PlcUserControl
4 | {
5 | public PlcSignalOkNok()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/Basics/PlcSignalOnOff.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Gui.Views.Basics
2 | {
3 | public partial class PlcSignalOnOff : PlcUserControl
4 | {
5 | public PlcSignalOnOff()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Services/ISettingsProvider.cs:
--------------------------------------------------------------------------------
1 | using WpfApp.Interfaces.Settings;
2 |
3 | namespace WpfApp.Interfaces.Services
4 | {
5 | public interface ISettingsProvider
6 | {
7 | SettingRoot SettingRoot { get; }
8 | void SaveSettings();
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Settings/ErrorSetting.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace WpfApp.Interfaces.Settings
4 | {
5 | public class ErrorSetting
6 | {
7 | public List ErrorCodeSettings { get; set; } = new List();
8 | }
9 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Enums/Severity.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Interfaces.Enums
2 | {
3 | public enum Severity
4 | {
5 | Fatal,
6 | Critical,
7 | Error,
8 | Warning,
9 | Info,
10 | Debug,
11 | Ignored,
12 | NoError
13 | }
14 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/Pages/GraphView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace WpfApp.Gui.Views.Pages
4 | {
5 | public partial class GraphView : UserControl
6 | {
7 | public GraphView()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/Pages/MainView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace WpfApp.Gui.Views.Pages
4 | {
5 | public partial class MainView : UserControl
6 | {
7 | public MainView()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Exceptions/LoginFailedException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WpfApp.Interfaces.Exceptions
4 | {
5 | public class LoginFailedException : Exception
6 | {
7 | public LoginFailedException(string message): base(message)
8 | {
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/Basics/PlcErrorBar.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace WpfApp.Gui.Views.Basics
4 | {
5 | public partial class PlcErrorBar : UserControl
6 | {
7 | public PlcErrorBar()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/Pages/SettingsView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace WpfApp.Gui.Views.Pages
4 | {
5 | public partial class SettingsView : UserControl
6 | {
7 | public SettingsView()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Services/IPlcEventLogService.cs:
--------------------------------------------------------------------------------
1 | using WpfApp.Interfaces.Models;
2 |
3 | namespace WpfApp.Interfaces.Services
4 | {
5 | public interface IPlcEventLogService
6 | {
7 | void LogEvent(PlcEvent plcEvent);
8 | PlcEvent[] GetHistory(int elements, int page);
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/Basics/PlcErrorDetails.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace WpfApp.Gui.Views.Basics
4 | {
5 | public partial class PlcErrorDetails : UserControl
6 | {
7 | public PlcErrorDetails()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Services/IDirectoryService.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Interfaces.Services
2 | {
3 | public interface IDirectoryService
4 | {
5 | string DatabaseFolder { get; }
6 | string SettingsFolder { get; }
7 | string LogsFolder { get; }
8 | string ApplicationFolder { get; }
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Services/IPlcEventService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using WpfApp.Interfaces.Models;
3 |
4 | namespace WpfApp.Interfaces.Services
5 | {
6 | public interface IPlcEventService
7 | {
8 | public IObservable ActiveEvents { get; }
9 | public IObservable LatestEvent { get; }
10 | }
11 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Settings/PlcSetting.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Interfaces.Settings
2 | {
3 | public class PlcSetting
4 | {
5 | public string Name { get; set; } = "Plc1";
6 | public string AmsNetId { get; set; } = "";
7 | public int Port { get; set; } = 852;
8 | public bool IsMock { get; set; } = false;
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Constants.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Interfaces
2 | {
3 | public class Constants
4 | {
5 | public static string ApplicationName => "WpfApp";
6 | public static string LoggerDirectory => "Logs";
7 | public static string DatabaseDirectory => "Data";
8 | public static string SettingsDirectory => "Settings";
9 | }
10 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Design/DesignSettingsProvider.cs:
--------------------------------------------------------------------------------
1 | using WpfApp.Interfaces.Services;
2 | using WpfApp.Interfaces.Settings;
3 |
4 | namespace WpfApp.Gui.Design
5 | {
6 | internal class DesignSettingsProvider : ISettingsProvider
7 | {
8 | public SettingRoot SettingRoot => new SettingRoot();
9 | public void SaveSettings()
10 | {
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Commons/IViewModelFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using WpfApp.Interfaces.Ui;
3 |
4 | namespace WpfApp.Interfaces.Commons
5 | {
6 | public interface IViewModelFactory
7 | {
8 | T Create();
9 |
10 | TVm CreateViewModel(T model);
11 |
12 | TVm CreateViewModel();
13 | IViewModel CreateViewModel(Type viewModelType);
14 | }
15 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Settings/ErrorCodeDescription.cs:
--------------------------------------------------------------------------------
1 | using WpfApp.Interfaces.Enums;
2 |
3 | namespace WpfApp.Interfaces.Settings
4 | {
5 | public class ErrorCodeDescription
6 | {
7 | public object Value { get; set; }
8 | public string Description { get; set; }
9 | public Severity Severity { get; set; }
10 | public string LongDescription { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Settings/ApplicationSetting.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WpfApp.Interfaces.Settings
4 | {
5 | public class ApplicationSetting
6 | {
7 | public string ToggleSignalName { get; set; } = "Utils.Toggle";
8 | public string DoubleSignalName { get; set; } = "Utils.Random";
9 | public TimeSpan Autologout { get; set; } = TimeSpan.FromMinutes(5);
10 | }
11 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Ui/IPresentationService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WpfApp.Interfaces.Ui
4 | {
5 | public interface IPresentationService
6 | {
7 | void SwitchActiveViewModel(IViewModel viewModel);
8 | void SwitchActiveViewModel(Type viewModelType);
9 | void SwitchActiveViewModel() where T : IViewModel;
10 | IObservable ActiveViewModel { get; }
11 | }
12 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Settings/CultureSetting.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 |
3 | namespace WpfApp.Interfaces.Settings
4 | {
5 | public class CultureSetting
6 | {
7 | public CultureInfo SelectedCulture { get; set; } = CultureInfo.GetCultureInfo("en");
8 |
9 | public CultureInfo[] SupportedCultures =>
10 | new[] {CultureInfo.GetCultureInfo("en"), CultureInfo.GetCultureInfo("de")};
11 | }
12 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Views/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using ControlzEx.Theming;
3 | using MahApps.Metro.Controls;
4 |
5 | namespace WpfApp.Gui.Views
6 | {
7 | ///
8 | /// Interaction logic for MainWindow.xaml
9 | ///
10 | public partial class MainWindow : MetroWindow
11 | {
12 | public MainWindow()
13 | {
14 | InitializeComponent();
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/template",
3 | "author": "Federico Barresi",
4 | "classifications": [
5 | "Common", "WPF"
6 | ],
7 | "preferNameDirectory": "true",
8 | "sourceName": "WpfApp",
9 | "identity": "TwincatWpfHMI.template",
10 | "name": "Twincat WPF HMI",
11 | "shortName": "tchmi",
12 | "tags": {
13 | "language": "C#",
14 | "type": "project"
15 | }
16 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Design/DesignPlcProvider.cs:
--------------------------------------------------------------------------------
1 | using WpfApp.Interfaces.Hardware;
2 | using WpfApp.Interfaces.Services;
3 |
4 | namespace WpfApp.Gui.Design
5 | {
6 | internal class DesignPlcProvider : IPlcProvider
7 | {
8 | public IPlc GetHardware(string name)
9 | {
10 | return new MockPlc();
11 | }
12 |
13 | public IPlc GetHardware()
14 | {
15 | return new MockPlc();
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Extensions/DisposableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reactive.Disposables;
3 |
4 | namespace WpfApp.Interfaces.Extensions
5 | {
6 | public static class DisposableExtensions
7 | {
8 | public static T AddDisposableTo(this T source, CompositeDisposable disposables) where T : IDisposable
9 | {
10 | disposables.Add((IDisposable) source);
11 | return source;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/Design/DesignPlcEventService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reactive.Linq;
3 | using WpfApp.Interfaces.Models;
4 | using WpfApp.Interfaces.Services;
5 |
6 | namespace WpfApp.Gui.Design
7 | {
8 | internal class DesignPlcEventService : IPlcEventService
9 | {
10 | public IObservable ActiveEvents => Observable.Never();
11 | public IObservable LatestEvent => Observable.Never();
12 | }
13 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Models/User.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using WpfApp.Interfaces.Enums;
3 |
4 | namespace WpfApp.Interfaces.Models
5 | {
6 | public class User : DatabaseObjectBase
7 | {
8 | public string Name { get; set; }
9 | public string PasswordHash { get; set; }
10 | public List Roles { get; set; }
11 |
12 | bool HasRole(Role role)
13 | {
14 | return Roles?.Contains(role) ?? false;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/WpfApp.Gui/GuiModuleCatalog.cs:
--------------------------------------------------------------------------------
1 | using MahApps.Metro.Controls.Dialogs;
2 | using Ninject.Modules;
3 | using WpfApp.Gui.Services;
4 | using WpfApp.Interfaces.Ui;
5 |
6 | namespace WpfApp.Gui
7 | {
8 | public class GuiModuleCatalog : NinjectModule
9 | {
10 | public override void Load()
11 | {
12 | Bind().To().InSingletonScope();
13 | Bind().To().InSingletonScope();
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/WpfApp.Logic/Services/SelectionService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reactive.Linq;
3 | using System.Reactive.Subjects;
4 | using WpfApp.Interfaces.Services;
5 |
6 | namespace WpfApp.Logic.Services
7 | {
8 | public class SelectionService : ISelectionService
9 | {
10 | public IObservable Current => subject.AsObservable();
11 | private readonly Subject subject = new Subject();
12 |
13 | public void Select(T step)
14 | {
15 | subject.OnNext(step);
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Models/PlcEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using WpfApp.Interfaces.Enums;
3 |
4 | namespace WpfApp.Interfaces.Models
5 | {
6 | public class PlcEvent : DatabaseObjectBase
7 | {
8 | public DateTime Timestamp { get; set; }
9 | public string Description { get; set; }
10 | public string LongDescription { get; set; }
11 | public Severity Severity { get; set; }
12 | public object Value { get; set; }
13 | public object ExpectedValue { get; set; }
14 | public string Source { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/WpfApp.Interfaces.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Settings/ErrorCodeSetting.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using WpfApp.Interfaces.Enums;
3 |
4 | namespace WpfApp.Interfaces.Settings
5 | {
6 | public class ErrorCodeSetting
7 | {
8 | public string PlcName { get; set; }
9 | public string ErrorCodeAddress { get; set; }
10 | public List CodeDescriptions { get; set; }
11 | public bool IgnoreNotDescribedValues { get; set; }
12 | public object NoErrorValue { get; set; }
13 | public Severity DefaultSeverity { get; set; } = Severity.Warning;
14 | }
15 | }
--------------------------------------------------------------------------------
/WpfApp.Logic/WpfApp.Logic.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Services/IUserService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using WpfApp.Interfaces.Enums;
4 | using WpfApp.Interfaces.Models;
5 |
6 | namespace WpfApp.Interfaces.Services
7 | {
8 | public interface IUserService
9 | {
10 | IObservable CurrentUser { get; }
11 | void Login(string name, string password);
12 | bool AddUser(string name, string password, IEnumerable roles);
13 | bool UpdateUser(string name, string password, IEnumerable roles);
14 | bool RemoveUser(string name);
15 | void Logout();
16 |
17 | }
18 | }
--------------------------------------------------------------------------------
/WpfApp.Interfaces/Hardware/IPlc.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using TwinCAT;
4 |
5 | namespace WpfApp.Interfaces.Hardware
6 | {
7 | public interface IPlc : IDisposable
8 | {
9 | public IObservable ConnectionState { get; }
10 | public IObservable CreateNotification(string variable);
11 | public IObservable CreateNotification(string variable, TimeSpan cycle);
12 | public Task Read(string variable);
13 | public Task Write(string variable, T value);
14 | IObservable