public ViewModel(View v) { view = v; model = new DataModel(); action = new ActionNone(); notificiation = new NotificationNone(); viewlayout = new ViewLayout(" ", " ", " ", true, false); view.changeView(viewlayout); list = new BindingList <Tuple <DataModel, Action, NotificationMethod> >(); view.addSourceToList(list); log = new Log("log.log"); using (var db = new ModelContext()) { var query = from b in db.Models orderby b.ModelId select b; view.ShowMessageBoxError("Qeuryset" + query.ToString(), "q"); foreach (var item in query) { view.ShowMessageBoxError("Qeuryset" + item.ImgURL, "q"); list.Add(new Tuple <DataModel, Action, NotificationMethod>(new DataModel(item.ImgURL, item.Description, item.address), new Action(), new NotificationMethod())); } } }
public void changeNotificationMethod(string newMethod) { view.ShowDebugMessage(newMethod); switch (newMethod) { case "Wyślij email": notificiation = new NotificationEmail(log); break; default: notificiation = new NotificationNone(); break; } }