示例#1
0
        public UserDataView(Modele myModele, bool isChanging)
        {
            InitializeComponent();

            MyModele   = myModele;
            IsChanging = isChanging;
        }
        public MainView()
        {
            InitializeComponent();

            MyModele = new Modele();

            if (File.Exists("myModelData.xml"))
            {
                FileStream    fs = new FileStream("myModelData.xml", FileMode.Open);
                XmlSerializer xs = new XmlSerializer(typeof(Modele));
                MyModele = (Modele)xs.Deserialize(fs);
                fs.Close();
                timUpdate.Enabled = true;
            }
            else
            {
                UserDataView udView = new UserDataView(MyModele, true);
                udView.ShowDialog();
            }
        }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!File.Exists("myModelData.xml"))
            {
                MyModele.TauxAlcoolemie = 0;
                MyModele.DernierCalculTauxAlcoolemie = DateTime.Now;
            }
            MyModele.Username = tbxUsername.Text;
            MyModele.EstHomme = (cbxSexe.SelectedIndex == 0 ? true : false);
            MyModele.Poids    = (int)nudPoids.Value;


            MyModele.Serialize();
            FileStream    fs = new FileStream("myModelData.xml", FileMode.Open);
            XmlSerializer xs = new XmlSerializer(typeof(Modele));

            MyModele = (Modele)xs.Deserialize(fs);
            fs.Close();

            this.Close();
        }
        public DrinkDataView(Modele myModele)
        {
            InitializeComponent();

            MyModele = myModele;
        }