Description
<p>There are 2 different kind of models:</p>
<ul>
<li>"Normal" models, they are initialized on instantiating (usually in constructor)</li>
<li>Workflow models, they are initizalied when the workflow is entered (lazy)</li>
</ul>
<p>The TV models are Workflow models, so they are initialized inside the related interface implementation: <a class="externalLink setFavicon" href="https://github.com/MediaPortal/MediaPortal-2/blob/11cc07571c5240288128e4dae4ce69b66085569c/MediaPortal/Source/UI/TV/SlimTvClient/Models/SlimTvModelBase.cs#L368-L397" style="background-image: url("//www.google.com/s2/favicons?domain=https://github.com/MediaPortal/MediaPortal-2/blob/11cc07571c5240288128e4dae4ce69b66085569c/MediaPortal/Source/UI/TV/SlimTvClient/Models/SlimTvModelBase.cs#L368-L397");" target="_blank">MediaPortal/MediaPortal-2</a>.<br>
This means, at the moment the settings are initialized only when the Workflow was entered once.<br>
<br>
A solution could need some refactoring, i.e. to add a new "normal" model, like SlimTvSettingsModel, which does initialize immediately and can be used everywhere.</p>
<ol>
<li>Adding a "SlimTvSettingsModel.cs", which implements IDisposable (no need to derive from timer/message based model)</li>
<li>Copying the settings related properties and settings change watcher into this new class (remember to dispose settings change watcher)</li>
<li>A new line to plugin.xml to make the model known (create a new guid!). Example from <a class="externalLink setFavicon" href="https://github.com/MediaPortal/MediaPortal-2/blob/master/MediaPortal/Source/UI/UiComponents/Weather/plugin.xml#L30" style="background-image: url("//www.google.com/s2/favicons?domain=https://github.com/MediaPortal/MediaPortal-2/blob/master/MediaPortal/Source/UI/UiComponents/Weather/plugin.xml#L30");" target="_blank">weather</a> plugin.</li>
<li>Like above, make the model known to the xaml screen/style:<br>
<Model x:Key="SlimTvSettings" Id="{guid from step 3}"/></li>
</ol>
<ul>
<li>"Normal" models, they are initialized on instantiating (usually in constructor)</li>
<li>Workflow models, they are initizalied when the workflow is entered (lazy)</li>
</ul>
<p>The TV models are Workflow models, so they are initialized inside the related interface implementation: <a class="externalLink setFavicon" href="https://github.com/MediaPortal/MediaPortal-2/blob/11cc07571c5240288128e4dae4ce69b66085569c/MediaPortal/Source/UI/TV/SlimTvClient/Models/SlimTvModelBase.cs#L368-L397" style="background-image: url("//www.google.com/s2/favicons?domain=https://github.com/MediaPortal/MediaPortal-2/blob/11cc07571c5240288128e4dae4ce69b66085569c/MediaPortal/Source/UI/TV/SlimTvClient/Models/SlimTvModelBase.cs#L368-L397");" target="_blank">MediaPortal/MediaPortal-2</a>.<br>
This means, at the moment the settings are initialized only when the Workflow was entered once.<br>
<br>
A solution could need some refactoring, i.e. to add a new "normal" model, like SlimTvSettingsModel, which does initialize immediately and can be used everywhere.</p>
<ol>
<li>Adding a "SlimTvSettingsModel.cs", which implements IDisposable (no need to derive from timer/message based model)</li>
<li>Copying the settings related properties and settings change watcher into this new class (remember to dispose settings change watcher)</li>
<li>A new line to plugin.xml to make the model known (create a new guid!). Example from <a class="externalLink setFavicon" href="https://github.com/MediaPortal/MediaPortal-2/blob/master/MediaPortal/Source/UI/UiComponents/Weather/plugin.xml#L30" style="background-image: url("//www.google.com/s2/favicons?domain=https://github.com/MediaPortal/MediaPortal-2/blob/master/MediaPortal/Source/UI/UiComponents/Weather/plugin.xml#L30");" target="_blank">weather</a> plugin.</li>
<li>Like above, make the model known to the xaml screen/style:<br>
<Model x:Key="SlimTvSettings" Id="{guid from step 3}"/></li>
</ol>