1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| private: System::Void label2_Click_1(System::Object^ sender, System::EventArgs^ e) {
IEnumerator^ myEnum = this->_listeNote->GetEnumerator();
this->label3->Text = " ";
int nb =0;
noteSave ^ noteS = gcnew noteSave();
//String ^chaine;
while ( myEnum->MoveNext() )
{
note^ not = safe_cast<note^>(myEnum->Current);
this->label3->Text += " " + not->existe.ToString();
if (not->existe == false){
this->_listeNote->Remove(not);
this->tabNoteS->listeNoteS->Add(not);
}
}
myEnum = this->_listeNote->GetEnumerator();
while ( myEnum->MoveNext() )
{
note^ not = safe_cast<note^>(myEnum->Current);
noteS->B = not->couleurnote.B;
noteS->G = not->couleurnote.G;
noteS->R= not->couleurnote.R;
noteS->heigth = not->Height;
noteS->width = not->Width;
noteS->locationX = not->Location.X;
noteS->locationY = not->Location.Y;
noteS->titre = not->titlenote;
noteS->texte = not->richTextBox1->Text;
this->tabNoteS->listeNoteS->Add(noteS);
}
System::String ^ chaine = "cool";
System::Xml::Serialization::XmlSerializer ^ sr;
try{
sr = gcnew System::Xml::Serialization::XmlSerializer(tabNoteSave::typeid);
chaine += " oui ";
}
catch (Exception ^ e)
{
System::String ^ message = e->InnerException->Message->ToString();
chaine += " non ";
}
System::IO::StreamWriter ^ writer2 = gcnew System::IO::StreamWriter("noteSave.xml");
try
{
sr->Serialize(writer2,this->tabNoteS );
chaine += " yeah ";
}
catch (Exception ^ e)
{
System::String ^ message = e->InnerException->Message->ToString();
chaine+= " " +message;
}
this->label3->Text = chaine;
} |
Partager