You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**NOTE**: BindingContext will be copied automaticaly, but if your view constructor has any parameters, you will have to implement an interface - **ICsharpRestorable**:
85
+
**NOTE**: BindingContext will be copied automaticaly, but if your view constructor has any parameters, you will have to define a property **object[] HotReloadCtorParams => new object[] { }**:
87
86
```csharp
88
87
[HotReloader.CSharpVisual]
89
88
publicclassCodeContentPage : ContentPage
@@ -96,15 +95,15 @@ public class CodeContentPage : ContentPage
96
95
BackgroundColor=backColor;
97
96
}
98
97
99
-
public object[] ConstructorRestoringParameters => new object[] { _backColor }; //These arguments will be passed in case of reloading
98
+
object[] HotReloadCtorParams=>newobject[] { _backColor }; //These arguments will be passed in case of reloading
100
99
}
101
100
```
102
101
103
102
* ViewModels (BindingContext) can be updated as well. No need to to mark them with any attribute.
104
103
105
104
### Additional Setup / Troubleshooting
106
105
107
-
0) If you want to disable HotReload for Release mode, follow instructions here https://github.com/AndreiMisiukevich/HotReload/issues/115#issuecomment-522475773
106
+
0) If you want to disable HotReload for Release mode, follow instructions here https://github.com/AndreiMisiukevich/HotReload/issues/115#issuecomment-524545788
108
107
109
108
1) Your device/simulator/emulator will be discovered automatically. (**IMPORTANT**:
110
109
Make sure your PC/Mac and device/emulator are in the same local network.)
@@ -140,19 +139,19 @@ var port = info.SelectedDevicePort;
140
139
varaddresses=info.IPAddresses;
141
140
```
142
141
143
-
4) If you want to make any initialization of your element after reloading, you should implement **IReloadable** interface. **OnLoaded**will be called each time when element is created (constructor called) AND element's Xaml updated. So, you needn't duplicate code in constructor and in **OnLoaded** method. Just use **OnLoaded** then.
142
+
4) If you want to make any initialization of your element after reloading, you should define a method **void OnHotReloaded ()**. It will be called each time when element's content (xaml/code) updated.
0 commit comments