Beispiel #1
0
 private static void ReadMerchandiseStruct(BinaryReader br, Header h, ViewModel vm)
 {
     MerchandiseStruct[] ms = new MerchandiseStruct[h.amount];
     for (int i = 0; i < h.amount; i++)
     {
         ms[i] = ReadStructData <MerchandiseStruct>(br, h);
     }
     AddMerchandiseStructToList(ms, vm);
 }
Beispiel #2
0
        private static void HandleMerchandiseModel(ObservableCollection <MerchandiseModel> merch)
        {
            MerchandiseStruct[] merchStruct = new MerchandiseStruct[merch.Count];
            for (int i = 0; i < merch.Count; i++)
            {
                merchStruct[i].Amount      = merch[i].Amount;
                merchStruct[i].ProductName = merch[i].ProductName;
                merchStruct[i].Supplier    = merch[i].Supplier;
            }

            Header h = new Header
            {
                Name   = typeof(MerchandiseStruct).Name,
                size   = Marshal.SizeOf(typeof(MerchandiseStruct)),
                amount = merch.Count
            };

            ObjectToByteArray(merchStruct, h);
        }