摘录一下MVVM相关

1 http://www.codeproject.com/Articles/42548/MVVM-and-the-WPF-DataGrid

http://www.codeproject.com/Articles/36745/Showing-Dialogs-When-Using-the-MVVM-Pattern


2,http://stackoverflow.com/questions/4862709/mvvm-separation-of-data-access-from-viewmodel

ContactListModel.cs

public class ContactListModel//: INotifyPropertyChanged
{
    public int ContactListID { get; set; }
    public string ContactListName { get; set; }
    public ObservableCollection<AggregatedLabelModel> AggLabels { get; set; }
}

InformationViewModel.cs

public class InformationViewModel
{
    public InformationViewModel()
    {
        GetData();
    }

    private ObservableCollection<ContactListModel> myContactLists;

    public IEnumerable<ContactListModel> ContactLists
    {
        get { return myContactLists; }
    }


    public void GetData()
    {

        myContactLists = new ObservableCollection<ContactListModel>();

        DB2Connection conn = null;
        try
        {
            conn = new DB2Connection("SERVER CONNECTION;");
        }
        catch (Exception ex)
        {
            System.Windows.MessageBox.Show(ex.Message + " " + ex.InnerException);
        }

        //get all contactLists and their labels
        DB2Command command = new DB2Command("SELECT QUERY");
        command.Connection = conn;

        conn.Open();

        //Add unique contactLists to dictionary
        Dictionary<int, ContactListModel> myContactDictionary = new Dictionary<int, ContactListModel>();

        using (DB2DataReader dr = command.ExecuteReader())
        {
            while (dr.Read())
            {
                int id = Convert.ToInt32(dr["CONTACT_LIST_ID"]);

                if (!myContactDictionary.ContainsKey(id))
                {

                    ContactListModel contactList = new ContactListModel();

                    contactList.ContactListID = id;
                    contactList.ContactListName = dr["CONTACT_LIST_NAME"].ToString();
                    contactList.AggLabels = new ObservableCollection<AggregatedLabelModel>()
                {
                    new AggregatedLabelModel()
                    {
                        ID = Convert.ToInt32(dr["LABEL_ID"]),
                        Name = dr["LABEL_NAME"].ToString()
                    }

                };
                    myContactDictionary.Add(id, contactList);
                }
                else
                {
                    //populate existing contact lists with remaining labels
                    ContactListModel contactList = myContactDictionary[id];

                    contactList.AggLabels.Add
                    (
                        new AggregatedLabelModel()
                        {
                            ID = Convert.ToInt32(dr["LABEL_ID"]),
                            Name = dr["LABEL_NAME"].ToString()
                        }
                    );
                }
            }
        }
        conn.Close();
}

A rough mock up, you can add SaveContact and DeleteContact methods to the DataLayer class.

    public class DataLayer
    {
        public ObservableCollection<ContactModel> GetContacts()
        {
            var tList = new ObservableCollection<ContactModel>();

            //load from db into tList

            return tList;
        }
    }

    public class ContactModel
    {
        public int ContactListID { get; set; }
        public string ContactListName { get; set; }
        public ObservableCollection<AggregatedLabelModel> AggLabels { get; set; }
    }

    public class ContactsViewModel
    {
        public ObservableCollection<ContactModel> ListOfContacts;

        public ContactsViewModel()
        {
            var dl = new DataLayer();
            ListOfContacts = dl.GetContacts();
        }
    }

3,

class MyViewModel
{
   public MyViewModel(MyModel model)
   {
      this.Name = model.Name;
      this.Colour = model.Colour;
   }

   public string Name {get;set;}
   public string Colour {get;set;}

   // commands here that connect to the following methods

   public void Save()
   {
      model.Name = this.Name;
      model.Colour = this.Colour;
      model.SaveToDatabase();
   }

   public void Cancel()
   {
      this.Name = model.Name;
      this.Colour = model.Colour;
   }

}

内容概要:本文详细介绍了文生视频大模型及AI人应用方案的设计与实现。文章首先阐述了文生视频大模型的技术基础,包括深度生成模型、自然语言处理(NLP)和计算机视觉(CV)的深度融合,以及相关技术的发展趋势。接着,文章深入分析了需求,包括用户需求、市场现状和技术需求,明确了高效性、个性化和成本控制等关键点。系统架构设计部分涵盖了数据层、模型层、服务层和应用层的分层架构,确保系统的可扩展性和高效性。在关键技术实现方面,文章详细描述了文本解析与理解、视频生成技术、AI人交互技术和实时处理与反馈机制。此外,还探讨了数据管理与安全、系统测试与验证、部署与维护等重要环节。最后,文章展示了文生视频大模型在教育、娱乐和商业领域的应用场景,并对其未来的技术改进方向和市场前景进行了展望。 适用人群:具备一定技术背景的研发人员、产品经理、数据科学家以及对AI视频生成技术感兴趣的从业者。 使用场景及目标:①帮助研发人员理解文生视频大模型的技术实现和应用场景;②指导产品经理在实际项目中应用文生视频大模型;③为数据科学家提供技术优化和模型改进的思路;④让从业者了解AI视频生成技术的市场潜力和发展趋势。 阅读建议:本文内容详尽,涉及多个技术细节和应用场景,建议读者结合自身的专业背景和技术需求,重点阅读与自己工作相关的章节,并结合实际项目进行实践和验证。
内容概要:《智慧教育应用发展研究报告(2025年)》由中国信息通信研究院发布,全面梳理了全球及我国智慧教育的发展现状和趋势。报告指出,智慧教育通过多种数字技术促进教育模式、管理模式和资源生成等方面的变革。国外经济体如欧盟、美国、韩国和日本纷纷通过顶层设计推动智慧教育发展,而我国则通过政策支持、基础设施建设、技术融合等多方面努力,推动智慧教育进入“快车道”。智慧教育应用场景分为智慧校园和校外教育两类,涵盖教学、考试、评价、管理和服务等多个方面。报告还详细分析了支撑智慧教育发展的技术、产业、基础设施和安全能力的发展趋势,并指出了当前面临的挑战及建议。 适用人群:教育领域的政策制定者、教育管理者、教育技术从业者、研究人员和关心教育发展的社会各界人士。 使用场景及目标:①了解全球及我国智慧教育的最新进展和趋势;②为政策制定者提供决策参考;③为教育管理者和技术从业者提供实施智慧教育的具体指导;④促进教育技术的研发和应用。 其他说明:报告强调了智慧教育在促进教育公平、提升教育质量、推动教育模式创新等方面的重要性,并呼吁加强跨领域协同攻关、缩小教育数字化差距、强化网络信息安全和提升教师数字素养,以应对当前面临的挑战。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值