Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 35 additions & 43 deletions src/Eto.DevExtension.Shared/ProjectWizardPageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public string AppName
public bool SupportsPCL => Source.TargetFrameworkVersion > new Version(4, 0) && Source.IsSupportedParameter("PCL");

public bool SupportsNetStandard => Source.IsSupportedParameter("NetStandard");
public bool SupportsNet6 => Source.IsSupportedParameter("Net6");

public bool SupportsSAL => Source.IsSupportedParameter("SAL");

Expand All @@ -98,10 +97,10 @@ public string AppName

public bool SupportsCombined => Source.IsSupportedParameter("Combined");

public bool SupportsXamMac => Source.IsSupportedParameter("XamMac");

public bool SupportsMacosWorkload => Source.IsSupportedParameter("macos");

public bool SupportsWinForms => Source.IsSupportedParameter("winforms");

public bool SupportsXeto => Source.IsSupportedParameter("Xeto");

public bool SupportsJeto => Source.IsSupportedParameter("Jeto");
Expand All @@ -123,27 +122,26 @@ public bool Combined
OnPropertyChanged();
OnPropertyChanged(nameof(Information));
OnPropertyChanged(nameof(AllowMacosWorkload));
OnPropertyChanged(nameof(AllowXamMac));
}
}

public bool IncludeXamMac
public bool IncludeMacosWorkload
{
get { return Source.GetParameter("IncludeXamMac").ToBool(); }
get { return Source.GetParameter("IncludeMacOS").ToBool(); }
set
{
Source.SetParameter("IncludeXamMac", value.ToString());
Source.SetParameter("IncludeMacOS", value.ToString());
OnPropertyChanged();
OnPropertyChanged(nameof(Information));
}
}

public bool IncludeMacosWorkload
public bool IncludeWinForms
{
get { return Source.GetParameter("IncludeMacosWorkload").ToBool(); }
get { return Source.GetParameter("IncludeWinForms").ToBool(); }
set
{
Source.SetParameter("IncludeMacosWorkload", value.ToString());
Source.SetParameter("IncludeWinForms", value.ToString());
OnPropertyChanged();
OnPropertyChanged(nameof(Information));
}
Expand Down Expand Up @@ -237,7 +235,6 @@ public class FrameworkInfo
public string Description { get; set; }
public bool CanUseCombined { get; set; }
public bool CanUseMacos { get; set; }
public bool CanUseXamMac { get; set; }
}

public FrameworkInfo[] SupportedFrameworks => frameworkInformation ?? (frameworkInformation = GetFrameworkInformation().ToArray());
Expand All @@ -246,14 +243,15 @@ public class FrameworkInfo

IEnumerable<FrameworkInfo> GetFrameworkInformation()
{
if (SupportsNet6)
yield return new FrameworkInfo { Text = ".NET 6", Value = "net6.0", CanUseCombined = true, CanUseMacos = true };

yield return new FrameworkInfo { Text = ".NET 5", Value = "net5.0", CanUseCombined = true };
yield return new FrameworkInfo { Text = ".NET Core 3.1", Value = "netcoreapp3.1", CanUseCombined = true };
yield return new FrameworkInfo { Text = ".NET Framework 4.8", Value = "net48", CanUseCombined = true, CanUseXamMac = true };
yield return new FrameworkInfo { Text = ".NET Framework 4.7.2", Value = "net472", CanUseCombined = true, CanUseXamMac = true };
yield return new FrameworkInfo { Text = ".NET Framework 4.6.2", Value = "net462", CanUseCombined = true, CanUseXamMac = true };
// matches the Framework choices in Eto.Forms.Templates
yield return new FrameworkInfo { Text = ".NET 10", Value = "net10.0", CanUseCombined = true, CanUseMacos = true };
yield return new FrameworkInfo { Text = ".NET 9", Value = "net9.0", CanUseCombined = true, CanUseMacos = true };
yield return new FrameworkInfo { Text = ".NET 8", Value = "net8.0", CanUseCombined = true, CanUseMacos = true };
yield return new FrameworkInfo { Text = ".NET 7", Value = "net7.0", CanUseCombined = true, CanUseMacos = true };
yield return new FrameworkInfo { Text = ".NET 6", Value = "net6.0", CanUseCombined = true, CanUseMacos = true };
yield return new FrameworkInfo { Text = ".NET Framework 4.8", Value = "net48", CanUseCombined = true };
yield return new FrameworkInfo { Text = ".NET Framework 4.7.2", Value = "net472", CanUseCombined = true };
yield return new FrameworkInfo { Text = ".NET Framework 4.6.2", Value = "net462", CanUseCombined = true };
}

FrameworkInfo _selectedFramework;
Expand All @@ -265,25 +263,23 @@ public FrameworkInfo SelectedFramework
{
_selectedFramework = value;

// the macOS project's framework comes from Framework, the rest from TargetFrameworkOverride
Source.SetParameter("Framework", value.Value);
Source.SetParameter("TargetFrameworkOverride", value.Value);

if (!AllowCombined)
Combined = false;
if (!AllowMacosWorkload)
IncludeMacosWorkload = false;
if (!AllowXamMac)
IncludeXamMac = false;
OnPropertyChanged();
OnPropertyChanged(nameof(Information));
OnPropertyChanged(nameof(AllowCombined));
OnPropertyChanged(nameof(AllowMacosWorkload));
OnPropertyChanged(nameof(AllowXamMac));
}
}

public bool AllowCombined => _selectedFramework?.CanUseCombined == true;
public bool AllowMacosWorkload => _selectedFramework?.CanUseMacos == true;
public bool AllowXamMac => _selectedFramework?.CanUseXamMac == true || !Combined;


struct TypeInfo
Expand All @@ -300,21 +296,24 @@ struct TypeInfo
new TypeInfo { UseSAL = true, Text = "Use a shared asset library for shared code and maximum flexibility." }
};

struct CombinedInfo
string CombinedInformation
{
public string Text;
public bool Combined;
public bool? IncludeXamMac;
public bool? IncludeMacosWorkload;
get
{
var windows = SupportsWinForms && IncludeWinForms ? "Windows Forms" : "WPF";
var mac = SupportsMacosWorkload && IncludeMacosWorkload ? ".NET's macos workload" : "Eto's Mac64 platform";
if (Combined)
return $"A single combined project that can build for Windows, Linux, and Mac.\n\nUses {windows} on Windows and {mac} on Mac.";

var text = "A separate project for each platform: WPF, Gtk and Mac64";
if (SupportsWinForms && IncludeWinForms)
text += ", plus Windows Forms";
if (SupportsMacosWorkload && IncludeMacosWorkload)
text += ", plus .NET's macos workload";
return text + ".";
}
}

static CombinedInfo[] combinedInformation = {
new CombinedInfo { Combined = true, IncludeMacosWorkload = true, Text = "A single combined project that can build for Windows, Linux and Mac.\n\nUses .NET's macos workload on Mac." },
new CombinedInfo { Combined = true, IncludeXamMac = true, Text = "A single combined project that can build for Windows, Linux and Xamarin.Mac." },
new CombinedInfo { Combined = true, IncludeMacosWorkload = false, IncludeXamMac = false, Text = "A single combined project that can build for Windows, Linux, and Mac.\n\nUses Eto's Mac64 platform on Mac." },
new CombinedInfo { Combined = false, Text = "A separate project for each platform." },
};

struct FormatInfo
{
public string Text;
Expand Down Expand Up @@ -347,14 +346,7 @@ public string Information
var text = new List<string>();

if (SupportsCombined)
{
var combinedInfo = from i in combinedInformation
where i.Combined == Combined
&& (i.IncludeXamMac == null || i.IncludeXamMac == IncludeXamMac)
&& (i.IncludeMacosWorkload == null || i.IncludeMacosWorkload == IncludeMacosWorkload)
select i.Text;
text.Add(combinedInfo.FirstOrDefault());
}
text.Add(CombinedInformation);

if (SupportsProjectType)
{
Expand Down
9 changes: 4 additions & 5 deletions src/Eto.DevExtension.Shared/ProjectWizardPageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,14 @@ public ProjectWizardPageView(ProjectWizardPageModel model)
content.AddRow(HeadingLabel(string.Empty), cb);
}

if (model.SupportsXamMac)
if (model.SupportsWinForms)
{
var cb = new CheckBox
{
ToolTip = "This enables you to bundle mono with your app so your users don't have to install it separately. You can only compile this on a Mac"
ToolTip = "Uses Windows Forms on Windows instead of, or as well as, WPF"
};
cb.BindDataContext(c => c.Text, Binding.Property((ProjectWizardPageModel m) => m.Combined).Convert(combined => combined ? "Use Xamarin.Mac" : "Include Xamarin.Mac project"));
cb.BindDataContext(c => c.Enabled, Binding.Property((ProjectWizardPageModel m) => m.AllowXamMac));
cb.CheckedBinding.BindDataContext((ProjectWizardPageModel m) => m.IncludeXamMac);
cb.BindDataContext(c => c.Text, Binding.Property((ProjectWizardPageModel m) => m.Combined).Convert(combined => combined ? "Use Windows Forms instead of WPF" : "Include Windows Forms project"));
cb.CheckedBinding.BindDataContext((ProjectWizardPageModel m) => m.IncludeWinForms);
content.AddRow(HeadingLabel(string.Empty), cb);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<CustomParameter Name="$uistyle$" Value="none"/>
<CustomParameter Name="$groupid$" Value="Eto.App" />
<CustomParameter Name="SideWaffleNewProjNode" Value="Project\CSharp\Eto.Forms"/>
<CustomParameter Name="SupportedParameters" Value="Combined,Xeto,Jeto,Preview,XamMac,macos,Framework" />
<CustomParameter Name="SupportedParameters" Value="Combined,Xeto,Jeto,Preview,macos,winforms,Framework" />
</CustomParameters>
</TemplateContent>
<WizardExtension>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<CustomParameter Name="$uistyle$" Value="none"/>
<CustomParameter Name="$groupid$" Value="Eto.App" />
<CustomParameter Name="SideWaffleNewProjNode" Value="Project\FSharp\Eto.Forms"/>
<CustomParameter Name="SupportedParameters" Value="Combined,Xeto,Jeto,Preview,XamMac,macos,Framework" />
<CustomParameter Name="SupportedParameters" Value="Combined,Xeto,Jeto,Preview,macos,winforms,Framework" />
</CustomParameters>
</TemplateContent>
<WizardExtension>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<CustomParameter Name="$uistyle$" Value="none"/>
<CustomParameter Name="$groupid$" Value="Eto.App" />
<CustomParameter Name="SideWaffleNewProjNode" Value="Project\VisualBasic\Eto.Forms"/>
<CustomParameter Name="SupportedParameters" Value="Combined,Xeto,Jeto,Preview,XamMac,macos,Framework" />
<CustomParameter Name="SupportedParameters" Value="Combined,Xeto,Jeto,Preview,macos,winforms,Framework" />
</CustomParameters>
</TemplateContent>
<WizardExtension>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public string GetParameter(string parameter)

public bool IsSupportedParameter(string parameter)
{
if (string.Equals(parameter, "Net6", StringComparison.OrdinalIgnoreCase))
return true;
return replacements.IsSupportedParameter(parameter);
}

Expand Down
Loading