小编ElM*_*dor的帖子

WPF MVVM - 如何检测View是否"脏"

我目前要求通知我的应用程序用户是否在View上更改/更新了任何字段.

例如,如果用户更改了视图上的日期字段,然后尝试关闭视图,则应用程序将显示一条消息,要求用户继续并丢失更改或取消,以便他们可以单击"保存"按钮.

问题是:如何检测View中的任何数据字段?

希望这是有道理的,比你提前,问候,

c# wpf mvvm

18
推荐指数
2
解决办法
2万
查看次数

使用TFS API返回新创建的TFS工作项ID?

使用TFS API,我可以创建一个TFS项,没问题.

什么是最好的方式让我知道新创建的项目的项目ID是什么?

谢谢,

乔治

        try
        {
            // Authenticate User Account
            NetworkCredential account = new NetworkCredential(USERNAME, PASSWORD, DOMAIN);
            // for user stories from the team project where the user story will be created.
            Uri collectionUri = new Uri(tfsURI);
            //TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(collectionUri);
            TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(collectionUri, account);
            WorkItemStore workItemStore = tpc.GetService<WorkItemStore>();
            Project teamProject = workItemStore.Projects[info.TFSProjectName];
            WorkItemType workItemType = teamProject.WorkItemTypes[info.ItemType];
            // Create the work item. 
            WorkItem userStory = new WorkItem(workItemType);
            userStory.Title = info.Title;
            userStory.Description = info.Description;
            userStory.AreaPath = info.AreaPath; …
Run Code Online (Sandbox Code Playgroud)

tfs2008 tfs-sdk c#-4.0

9
推荐指数
1
解决办法
5093
查看次数

如何实例化,操作和返回Type T.

我有一个函数,我想使用泛型返回CreditSupplementTradeline或CreditTradeline.问题是,如果我创建一个T ctl = new T(); ...我无法对ctl进行操作,因为VS2010无法识别其任何属性.可以这样做吗?谢谢.

    internal T GetCreditTradeLine<T>(XElement liability, string creditReportID) where T: new()
    {
        T ctl = new T();
        ctl.CreditorName = this.GetAttributeValue(liability.Element("_CREDITOR"), "_Name");
        ctl.CreditLiabilityID = this.GetAttributeValue(liability, "CreditLiabilityID");
        ctl.BorrowerID = this.GetAttributeValue(liability, "BorrowerID");
        return ctl;
    }
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

错误8'T'不包含'CreditorName'的定义,并且没有可以找到接受类型'T'的第一个参数的扩展方法'CreditorName'(您是否缺少using指令或程序集引用?)

c# generics

4
推荐指数
2
解决办法
143
查看次数

标签 统计

c# ×2

c#-4.0 ×1

generics ×1

mvvm ×1

tfs-sdk ×1

tfs2008 ×1

wpf ×1