@@ -320,6 +320,7 @@ private void Routine_NewComponent()
320320 txtControlName . Clear ( ) ;
321321 txtControlDisplayName . Clear ( ) ;
322322 txtControlDescription . Clear ( ) ;
323+ cboxControlType . SelectedIndex = - 1 ;
323324 cboxTemplate . SelectedIndex = - 1 ;
324325 cboxAdditionalPackages . SelectedIndex = - 1 ;
325326 txtComponentVersion . Clear ( ) ;
@@ -335,6 +336,7 @@ private void Routine_NewComponent()
335336 txtNamespace . Enabled = true ;
336337 txtControlDisplayName . Enabled = true ;
337338 txtControlDescription . Enabled = true ;
339+ cboxControlType . Enabled = true ;
338340 cboxTemplate . Enabled = true ;
339341 cboxAdditionalPackages . Enabled = true ;
340342 txtSolutionName . Enabled = true ;
@@ -368,6 +370,7 @@ private void Routine_EditComponent()
368370 {
369371 txtControlName . Enabled = false ;
370372 txtNamespace . Enabled = false ;
373+ cboxControlType . Enabled = false ;
371374 cboxTemplate . Enabled = false ;
372375 cboxAdditionalPackages . Enabled = false ;
373376 btnCreateComponent . Enabled = false ;
@@ -522,9 +525,11 @@ private void IdentifyControlDetails()
522525
523526 ControlDetails = ControlManifest . GetControlManifestDetails ( txtWorkingFolder . Text ) ;
524527
525- _mainPluginLocalWorker = new BackgroundWorker ( ) ;
526- _mainPluginLocalWorker . DoWork += IdentifyAdditionalPackage ;
527- _mainPluginLocalWorker . RunWorkerAsync ( ) ;
528+ //_mainPluginLocalWorker = new BackgroundWorker();
529+ //_mainPluginLocalWorker.DoWork += IdentifyAdditionalPackage;
530+ //_mainPluginLocalWorker.RunWorkerAsync();
531+
532+ IdentifyAdditionalPackage_New ( ) ;
528533
529534 if ( ! string . IsNullOrEmpty ( ControlDetails . ControlName ) )
530535 {
@@ -575,6 +580,23 @@ private void IdentifyAdditionalPackage(object worker, DoWorkEventArgs args)
575580 }
576581 }
577582
583+ private void IdentifyAdditionalPackage_New ( )
584+ {
585+ // Identify additional package installs - for now only check for Fluent UI
586+ var packageName = Enum . AdditionalPackages ( ) . FirstOrDefault ( p => p . Value == "Fluent UI" ) . Key ;
587+ string [ ] addPkgCommands = new string [ ] { Commands . Npm . CheckAdditionalPackage ( packageName ) } ;
588+ var addPkgOutput = CommandLineHelper . RunCommand ( addPkgCommands ) ;
589+
590+ // scrub data
591+ addPkgOutput = addPkgOutput . Substring ( addPkgOutput . IndexOf ( addPkgCommands [ 0 ] ) + addPkgCommands [ 0 ] . Length ) ;
592+
593+ if ( addPkgOutput . ToLower ( ) . Contains ( packageName . ToLower ( ) ) )
594+ {
595+ cboxAdditionalPackages . SelectedIndex = 1 ;
596+ ControlDetails . AdditionalPackageIndex = 1 ;
597+ }
598+ }
599+
578600 private void IdentifySolutionDetails ( bool suppressErrors = false )
579601 {
580602 DataverseSolutionDetails = new SolutionDetails ( ) ;
@@ -714,6 +736,7 @@ private void PopulateControlDetails()
714736 txtControlDescription . Text = ControlDetails . ControlDescription ;
715737 txtComponentVersion . Text = ControlDetails . Version ;
716738
739+ cboxControlType . SelectedIndex = ControlDetails . IsVirtual ? 1 : 0 ;
717740 cboxTemplate . SelectedIndex = ControlDetails . IsDatasetTemplate ? 1 : 0 ;
718741
719742 if ( ! string . IsNullOrEmpty ( ControlDetails . PreviewImagePath ) )
@@ -1983,14 +2006,24 @@ private void BtnCreateComponent_Click(object sender, EventArgs e)
19832006 }
19842007
19852008 ReloadDetails = true ;
1986- if ( string . IsNullOrEmpty ( additionalPackage ) )
2009+ if ( ( string ) cboxControlType . SelectedItem == "Virtual" )
19872010 {
1988- RunCommandLine ( cdWorkingDir , pacCommand , npmCommand ) ;
2011+ string pacCommandVirtual = Commands . Pac . PcfInitVirtual ( txtNamespace . Text , txtControlName . Text , cboxTemplate . SelectedItem . ToString ( ) ) ;
2012+ RunCommandLine ( cdWorkingDir , pacCommandVirtual , npmCommand ) ;
2013+
19892014 }
19902015 else
19912016 {
1992- RunCommandLine ( cdWorkingDir , pacCommand , npmCommand , additionalPackage ) ;
2017+ if ( string . IsNullOrEmpty ( additionalPackage ) )
2018+ {
2019+ RunCommandLine ( cdWorkingDir , pacCommand , npmCommand ) ;
2020+ }
2021+ else
2022+ {
2023+ RunCommandLine ( cdWorkingDir , pacCommand , npmCommand , additionalPackage ) ;
2024+ }
19932025 }
2026+
19942027
19952028 // Create VS Code Workspace file
19962029
@@ -2631,6 +2664,15 @@ private void btnManageFeatures_Click(object sender, EventArgs e)
26312664 }
26322665 }
26332666
2667+ private void cboxControlType_SelectedIndexChanged ( object sender , EventArgs e )
2668+ {
2669+ if ( ( string ) cboxControlType . SelectedItem == "Virtual" )
2670+ {
2671+ cboxAdditionalPackages . SelectedIndex = 1 ;
2672+ cboxAdditionalPackages . Enabled = false ;
2673+ }
2674+ }
2675+
26342676 #endregion
26352677
26362678
0 commit comments