File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 113113 Margin =" 0,16,0,0"
114114 ColumnSpacing =" 8" >
115115
116- <StackPanel Orientation =" Horizontal"
116+ <StackPanel x : Name =" ButtonPanel"
117+ x : Load =" {x:Bind renderer:ToolkitDocumentationRenderer.IsProjectPathValid()}"
118+ Orientation =" Horizontal"
117119 Spacing =" 8" >
118120 <Button Visibility =" {x:Bind renderer:ToolkitDocumentationRenderer.IsIdValid(Metadata.DiscussionId), Mode=OneWay}" >
119121 <StackPanel Orientation =" Horizontal" >
Original file line number Diff line number Diff line change 1515#endif
1616#endif
1717
18+ #nullable enable
19+
1820namespace CommunityToolkit . Labs . Shared . Renderers ;
1921
2022/// <summary>
@@ -34,8 +36,6 @@ public ToolkitDocumentationRenderer()
3436 ProjectUrl = Assembly . GetExecutingAssembly ( ) ? . GetCustomAttribute < CommunityToolkit . Attributes . PackageProjectUrlAttribute > ( ) ? . PackageProjectUrl ;
3537 }
3638
37- // TODO: If ProjectUrl is null should we log an error?
38-
3939 this . InitializeComponent ( ) ;
4040 }
4141
@@ -223,11 +223,13 @@ private async void MarkdownTextBlock_LinkClicked(object sender, LinkClickedEvent
223223 }
224224#endif
225225
226- public static Uri ToGitHubUri ( string path , int id ) => new Uri ( $ "{ ProjectUrl } /{ path } /{ id } ") ;
226+ public static Uri ? ToGitHubUri ( string path , int id ) => IsProjectPathValid ( ) ? new Uri ( $ "{ ProjectUrl } /{ path } /{ id } ") : null ;
227227
228228 public static Visibility IsIdValid ( int id ) => id switch
229229 {
230230 <= 0 => Visibility . Collapsed ,
231231 _ => Visibility . Visible ,
232232 } ;
233+
234+ public static bool IsProjectPathValid ( ) => ! string . IsNullOrWhiteSpace ( ProjectUrl ) ;
233235}
Original file line number Diff line number Diff line change 113113 <_Parameter1 >CommitHash</_Parameter1 >
114114 <_Parameter2 >$(SourceRevisionId)</_Parameter2 >
115115 </AssemblyAttributes >
116- <AssemblyAttributes Include =" CommunityToolkit.Attributes.PackageProjectUrlAttribute" >
116+ <AssemblyAttributes Include =" CommunityToolkit.Attributes.PackageProjectUrlAttribute" Condition = " '$(PackageProjectUrl)' != '' " >
117117 <_Parameter1 >$(PackageProjectUrl)</_Parameter1 >
118118 </AssemblyAttributes >
119+ <Warning Text =" The PackageProjectUrl property was not set." Condition =" '$(PackageProjectUrl)' == ''" />
119120 </ItemGroup >
120121
121122 <!-- Extra attributes specific to platforms -->
You can’t perform that action at this time.
0 commit comments