private void btn_envoyer_Click(object sender, RoutedEventArgs e) { infoTrain = new InfoTrain(); infoTrain.ligne = cmb_ligne.Text; infoTrain.id_train = Int32.Parse(txt_id_train.Text); //infoTrain.horaire = (DateTime) date_picker.SelectedDate; infoTrain.direction = txt_direction.Text; infoTrain.voie = txt_voie.Text; infoTrain.info = txt_info.Text; string msg = SerialisationTool.serialiser(infoTrain); publisher.sendMsg(msg); }
private void Listner_eventMsg(ActivMQListner l, ITextMessage msg) { Console.WriteLine(msg.Text); string path = Directory.GetCurrentDirectory(); infoTrain = SerialisationTool.deserialiser(msg.Text); Dispatcher.Invoke(() => { this.uc_1.info = infoTrain.info; //this.uc_1.lbl_horaire_ligne.Content = infoTrain.horaire.ToString(); this.uc_1.lbl_id_ligne.Content = infoTrain.id_train; this.uc_1.lbl_direction.Content = infoTrain.direction; this.uc_1.lbl_voie.Content = infoTrain.voie; this.uc_1.img_ligne.Source = new BitmapImage(new Uri(path + @"\images\ligne" + infoTrain.ligne + ".png")); }); }
public MyViewModel() { ListeTrainSNCF = new ObservableCollection <InfoTrain>(); List <string> li = new List <string> { "Marseill", "Lyon", "Fosses" }; foreach (var n in li) { this.b = n; } TrainSelectionnee = new InfoTrain() { direction = "Fosses", voie = "A", horaire = DateTime.Now.ToString("hh:mm"), ligne = "25", info = b }; ListeTrainSNCF.Add(TrainSelectionnee); }
public MyViewModel(InfoTrain mod) { this.infoTrain = mod; }
public static InfoTrain deserialiser(string json) { InfoTrain infoTrain = JsonConvert.DeserializeObject <InfoTrain>(json); return(infoTrain); }
public static string serialiser(InfoTrain infoTrain) { string json = JsonConvert.SerializeObject(infoTrain, Formatting.Indented); return(json); }