コード例 #1
0
        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()));
                }
            }
        }
コード例 #2
0
        public void changeNotificationMethod(string newMethod)
        {
            view.ShowDebugMessage(newMethod);
            switch (newMethod)
            {
            case "Wyślij email":
                notificiation = new NotificationEmail(log);
                break;

            default:
                notificiation = new NotificationNone();
                break;
            }
        }