Exemple #1
0
        static void Main()
        {
            Thread.Sleep(1000);
            jsonConnector = new JsonConnector();
            // client = new Client("145.48.6.10", 6666);
            string message  = "{ \"id\":\"session/list\"}";
            String sessieID = "";
            String status   = "";


            //get clientinfo for each session active
            //dynamic json = JsonConvert.DeserializeObject(client.SendAndReceive(message));
            //Newtonsoft.Json.Linq.JArray clientinfos = json.data;
            ////search for the session on this computer
            //foreach (dynamic client in clientinfos)
            //{
            //    if (client.clientinfo.user == Environment.UserName && client.clientinfo.host == Environment.MachineName)
            //    {
            //        sessieID = client.id;
            //    }
            //}


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new SimulatorGUI());
        }
Exemple #2
0
        public List<SystemsContract> getSystemData(object constarints = null)
        {
            JsonConnector<SystemsContract> connector = new JsonConnector<SystemsContract>();

            List<SystemsContract> systems = connector.loadData(_systemsPath, constarints);
            return systems;
        }
Exemple #3
0
        // Data access functions
        public List<StationsContract> getStationData(object constraints = null)
        {
            JsonConnector<StationsContract> connector = new JsonConnector<StationsContract>();

            List<StationsContract> stations = connector.loadData(_stationsPath, constraints);
            return stations;
        }
Exemple #4
0
        private async void AppBarButton_Click(object sender, RoutedEventArgs e)
        {
            progressRing.IsActive = true;

            AnswersObject result = await JsonConnector.GetPublicTimeline();

            progressRing.IsActive = false;

            timelineListView.DataContext = result;

            debugTextBlock.Text = "Loaded public timeline.";
        }
Exemple #5
0
        private async void action_RefreshTimeline(object sender, RoutedEventArgs e)
        {
            prgringLoading.IsActive = true;

            AnswersObject tl = await JsonConnector.GetPublicTimeline();

            prgringLoading.IsActive = false;

            timelineView.DataContext = tl;

            await DataLoader.SerializeAndSave <AnswersObject>(tl, "public_timeline.xml");

            debugTextBlock.Text = "Timeline loaded. (Count: " + tl.Count + ")";
        }
        /// <summary>
        /// This method manages the load process of the artists
        /// </summary>
        private void loadArtists()
        {
            this.jsonConnector = new JsonConnector(this.currentDirectoryData + "store.json");
            List <Artist> listOfArtists = this.jsonConnector.ListOfArtists();

            int counter = 0;

            if (listOfArtists != null)
            {
                foreach (Artist artist in listOfArtists)
                {
                    GenerateArtistGroupBox(artist.Name(), counter, artist.PictureName());
                    counter++;
                }
            }
        }
 /// <summary>
 /// The constructor of HandleAClient
 /// </summary>
 /// <param name="client">The standard TCP client of C#</param>
 /// <param name="clients">A Dictionary which holds all of the clients together and the key is the machinename</param>
 public HandleClient(TcpClient client, Dictionary <string, HandleClient> clients, List <Patient> patients)
 {
     this.Client = client;
     if (clientList == null)
     {
         this.clientList = clients;
     }
     else
     {
         this.clientList.Concat(clients);
     }
     this.patients       = patients;
     this.jsonConnector  = new JsonConnector();
     this.dataSaved      = true;
     this.sessionStarted = false;
 }
        public SimulatorGUI()
        {
            client        = Program.client;
            jsonConnector = Program.jsonConnector;
            dest          = Program.dest;
            InitializeComponent();

            //Tunnelid is een json en daaruit moet de id nog uit gehaald worden
            //Console.WriteLine(dest);

            String[] ArrayComPortsNames = null;
            int      index       = -1;
            String   ComPortName = null;

            ArrayComPortsNames = SerialPort.GetPortNames();
            do
            {
                if (ArrayComPortsNames.Length == 0)
                {
                    break;
                }
                index += 1;
                cmbPorts.Items.Add(ArrayComPortsNames[index]);
            }while (!((ArrayComPortsNames[index] == ComPortName) ||
                      (index == ArrayComPortsNames.GetUpperBound(0))));

            Array.Sort(ArrayComPortsNames);
            cmbPorts.Items.Add("Simulator");
            cmbPorts.SelectedIndex = 0;

            timer1          = new System.Windows.Forms.Timer();
            timer1.Tick    += new EventHandler(Timer1_Tick);
            timer1.Interval = 1000; // in miliseconds
            timer1.Start();

            //Make the clientSide for the Bike

            cb = new BikeClient.ClientBike();
            cb.ServerConnect();
            cb.SendAdd();
        }
Exemple #9
0
 public ExerciseConnection(NetworkStream bikeStream, NetworkStream doctorStream)
 {
     this.jc           = new JsonConnector();
     this.BikeStream   = bikeStream;
     this.DoctorStream = doctorStream;
 }