Beispiel #1
0
        public void ProcessAnswer(string information)
        {
            dynamic jsonData = JsonConvert.DeserializeObject(information);

            if (jsonData.id == "session/start")
            {
                sessionID = (String)jsonData.data.sessionID;
                System.Diagnostics.Debug.WriteLine("sessionID: " + sessionID);
                getData = new Thread(GetData);
                getData.Start();
                Thread.Sleep(2000);
                simulation?.s.startSession();
            }
            if (jsonData.id == "session/end")
            {
                System.Diagnostics.Debug.WriteLine("Closing...");
                isConnected = false;
                close();
            }
            if (jsonData.id == "log in")
            {
                if (jsonData.data.status != "ok")
                {
                    new Thread(() => { MessageBox.Show("Username or password is incorrect"); }).Start();
                    close();
                }
                else
                {
                    ChatPanel panel = new ChatPanel();
                    Thread    t     = new Thread(() => panel.ShowDialog());
                    t.Start();
                    astrand = new Astrand(panel, this);
                }
            }
            if (jsonData.id == "client/message")
            {
                HandleNewMessageFromDoctor((string)jsonData.data.message);
            }
            if (jsonData.id == "client/SetPower")
            {
                SetPower((int)jsonData.data.power);
            }
            if (jsonData.id == "StartAstrand")
            {
                sessionID = (string)jsonData.data.sessionId;
                new Thread(StartAstrand).Start();
            }
        }
Beispiel #2
0
 public GebruikerGegevensAstrandForm(Astrand a)
 {
     InitializeComponent();
     this.astrand = a;
 }