diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml index e71d0a7..6e23dbb 100644 --- a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml @@ -44,7 +44,7 @@ + FontSize="22" Foreground="#1157FA" FontWeight="SemiBold" SelectedIndex="2" SelectedValuePath="Version" Cursor="Hand" SelectionChanged="DotNetVersionComboBox_SelectionChanged"> @@ -57,12 +57,18 @@ - + + diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml.cs b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml.cs index f4c1e8a..3bcb728 100644 --- a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml.cs +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml.cs @@ -3,7 +3,7 @@ using OpenSilver.TemplateWizards.AppCustomizationWindow.Models; using OpenSilver.TemplateWizards.Shared; using OpenSilver.TemplateWizards.Utils; -using System; +using System.Collections.Generic; using System.Linq; using System.Windows; @@ -50,30 +50,15 @@ public MauiHybridPlatform MauiHybridPlatform { get { - MauiHybridPlatform platforms = MauiHybridPlatform.None; - - foreach (var platform in platformList.SelectedItems.OfType()) - { - switch (platform.Title.ToLower()) - { - case "ios": - platforms |= MauiHybridPlatform.iOS; - break; - case "android": - platforms |= MauiHybridPlatform.Android; - break; - case "windows": - platforms |= MauiHybridPlatform.Windows; - break; - case "macos": - platforms |= MauiHybridPlatform.Mac; - break; - default: - break; - } - } + return GetMauiHybridPlatforms(platformList.SelectedItems.OfType()); + } + } - return platforms; + public bool IsPhotinoSelected + { + get + { + return platformList.SelectedItems.OfType().Any(p => p.Tag?.ToString() == "linux"); } } @@ -97,40 +82,21 @@ public AppConfigurationWindow(EnvDTE.DTE dte = null, bool isBusiness = false) } } - private bool ValidateMaui() + private MauiHybridPlatform GetMauiHybridPlatforms(IEnumerable targetPlatforms) { - if (MauiHybridPlatform == MauiHybridPlatform.None) - { - return true; - } + MauiHybridPlatform platforms = MauiHybridPlatform.None; - if (_dte != null) + foreach (var tp in targetPlatforms) { - ThreadHelper.ThrowIfNotOnUIThread(); - } + object tagValue = tp.Tag; - try - { - if (_dte != null) + if (tagValue is MauiHybridPlatform platform) { - var serviceProvider = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); - - var checker = new MauiInstallationChecker(serviceProvider); - bool mauiInstalled = checker.IsMauiInstalled(); - - if (mauiInstalled) - { - return true; - } + platforms |= platform; } - - return new InstallMauiWindow().ShowDialog() == true; - } - catch (System.Exception ex) - { - MessageBox.Show($"Exception: {ex.Message}"); - return true; } + + return platforms; } private void ButtonContinue_Click(object sender, RoutedEventArgs e) @@ -147,7 +113,7 @@ private void ThemeCollectionView_SelectionChanged(object sender, ThemeOptions th private void PlatformList_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { - if (MauiHybridPlatform != MauiHybridPlatform.None && e.AddedItems.Count != 0 && !IsMauiInstalled) + if (GetMauiHybridPlatforms(e.AddedItems.OfType()) != MauiHybridPlatform.None && !IsMauiInstalled) { if (new InstallMauiWindow().ShowDialog() != true) { @@ -161,6 +127,27 @@ private void PlatformList_SelectionChanged(object sender, System.Windows.Control mauiTip.Visibility = MauiHybridPlatform == MauiHybridPlatform.None ? Visibility.Hidden : Visibility.Visible; } + private void DotNetVersionComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) + { + var isDotNet7 = DotNetVersion == DotNetVersion.Net7; + if (isDotNet7 && platformList != null) + { + var itemsToDeselect = platformList.SelectedItems + .Cast() + .Where(item => !Equals(item.Tag, "web")).ToList(); + + foreach (var item in itemsToDeselect) + { + platformList.SelectedItems.Remove(item); + } + } + + if (PlatformListDisabledOverlay != null) + { + PlatformListDisabledOverlay.Visibility = isDotNet7 ? Visibility.Visible : Visibility.Collapsed; + } + } + // https://github.com/dotnet/wpf/blob/090a5230cf6186fe576dbc1729c943b36cb5db71/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThemeManager.cs private static bool IsSystemThemeLight() { diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/Models/TargetPlatform.cs b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/Models/TargetPlatform.cs index 9b89826..a9f6a84 100644 --- a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/Models/TargetPlatform.cs +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/Models/TargetPlatform.cs @@ -7,5 +7,6 @@ public class TargetPlatform public string ThumbnailUri { get; set; } public double Opacity { get; set; } = 0.6; public bool IsAlwaysSelected { get; set; } + public object Tag { get; set; } } } diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/PlatformsView.xaml b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/PlatformsView.xaml index d01e0d6..9faaa7f 100644 --- a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/PlatformsView.xaml +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/PlatformsView.xaml @@ -4,6 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:models="clr-namespace:OpenSilver.TemplateWizards.AppCustomizationWindow.Models" + xmlns:shared="clr-namespace:OpenSilver.TemplateWizards.Shared" d:DesignHeight="150" d:DesignWidth="700" d:SelectedIndex="1" @@ -175,20 +176,26 @@ Framework="WebAssembly" IsAlwaysSelected="True" Opacity="1" - ThumbnailUri="/OpenSilver.TemplateWizards;component/Assets/Images/platform_web.png"/> + ThumbnailUri="/OpenSilver.TemplateWizards;component/Assets/Images/platform_web.png" + Tag="web"/> + ThumbnailUri="/OpenSilver.TemplateWizards;component/Assets/Images/platform_apple.png" + Tag="{x:Static shared:MauiHybridPlatform.iOS}"/> + ThumbnailUri="/OpenSilver.TemplateWizards;component/Assets/Images/platform_android.png" + Tag="{x:Static shared:MauiHybridPlatform.Android}"/> + ThumbnailUri="/OpenSilver.TemplateWizards;component/Assets/Images/platform_windows.png" + Tag="{x:Static shared:MauiHybridPlatform.Windows}"/> - + ThumbnailUri="/OpenSilver.TemplateWizards;component/Assets/Images/platform_linux.png" + Tag="linux"/> diff --git a/src/OpenSilver.TemplateWizards/OpenSilver.TemplateWizards.csproj b/src/OpenSilver.TemplateWizards/OpenSilver.TemplateWizards.csproj index 4449415..817706a 100644 --- a/src/OpenSilver.TemplateWizards/OpenSilver.TemplateWizards.csproj +++ b/src/OpenSilver.TemplateWizards/OpenSilver.TemplateWizards.csproj @@ -63,7 +63,7 @@ ThemeCollectionView.xaml - + @@ -72,6 +72,7 @@ + diff --git a/src/OpenSilver.TemplateWizards/Shared/GlobalConstants.cs b/src/OpenSilver.TemplateWizards/Shared/GlobalConstants.cs index 4fb9281..b49562d 100644 --- a/src/OpenSilver.TemplateWizards/Shared/GlobalConstants.cs +++ b/src/OpenSilver.TemplateWizards/Shared/GlobalConstants.cs @@ -17,5 +17,7 @@ public static class GlobalConstants public const string OpenRia46PackageVersion = "3.2.0"; public const string OpenSilverThemeModernPackageVersion = "3.2.*"; + + public const string OpenSilverPhotinoPackageVersion = "3.2.0"; } } diff --git a/src/OpenSilver.TemplateWizards/Utils/VisualStudioInstallationChecker.cs b/src/OpenSilver.TemplateWizards/Utils/VisualStudioInstallationChecker.cs deleted file mode 100644 index 8236f07..0000000 --- a/src/OpenSilver.TemplateWizards/Utils/VisualStudioInstallationChecker.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.VisualStudio.Setup.Configuration; -using System.Linq; - -namespace OpenSilver.TemplateWizards.Utils -{ - public class VisualStudioInstallationChecker - { - public bool IsMauiInstalled() - { - var query = new SetupConfiguration(); - var enumInstances = query.EnumAllInstances(); - - int fetched; - var instances = new ISetupInstance[1]; - - do - { - enumInstances.Next(1, instances, out fetched); - if (fetched > 0) - { - var instance2 = (ISetupInstance2)instances[0]; - var packages = instance2.GetPackages(); - - bool mauiInstalled = packages.Any(package => package.GetId().Contains("Microsoft.VisualStudio.Workload.NetCrossPlat")); - - if (mauiInstalled) - { - return true; - } - } - } - while (fetched > 0); - - return false; - } - } -} diff --git a/src/OpenSilver.TemplateWizards/Utils/WizardUtilities.cs b/src/OpenSilver.TemplateWizards/Utils/WizardUtilities.cs new file mode 100644 index 0000000..3c29781 --- /dev/null +++ b/src/OpenSilver.TemplateWizards/Utils/WizardUtilities.cs @@ -0,0 +1,87 @@ +using EnvDTE; +using EnvDTE80; +using Microsoft.VisualStudio.Shell; +using OpenSilver.TemplateWizards.Shared; +using System.Collections.Generic; + +namespace OpenSilver.TemplateWizards.Utils +{ + /// + /// Utility class providing common functionality for wizards + /// + public static class WizardUtilities + { + /// + /// Gets all projects within a given project, including those in solution folders + /// + /// The project to search + /// Enumeration of all projects + private static IEnumerable GetProjects(Project project) + { + ThreadHelper.ThrowIfNotOnUIThread(); + + // If this is a solution folder, it can contain other projects + if (project.Kind == ProjectKinds.vsProjectKindSolutionFolder) + { + foreach (ProjectItem projectItem in project.ProjectItems) + { + var subProject = projectItem.SubProject; + if (subProject != null) + { + foreach (var nested in GetProjects(subProject)) + { + yield return nested; + } + } + } + } + else + { + yield return project; + } + } + + /// + /// Gets all projects within a solution + /// + /// The solution to search + /// Enumeration of all projects in the solution + public static IEnumerable GetAllProjects(Solution2 solution) + { + ThreadHelper.ThrowIfNotOnUIThread(); + + foreach (Project topLevelProject in solution.Projects) + { + foreach (Project p in GetProjects(topLevelProject)) + { + yield return p; + } + } + } + + /// + /// Converts a DotNetVersion enum value to its corresponding target framework moniker string + /// + /// The .NET version to convert + /// The target framework moniker as a string (e.g., "net8.0") + public static string GetNetTarget(DotNetVersion netTarget) + { + if (netTarget == DotNetVersion.Net7) + { + return "net7.0"; + } + + if (netTarget == DotNetVersion.Net8) + { + return "net8.0"; + } + + if (netTarget == DotNetVersion.Net9) + { + return "net9.0"; + } + + return ""; + } + } +} diff --git a/src/OpenSilver.TemplateWizards/Wizards/AppCustomizationWizard.cs b/src/OpenSilver.TemplateWizards/Wizards/AppCustomizationWizard.cs index 6b087bf..64770a6 100644 --- a/src/OpenSilver.TemplateWizards/Wizards/AppCustomizationWizard.cs +++ b/src/OpenSilver.TemplateWizards/Wizards/AppCustomizationWizard.cs @@ -83,6 +83,7 @@ class AppCustomizationWizard : IWizard private DTE _dte; private MauiHybridPlatform _mauiHybridPlatform; + private bool _isPhotinoSelected; private DotNetVersion _dotNetVersion; private static string GetVsixFullPath(string filename) @@ -193,20 +194,8 @@ private string GetLoadingIndicatorHtml(ThemeOptions selectedTheme) return ModernLoadingAnimation; } - public void ProjectItemFinishedGenerating(ProjectItem projectItem) - { - - } - - public void RunFinished() + private void AddMauiHybrid() { - Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); - - if (_mauiHybridPlatform == MauiHybridPlatform.None) - { - return; - } - try { var projectName = _replacementsDictionary["$safeprojectname$"]; @@ -231,6 +220,51 @@ public void RunFinished() } } + private void AddPhotino() + { + try + { + var projectName = _replacementsDictionary["$safeprojectname$"]; + var destinationDirectory = _replacementsDictionary["$destinationdirectory$"]; + + var templateName = "OpenSilverPhotinoTemplate"; + var solution = (Solution2)_dte.Solution; + + var photinoProjectName = projectName + ".Photino"; + var photinoDestinationDirectory = Path.Combine(destinationDirectory, photinoProjectName); + + var sharedDataStore = GlobalWizardDataStore.GetSharedData(photinoDestinationDirectory); + sharedDataStore[WizardKeys.NetTarget] = _dotNetVersion; + + var prjTemplate = solution.GetProjectTemplate(templateName, "CSharp"); + solution.AddFromTemplate(prjTemplate, photinoDestinationDirectory, photinoProjectName); + } + catch (Exception ex) + { + MessageBox.Show($"{ex}"); + } + } + + public void ProjectItemFinishedGenerating(ProjectItem projectItem) + { + + } + + public void RunFinished() + { + Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); + + if (_mauiHybridPlatform != MauiHybridPlatform.None) + { + AddMauiHybrid(); + } + + if (_isPhotinoSelected) + { + AddPhotino(); + } + } + public void RunStarted(object automationObject, Dictionary replacementsDictionary, WizardRunKind runKind, object[] customParams) { @@ -275,6 +309,7 @@ public void RunStarted(object automationObject, Dictionary repla CopyNugetConfig(replacementsDictionary); _mauiHybridPlatform = window.MauiHybridPlatform; + _isPhotinoSelected = window.IsPhotinoSelected; _dotNetVersion = window.DotNetVersion; replacementsDictionary.Add("$opensilverpackageversion$", GlobalConstants.OpenSilverPackageVersion); diff --git a/src/OpenSilver.TemplateWizards/Wizards/MauiHybridProjectTemplateWizard.cs b/src/OpenSilver.TemplateWizards/Wizards/MauiHybridProjectTemplateWizard.cs index a473b65..73be025 100644 --- a/src/OpenSilver.TemplateWizards/Wizards/MauiHybridProjectTemplateWizard.cs +++ b/src/OpenSilver.TemplateWizards/Wizards/MauiHybridProjectTemplateWizard.cs @@ -6,49 +6,12 @@ using System.Linq; using EnvDTE80; using OpenSilver.TemplateWizards.Shared; -using OpenSilver.TemplateWizards.AppCustomizationWindow; +using OpenSilver.TemplateWizards.Utils; namespace OpenSilver.TemplateWizards.Wizards { class MauiHybridProjectTemplateWizard : IWizard { - private static IEnumerable GetProjects(Project project) - { - ThreadHelper.ThrowIfNotOnUIThread(); - - // If this is a solution folder, it can contain other projects - if (project.Kind == ProjectKinds.vsProjectKindSolutionFolder) - { - foreach (ProjectItem projectItem in project.ProjectItems) - { - var subProject = projectItem.SubProject; - if (subProject != null) - { - foreach (var nested in GetProjects(subProject)) - { - yield return nested; - } - } - } - } - else - { - yield return project; - } - } - - private static IEnumerable GetAllProjects(Solution2 solution) - { - ThreadHelper.ThrowIfNotOnUIThread(); - - foreach (Project topLevelProject in solution.Projects) - { - foreach (Project p in GetProjects(topLevelProject)) - { - yield return p; - } - } - } public void BeforeOpeningFile(ProjectItem projectItem) { @@ -74,7 +37,7 @@ public void RunStarted(object automationObject, Dictionary repla var _dte = automationObject as DTE; var solution = (Solution2)_dte.Solution; - var allProjects = GetAllProjects(solution); + var allProjects = WizardUtilities.GetAllProjects(solution); var rootProject = allProjects.FirstOrDefault(p => p.Name == rootProjectName); var rootProjectExtension = System.IO.Path.GetExtension(rootProject?.FullName ?? "stub.csproj"); @@ -104,33 +67,14 @@ private string GetWindowsTarget(DotNetVersion netTarget, MauiHybridPlatform mhp) { //Only windows //return $"{Environment.NewLine} {GetNetTarget(netTarget)}-windows10.0.19041.0"; - return $"{Environment.NewLine} {GetNetTarget(netTarget)}-windows10.0.19041.0"; + return $"{Environment.NewLine} {WizardUtilities.GetNetTarget(netTarget)}-windows10.0.19041.0"; } else { - return $"{Environment.NewLine} $(TargetFrameworks);{GetNetTarget(netTarget)}-windows10.0.19041.0"; + return $"{Environment.NewLine} $(TargetFrameworks);{WizardUtilities.GetNetTarget(netTarget)}-windows10.0.19041.0"; } } - private string GetNetTarget(DotNetVersion netTarget) - { - if (netTarget == DotNetVersion.Net7) - { - return "net7.0"; - } - - if (netTarget == DotNetVersion.Net8) - { - return "net8.0"; - } - - if (netTarget == DotNetVersion.Net9) - { - return "net9.0"; - } - - return ""; - } private string GetMauiPlatformsBasic(DotNetVersion netTarget, MauiHybridPlatform mhp) { if (mhp == MauiHybridPlatform.None || mhp == MauiHybridPlatform.Windows) @@ -138,7 +82,7 @@ private string GetMauiPlatformsBasic(DotNetVersion netTarget, MauiHybridPlatform return ""; } - var netVersion = GetNetTarget(netTarget); + var netVersion = WizardUtilities.GetNetTarget(netTarget); var targets = new List(); if ((mhp & MauiHybridPlatform.Android) == MauiHybridPlatform.Android) diff --git a/src/OpenSilver.TemplateWizards/Wizards/PhotinoProjectTemplateWizard.cs b/src/OpenSilver.TemplateWizards/Wizards/PhotinoProjectTemplateWizard.cs new file mode 100644 index 0000000..d7ae216 --- /dev/null +++ b/src/OpenSilver.TemplateWizards/Wizards/PhotinoProjectTemplateWizard.cs @@ -0,0 +1,58 @@ +using EnvDTE; +using EnvDTE80; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.TemplateWizard; +using OpenSilver.TemplateWizards.Shared; +using OpenSilver.TemplateWizards.Utils; +using System.Collections.Generic; +using System.Linq; + +namespace OpenSilver.TemplateWizards.Wizards +{ + class PhotinoProjectTemplateWizard : IWizard + { + public void BeforeOpeningFile(ProjectItem projectItem) + { + } + + public void ProjectFinishedGenerating(Project project) + { + } + + public void ProjectItemFinishedGenerating(ProjectItem projectItem) + { + } + + public void RunFinished() + { + } + + public void RunStarted(object automationObject, Dictionary replacementsDictionary, WizardRunKind runKind, object[] customParams) + { + ThreadHelper.ThrowIfNotOnUIThread(); + + var rootProjectName = replacementsDictionary["$safeprojectname$"].TrimSuffix(".Photino"); + + var _dte = automationObject as DTE; + var solution = (Solution2)_dte.Solution; + var allProjects = WizardUtilities.GetAllProjects(solution); + + var rootProject = allProjects.FirstOrDefault(p => p.Name == rootProjectName); + var rootProjectExtension = System.IO.Path.GetExtension(rootProject?.FullName ?? "stub.csproj"); + + replacementsDictionary.Add("$opensilverphotinopackageversion$", GlobalConstants.OpenSilverPhotinoPackageVersion); + replacementsDictionary.Add("$rootprojectname$", rootProjectName); + replacementsDictionary.Add("$rootprojectextension$", rootProjectExtension); + + var sharedDataStore = GlobalWizardDataStore.GetSharedData(replacementsDictionary["$destinationdirectory$"]); + var netTarget = (DotNetVersion)sharedDataStore[WizardKeys.NetTarget]; + + replacementsDictionary.Add("$targetframework$", WizardUtilities.GetNetTarget(netTarget)); + } + + public bool ShouldAddProjectItem(string filePath) + { + return true; + } + } +} diff --git a/src/OpenSilver.VSIX/OpenSilver.VSIX.csproj b/src/OpenSilver.VSIX/OpenSilver.VSIX.csproj index c473ca0..019d0f2 100644 --- a/src/OpenSilver.VSIX/OpenSilver.VSIX.csproj +++ b/src/OpenSilver.VSIX/OpenSilver.VSIX.csproj @@ -215,6 +215,13 @@ false TemplateProjectOutputGroup%3b + + {61E9303A-70BB-47DF-BB47-38507FA2EF06} + OpenSilverPhotinoTemplate + ProjectTemplates + false + TemplateProjectOutputGroup%3b + {229629ac-c4e0-4848-9cfa-31064c9d83a3} OpenSilverVBApplicationTemplate diff --git a/src/OpenSilver.VSIX/source.extension.vsixmanifest b/src/OpenSilver.VSIX/source.extension.vsixmanifest index 5d4e054..93aa82f 100644 --- a/src/OpenSilver.VSIX/source.extension.vsixmanifest +++ b/src/OpenSilver.VSIX/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + OpenSilver SDK Project templates and XAML Designer for creating OpenSilver applications. OpenSilver is a modern cross-platform reimplementation of WPF and Silverlight that enables .NET developers to build apps for web (WebAssembly), mobile and desktop (MAUI Hybrid) using C# and XAML. Logo_32x32.png @@ -60,5 +60,6 @@ + diff --git a/src/OpenSilver.XamlDesigner/OpenSilver.XamlDesigner.csproj b/src/OpenSilver.XamlDesigner/OpenSilver.XamlDesigner.csproj index b03cd8b..1ed7aa0 100644 --- a/src/OpenSilver.XamlDesigner/OpenSilver.XamlDesigner.csproj +++ b/src/OpenSilver.XamlDesigner/OpenSilver.XamlDesigner.csproj @@ -235,22 +235,22 @@ - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-18-090132-4b184e5e\lib\net47\Userware.XamlDesigner.Api.BL.Models.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-24-042713-abb1c1d6\lib\net47\Userware.XamlDesigner.Api.BL.Models.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-18-090132-4b184e5e\lib\net47\Userware.XamlDesigner.Api.Client.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-24-042713-abb1c1d6\lib\net47\Userware.XamlDesigner.Api.Client.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-18-090132-4b184e5e\lib\net47\Userware.XamlDesigner.Communication.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-24-042713-abb1c1d6\lib\net47\Userware.XamlDesigner.Communication.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-18-090132-4b184e5e\lib\net47\Userware.XamlDesigner.Data.Primitives.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-24-042713-abb1c1d6\lib\net47\Userware.XamlDesigner.Data.Primitives.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-18-090132-4b184e5e\lib\net47\Userware.XamlDesigner.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-24-042713-abb1c1d6\lib\net47\Userware.XamlDesigner.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-18-090132-4b184e5e\lib\net47\Userware.XamlDesigner.SplitXamlEditor.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2025-03-24-042713-abb1c1d6\lib\net47\Userware.XamlDesigner.SplitXamlEditor.OpenSilver.dll @@ -296,11 +296,11 @@ - + - + \ No newline at end of file diff --git a/src/OpenSilver.XamlDesigner/packages.config b/src/OpenSilver.XamlDesigner/packages.config index b72f142..e14f38a 100644 --- a/src/OpenSilver.XamlDesigner/packages.config +++ b/src/OpenSilver.XamlDesigner/packages.config @@ -63,5 +63,5 @@ - + \ No newline at end of file diff --git a/src/OpenSilverMauiHybridTemplate/Components/Index.cs b/src/OpenSilverMauiHybridTemplate/Components/Index.cs index 7893ab3..90a6d0f 100644 --- a/src/OpenSilverMauiHybridTemplate/Components/Index.cs +++ b/src/OpenSilverMauiHybridTemplate/Components/Index.cs @@ -14,7 +14,7 @@ protected async override Task OnInitializedAsync() await base.OnInitializedAsync(); ArgumentNullException.ThrowIfNull(Runner); - await Runner.RunApplicationAsync<$rootprojectname$.App >(); + await Runner.RunApplicationAsync<$rootprojectname$.App>(); } } } \ No newline at end of file diff --git a/src/OpenSilverPhotinoTemplate/OpenSilverPhotinoTemplate.csproj b/src/OpenSilverPhotinoTemplate/OpenSilverPhotinoTemplate.csproj new file mode 100644 index 0000000..dbdc8b8 --- /dev/null +++ b/src/OpenSilverPhotinoTemplate/OpenSilverPhotinoTemplate.csproj @@ -0,0 +1,83 @@ + + + + 17.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + Debug + AnyCPU + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {61E9303A-70BB-47DF-BB47-38507FA2EF06} + Library + Properties + OpenSilverPhotinoTemplate + OpenSilverPhotinoTemplate + v4.7.2 + 512 + false + false + false + false + false + false + false + false + false + false + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/OpenSilverPhotinoTemplate/OpenSilverPhotinoTemplate.ico b/src/OpenSilverPhotinoTemplate/OpenSilverPhotinoTemplate.ico new file mode 100644 index 0000000..aae70d3 Binary files /dev/null and b/src/OpenSilverPhotinoTemplate/OpenSilverPhotinoTemplate.ico differ diff --git a/src/OpenSilverPhotinoTemplate/OpenSilverPhotinoTemplate.vstemplate b/src/OpenSilverPhotinoTemplate/OpenSilverPhotinoTemplate.vstemplate new file mode 100644 index 0000000..795e5ce --- /dev/null +++ b/src/OpenSilverPhotinoTemplate/OpenSilverPhotinoTemplate.vstemplate @@ -0,0 +1,36 @@ + + + + OpenSilverPhotinoTemplate + OpenSilverPhotinoTemplate + OpenSilverPhotinoTemplate.ico + CSharp + csharp + 2.0 + 1000 + 6d3a50ec-857d-45e7-aa95-fac7c1823e92 + true + OpenSilverPhotinoTemplate + true + true + true + + + + + launchSettings.json + + + index.html + + Program.cs + app.ico + + + + OpenSilver.TemplateWizards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + OpenSilver.TemplateWizards.Wizards.PhotinoProjectTemplateWizard + + + + \ No newline at end of file diff --git a/src/OpenSilverPhotinoTemplate/Program.cs b/src/OpenSilverPhotinoTemplate/Program.cs new file mode 100644 index 0000000..1f5829a --- /dev/null +++ b/src/OpenSilverPhotinoTemplate/Program.cs @@ -0,0 +1,29 @@ +using OpenSilver.Photino; +using Photino.NET; + +namespace $safeprojectname$ +{ + //NOTE: To hide the console window, go to the project properties and change the Output Type to Windows Application. + // Or edit the .csproj file and change the tag from "WinExe" to "Exe". + internal class Program + { + [STAThread] + static void Main(string[] args) + { + // Window title declared here for visibility + string windowTitle = "$rootprojectname$"; + + // Creating a new PhotinoWindow instance with the fluent API + var window = new PhotinoWindow() + .SetTitle(windowTitle) + .SetUseOsDefaultSize(true) + .Center() // Center window in the middle of the screen + .SetResizable(false) // Users can resize windows by default. Let's make this one fixed instead. + .SetLogVerbosity(0) + .ConfigureOpenSilver() // Configure OpenSilver App + .Load("wwwroot/index.html"); // Can be used with relative path strings or "new URI()" instance to load a website. + + window.WaitForClose(); // Starts the application event loop + } + } +} diff --git a/src/OpenSilverPhotinoTemplate/ProjectTemplate.csproj b/src/OpenSilverPhotinoTemplate/ProjectTemplate.csproj new file mode 100644 index 0000000..8509b2e --- /dev/null +++ b/src/OpenSilverPhotinoTemplate/ProjectTemplate.csproj @@ -0,0 +1,47 @@ + + + + Exe + $targetframework$ + AnyCPU + enable + enable + + app.ico + + + true + + + true + true + + + true + + + false + false + + + embedded + + + + + Always + + + + + + + + + + + + \ No newline at end of file diff --git a/src/OpenSilverPhotinoTemplate/Properties/AssemblyInfo.cs b/src/OpenSilverPhotinoTemplate/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..18bc850 --- /dev/null +++ b/src/OpenSilverPhotinoTemplate/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSilverPhotinoTemplate")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Userware")] +[assembly: AssemblyProduct("OpenSilverPhotinoTemplate")] +[assembly: AssemblyCopyright("Copyright © Userware 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("61e9303a-70bb-47df-bb47-38507fa2ef06")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/OpenSilverPhotinoTemplate/Properties/launchSettings.json b/src/OpenSilverPhotinoTemplate/Properties/launchSettings.json new file mode 100644 index 0000000..cb316db --- /dev/null +++ b/src/OpenSilverPhotinoTemplate/Properties/launchSettings.json @@ -0,0 +1,7 @@ +{ + "profiles": { + "$rootprojectname$.Photino": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/src/OpenSilverPhotinoTemplate/app.ico b/src/OpenSilverPhotinoTemplate/app.ico new file mode 100644 index 0000000..4bd7430 Binary files /dev/null and b/src/OpenSilverPhotinoTemplate/app.ico differ diff --git a/src/OpenSilverPhotinoTemplate/wwwroot/index.html b/src/OpenSilverPhotinoTemplate/wwwroot/index.html new file mode 100644 index 0000000..fb3a5b7 --- /dev/null +++ b/src/OpenSilverPhotinoTemplate/wwwroot/index.html @@ -0,0 +1,14 @@ + + + + + + + + $rootprojectname$ + + +
+ + + diff --git a/src/TestWizard/App.xaml.cs b/src/TestWizard/App.xaml.cs index bab914f..a36a965 100644 --- a/src/TestWizard/App.xaml.cs +++ b/src/TestWizard/App.xaml.cs @@ -13,12 +13,23 @@ public App() MainWindow = new Window(); var configurationWindow = new AppConfigurationWindow(); - _ = configurationWindow.ShowDialog(); + var res = configurationWindow.ShowDialog(); var theme = configurationWindow.SelectedTheme; var dotNetVersion = configurationWindow.DotNetVersion; var mauiHybridPlatform = configurationWindow.MauiHybridPlatform; + var isPhotinoSelected = configurationWindow.IsPhotinoSelected; + if (res == true) + { + MessageBox.Show( + $"Theme: {configurationWindow.SelectedTheme}\n" + + $".NET Version: {configurationWindow.DotNetVersion}\n" + + $"MAUI Hybrid Platform: {configurationWindow.MauiHybridPlatform}\n" + + $"Is Photino Selected: {configurationWindow.IsPhotinoSelected}", + "Configuration Details", + MessageBoxButton.OK); + } MainWindow.Close(); } } diff --git a/src/VSExtension.OpenSilver.sln b/src/VSExtension.OpenSilver.sln index 9521791..748603f 100644 --- a/src/VSExtension.OpenSilver.sln +++ b/src/VSExtension.OpenSilver.sln @@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSilverMauiHybridTemplat EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestWizard", "TestWizard\TestWizard.csproj", "{DAC7670D-DD11-43CE-A120-231D896EB506}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSilverPhotinoTemplate", "OpenSilverPhotinoTemplate\OpenSilverPhotinoTemplate.csproj", "{61E9303A-70BB-47DF-BB47-38507FA2EF06}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -195,6 +197,18 @@ Global {DAC7670D-DD11-43CE-A120-231D896EB506}.Release|arm64.Build.0 = Release|Any CPU {DAC7670D-DD11-43CE-A120-231D896EB506}.Release|x86.ActiveCfg = Release|Any CPU {DAC7670D-DD11-43CE-A120-231D896EB506}.Release|x86.Build.0 = Release|Any CPU + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Debug|arm64.ActiveCfg = Debug|arm64 + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Debug|arm64.Build.0 = Debug|arm64 + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Debug|x86.ActiveCfg = Debug|x86 + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Debug|x86.Build.0 = Debug|x86 + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Release|Any CPU.Build.0 = Release|Any CPU + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Release|arm64.ActiveCfg = Release|arm64 + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Release|arm64.Build.0 = Release|arm64 + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Release|x86.ActiveCfg = Release|x86 + {61E9303A-70BB-47DF-BB47-38507FA2EF06}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE