|
1 |
| -# AVnetCore |
| 1 | +# AVnet Core Framework |
2 | 2 |
|
3 |
| -Documentation coming soon! |
4 |
| -:) |
| 3 | +[](https://github.com/uxav/AVnetCore/actions) |
| 4 | +[](https://github.com/uxav/AVnetCore/issues) |
| 5 | +[](https://github.com/uxav/AVnetCore/pulls) |
| 6 | +[](https://www.nuget.org/packages/UXAV.AVnet.Core) |
| 7 | +[](https://www.nuget.org/packages/UXAV.AVnet.Core) |
| 8 | +[](LICENSE) |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +A Crestron SimplSharp Pro framework for Crestron control system programs |
| 13 | + |
| 14 | +## Links |
| 15 | + |
| 16 | +GitHub Repository: [AVnetCore](https://github.com/uxav/AVnetCore) |
| 17 | + |
| 18 | +NuGet Package: [UXAV.AVnet.Core](https://www.nuget.org/packages/UXAV.AVnet.Core/) |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +To use this test library in your project, follow these steps: |
| 23 | + |
| 24 | +1. Install the package via NuGet. You can use the following command in the Package Manager Console: |
| 25 | + |
| 26 | + ``` |
| 27 | + dotnet add [<PROJECT>] package UXAV.AVnet.Core |
| 28 | + ``` |
| 29 | + |
| 30 | +2. Import the library classes in your code file(s): |
| 31 | + |
| 32 | + ```csharp |
| 33 | + using UXAV.AVnet.Core.Models; |
| 34 | + using UXAV.AVnet.Core.Models.Diagnostics; |
| 35 | + using UXAV.Logging; |
| 36 | + ``` |
| 37 | + |
| 38 | +3. Create a class of SystemBase: |
| 39 | + ```csharp |
| 40 | + public class MySystem : SystemBase |
| 41 | + { |
| 42 | + public MySystem(CrestronControlSystem controlSystem) : base(controlSystem) |
| 43 | + { |
| 44 | + // create all your instance logic here and any instances of rooms, devices or |
| 45 | + } |
| 46 | + |
| 47 | + protected override void AppShouldRunUpgradeScripts() |
| 48 | + { |
| 49 | + // called when the program starts with a new version number |
| 50 | + } |
| 51 | + |
| 52 | + protected override void OnProgramStatusEventHandler(eProgramStatusEventType eventType) |
| 53 | + { |
| 54 | + if (eventType == eProgramStatusEventType.Stopping) |
| 55 | + { |
| 56 | + // anything you need to save, disconnect or stop... the program is stopping |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + protected override IEnumerable<DiagnosticMessage> GenerateDiagnosticMessages() |
| 61 | + { |
| 62 | + return new DiagnosticMessage[] |
| 63 | + { |
| 64 | + // add any diagnostic messages here, |
| 65 | + // this is called for when the system needs to update the |
| 66 | + // status of stuff or the dashboard app requests it |
| 67 | + }; |
| 68 | + } |
| 69 | + |
| 70 | + protected override void SystemShouldAddItemsToInitialize(Action<IInitializable> addItem) |
| 71 | + { |
| 72 | + addItem(myDeviceWithInitialization); |
| 73 | + addItem(myOtherDeviceWithInitialization); |
| 74 | + } |
| 75 | + |
| 76 | + protected override void WebScriptingHandlersShouldRegister() |
| 77 | + { |
| 78 | + // any web scripting handlers for API's can and should register here (see docs) |
| 79 | + } |
| 80 | + } |
| 81 | + ``` |
| 82 | + |
| 83 | +4. Load and Initialize your main instance of system |
| 84 | + ```csharp |
| 85 | + public class ControlSystem : CrestronControlSystem |
| 86 | + { |
| 87 | + private readonly SystemBase _mySystem; |
| 88 | + |
| 89 | + public ControlSystem() |
| 90 | + { |
| 91 | + try |
| 92 | + { |
| 93 | + // create your instance of MySystem |
| 94 | + _mySystem = new MySystem(this); |
| 95 | + } |
| 96 | + catch (Exception e) |
| 97 | + { |
| 98 | + Logger.Error(e); |
| 99 | + } |
| 100 | + } |
| 101 | + |
| 102 | + public override void InitializeSystem() |
| 103 | + { |
| 104 | + try |
| 105 | + { |
| 106 | + // start the initializing of MySystem |
| 107 | + _mySystem?.Initialize(); |
| 108 | + } |
| 109 | + catch (Exception e) |
| 110 | + { |
| 111 | + Logger.Error(e); |
| 112 | + } |
| 113 | + } |
| 114 | + } |
| 115 | + ``` |
| 116 | + |
| 117 | +## Dependencies |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | +## Release Notes |
| 122 | + |
| 123 | +### v2.0.0 |
| 124 | + |
| 125 | +- Reconfigured workspace to new style SDK format and added support for .NET 6.0 |
| 126 | +- MidnightNotifier removed completely, use a [CronJob](UXAV.AVnet.Core/CronJobs.cs) |
| 127 | +- |
| 128 | + |
| 129 | +## Documentation |
| 130 | + |
| 131 | +TBC |
| 132 | + |
| 133 | +## Contributing |
| 134 | + |
| 135 | +Contributions are welcome! If you would like to contribute to this project, please follow these guidelines: |
| 136 | + |
| 137 | +1. Fork the repository. |
| 138 | +2. Create a new branch for your feature or bug fix. |
| 139 | +3. Make your changes and commit them. |
| 140 | +4. Push your changes to your forked repository. |
| 141 | +5. Submit a pull request to the main repository. |
| 142 | + |
| 143 | +Please ensure that your code follows the project's coding conventions and includes appropriate tests. |
| 144 | + |
| 145 | +- For feature branches use the name `feature/feature-name` |
| 146 | +- Version numbers are checked against existing tags and fail CI on match |
| 147 | + |
| 148 | +Thank you for your interest in contributing to this project! |
| 149 | + |
| 150 | +## License |
| 151 | + |
| 152 | +This project is licensed under the [MIT License](LICENSE). |
0 commit comments