1

我在工作中被分配了一项任务,作为实习生,一切都是新的哈哈。我被要求做以下事情:

//To test this you will need to update the code CoreModuleDesktop.cs.
this.NavManager.RegisterCommonActionItem("History Audit Log", "AuditLog", 110,
                    new BitmapImage(new Uri("pack://application:,,,/Core;component/Resources/maintenance.png")),
                    new Action(() => _regionManager.RequestNavigate(RegionNames.MainRegion, typeof(Views.HistoryAuditLogView).FullName)));

//The part inside the action will need to be changed to look something like this 
//where you specify the parameters.  Then you can pull them out OnNavigateTo method
//like in the ServiceOrderMaintenanceViewModel.  For this step just pass in the 
//Table and Key ID, leave the connection string hard coded.

IRegionManager regionManager = AllianceApp.Container.GetExportedValue<IRegionManager>();
UriQuery query = new UriQuery();

query.Add("AccountID", accountID.ToString());
query.Add("ServiceOrderID", serviceOrderID.ToString());

regionManager.RequestNavigate(RegionNames.MainRegion, new Uri(typeof(ServiceOrderMaintenanceView).FullName + query.ToString(), UriKind.Relative));

它们在 Action 内部的部分是什么意思?以及提供的查询到底是如何工作的。任何帮助,将不胜感激!

4

1 回答 1

1

“行动内部”是<here>

new Action(() => <here> );

为了在其中放置多行,Action您需要使用花括号定义一个块{}

new Action(() => 
    {
        // this is
        // a couple of lines
        // of code to modify
    });

希望这可以帮助您入门。有关ActionC# 工作原理的一些背景信息,请参阅 msdn 文档

于 2013-03-01T16:01:45.807 回答