File tree Expand file tree Collapse file tree 4 files changed +49
-3
lines changed
source/examples/generated/dotnet Expand file tree Collapse file tree 4 files changed +49
-3
lines changed Original file line number Diff line number Diff line change 1
- using Realms ;
1
+ using System ;
2
+ using Microsoft . VisualBasic ;
3
+ using NUnit . Framework ;
4
+ using NUnit . Framework . Internal ;
5
+ using Realms ;
2
6
using Realms . Sync ;
3
7
4
8
namespace Examples
5
9
{
6
10
public class DataSyncExamples
7
11
{
8
12
Realm realm ;
13
+ App app ;
14
+ Realms . Sync . User user ;
15
+ FlexibleSyncConfiguration config ;
9
16
10
- public void TestsCustomSetter ( )
17
+ [ OneTimeSetUp ]
18
+ public void Setup ( )
19
+ {
20
+
21
+ const string myRealmAppId = Config . FSAppId ;
22
+ app = App . Create ( myRealmAppId ) ;
23
+ user = app . LogInAsync (
24
+ Credentials . Anonymous ( ) ) . Result ;
25
+
26
+ config = new FlexibleSyncConfiguration ( user )
27
+ ;
28
+ }
29
+
30
+ [ Test ]
31
+ public void StartStopSession ( )
11
32
{
12
- realm = Realm . GetInstance ( ) ;
13
33
// :snippet-start: pause-synced-realm
34
+ realm = Realm . GetInstance ( config ) ;
14
35
var session = realm . SyncSession ;
15
36
session . Stop ( ) ;
16
37
//later...
17
38
session . Start ( ) ;
18
39
// :snippet-end:
19
40
}
41
+
42
+ [ Test ]
43
+ public void GetSessionAndState ( ) {
44
+ // :snippet-start: get-sync-session
45
+ realm = Realm . GetInstance ( config ) ;
46
+ var session = realm . SyncSession ;
47
+ // :snippet-end:
48
+ // :snippet-start: get-session-state
49
+ var sessionState = session . State ;
50
+ if ( sessionState == SessionState . Active ) {
51
+ Console . WriteLine ( "The session is active" ) ;
52
+ } else {
53
+ Console . WriteLine ( "The session is inactive" ) ;
54
+ }
55
+ // :snippet-end:
56
+ }
20
57
}
21
58
}
Original file line number Diff line number Diff line change
1
+ var sessionState = session . State ;
2
+ if ( sessionState == SessionState . Active ) {
3
+ Console . WriteLine ( "The session is active" ) ;
4
+ } else {
5
+ Console . WriteLine ( "The session is inactive" ) ;
6
+ }
Original file line number Diff line number Diff line change
1
+ realm = Realm . GetInstance ( config ) ;
2
+ var session = realm . SyncSession ;
Original file line number Diff line number Diff line change
1
+ realm = Realm . GetInstance ( config ) ;
1
2
var session = realm . SyncSession ;
2
3
session . Stop ( ) ;
3
4
//later...
You can’t perform that action at this time.
0 commit comments