Пример #1
0
        // This initializes the server with fake data so that views are not empty when loaded.
        // This assumes that the current user is connected to the system.
        public static void Init()
        {
            if (_initializedFakeData)
            {
                return;
            }

            Client.Register(BuildAuthenticationMessage(), session =>
            {
                _user1Session = session;
                Client.Connect(_user1Session, c =>
                {
                    SetupUser1();
                    Client.Disconnect();

                    Client.Register(BuildAuthenticationMessage(), session2 =>
                    {
                        _user2Session = session2;
                        Client.Connect(_user2Session, c2 =>
                        {
                            SetupUser2();
                            Client.Disconnect();

                            Client.Register(BuildAuthenticationMessage(), session3 =>
                            {
                                _user3Session = session3;
                                Client.Connect(_user3Session, c3 =>
                                {
                                    SetupUser3();
                                    Client.Disconnect();

                                    SetupMainUser();
                                    _initializedFakeData = true;
                                });
                            }, ErrorHandler);
                        });
                    }, ErrorHandler);
                });
            }, ErrorHandler);
        }
Пример #2
0
 private void btnDisconnect_Click(object sender, EventArgs e)
 {
     Nclient.Disconnect();
     Application.Exit();
 }