@@ -589,11 +589,13 @@ private List<OnlineTemplateItem> ParseTemplatesFromJson(string json)
589589
590590 // Parse individual fields
591591 var tarballUrl = ExtractNestedJsonString ( nodeJson , "\" tarball\" " , "\" url\" " ) ;
592+ var rawDescription = ExtractJsonString ( nodeJson , "\" description\" " ) ;
593+ var splitDescription = SplitDescriptionIntoThree ( rawDescription ) ;
592594
593595 var template = new OnlineTemplateItem
594596 {
595597 Name = ExtractJsonString ( nodeJson , "\" name\" " ) ,
596- Description = ExtractJsonString ( nodeJson , " \" description \" " ) ,
598+ Description = splitDescription ,
597599 Type = ExtractJsonString ( nodeJson , "\" type\" " ) ,
598600 RenderPipeline = ExtractJsonString ( nodeJson , "\" renderPipeline\" " ) ,
599601 PreviewImageURL = ExtractNestedJsonString ( nodeJson , "\" previewImage\" " , "\" url\" " ) ?? "pack://application:,,,/Images/icon.png" ,
@@ -630,6 +632,25 @@ private List<OnlineTemplateItem> ParseTemplatesFromJson(string json)
630632
631633 return templates ;
632634 }
635+
636+ private string SplitDescriptionIntoThree ( string description )
637+ {
638+ if ( string . IsNullOrEmpty ( description ) ) return description ;
639+
640+ int len = description . Length ;
641+ if ( len <= 2 ) return description ; // too short to split meaningfully
642+
643+ int firstCut = ( len / 3 ) ;
644+ int secondCut = ( len * 2 ) / 3 ;
645+
646+ // Raw split strictly by length/3 as requested
647+ string part1 = description . Substring ( 0 , firstCut ) . Trim ( ) ;
648+ string part2 = description . Substring ( firstCut , secondCut - firstCut ) . Trim ( ) ;
649+ string part3 = description . Substring ( secondCut ) . Trim ( ) ;
650+
651+ return part1 + Environment . NewLine + part2 + Environment . NewLine + part3 ;
652+ }
653+
633654 private string ExtractJsonString ( string json , string key )
634655 {
635656 int keyIndex = json . IndexOf ( key + ":" ) ;
@@ -742,6 +763,10 @@ private void listOnlineTemplates_SelectionChanged(object sender, SelectionChange
742763 // Disable built-in template dropdown when online template is selected
743764 cmbNewProjectTemplate . IsEnabled = false ;
744765 cmbNewProjectTemplate . SelectedIndex = 0 ; // Reset to default
766+
767+ // disable create button if template not downloaded yet
768+ btnCreateNewProject . IsEnabled = selectedTemplate . IsDownloaded ;
769+ btnCreateNewProject . Content = selectedTemplate . IsDownloaded ? "Create Project" : "Download Template First >" ;
745770 }
746771 else
747772 {
@@ -750,8 +775,13 @@ private void listOnlineTemplates_SelectionChanged(object sender, SelectionChange
750775
751776 // Re-enable built-in template dropdown when no online template is selected
752777 cmbNewProjectTemplate . IsEnabled = true ;
778+
779+ // enable create button
780+ btnCreateNewProject . IsEnabled = true ;
781+ btnCreateNewProject . Content = "Create Project" ;
753782 }
754783 }
784+
755785 private async void btnDownloadTemplate_Click ( object sender , RoutedEventArgs e )
756786 {
757787 var button = sender as Button ;
0 commit comments