2013-03-01 2 views
1

직장에서 일을하고 인턴으로 모든 것이 새로운 하하입니다. 다음을 수행하도록 요청 받았습니다 :작업 및 UriQuery에 대한 이해

//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)); 

조치 내부의 부품을 의미하는 것은 무엇입니까? 그리고 세계에서 쿼리가 작동하도록 제공되는 방법은 무엇입니까? 어떤 도움을 주시면 감사하겠습니다!

+1

[UriQuery] (http://msdn.microsoft.com/en-us/library/gg431576(v=pandp.40) .aspx)는 [HTML 쿼리 문자열]을 생성하는 간단한 도우미 클래스입니다 (http : //en.wikipedia.org/wiki/Query_string). – Clemens

답변

1

"작업은 내부"<here>입니다 :

내부에 여러 줄을 넣어하기 위해
new Action(() => <here>); 

Action 당신은 중괄호 {}로 블록을 정의해야합니다 :이 당신을 도와줍니다

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

희망 시작하다. Action이 C#에서 어떻게 작동하는지에 대한 배경은 the msdn documentation입니다.

+0

감사합니다! 나는 이런 종류의 문법을 이해하지 못했다. – JLott