Skip to content

Commit

Permalink
Wpf dev (#14)
Browse files Browse the repository at this point in the history
* Begin WPF work on PropertiesDesigner

* Refactor XmlEditor Designer to use Nuget package

* PropertyGrid cleanup
  • Loading branch information
chrpai authored Mar 9, 2019
1 parent 62b7927 commit 51f5e64
Show file tree
Hide file tree
Showing 52 changed files with 506 additions and 1,914 deletions.
15 changes: 0 additions & 15 deletions Application/Application.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IsWiX", "IsWiX\IsWiX.csproj
{7C470E97-D17B-41A2-B1E2-9EC665300E36} = {7C470E97-D17B-41A2-B1E2-9EC665300E36}
{461DDAB2-0B76-460D-9F3E-041CB88DF974} = {461DDAB2-0B76-460D-9F3E-041CB88DF974}
{49ADFDB8-D7A2-40D7-8A22-DA540F2E8237} = {49ADFDB8-D7A2-40D7-8A22-DA540F2E8237}
{416B01C8-6E99-40A2-81D6-2F67B259C19E} = {416B01C8-6E99-40A2-81D6-2F67B259C19E}
{5875AECD-549F-4209-95ED-A95DF4F0FB21} = {5875AECD-549F-4209-95ED-A95DF4F0FB21}
{9B75CED2-3FFA-4E40-9B7E-B8EB364D7008} = {9B75CED2-3FFA-4E40-9B7E-B8EB364D7008}
EndProjectSection
Expand All @@ -37,11 +36,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicesDesigner", "Designe
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShortCutsDesigner", "Designers\ShortCutsDesigner\ShortCutsDesigner.csproj", "{62EE9B37-D99A-4AC0-898A-EC822268467C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlEditorDesigner", "Designers\XmlEditorDesigner\XmlEditorDesigner.csproj", "{416B01C8-6E99-40A2-81D6-2F67B259C19E}"
ProjectSection(ProjectDependencies) = postProject
{461DDAB2-0B76-460D-9F3E-041CB88DF974} = {461DDAB2-0B76-460D-9F3E-041CB88DF974}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FeaturesDesigner", "Designers\FeaturesDesigner\FeaturesDesigner.csproj", "{9B75CED2-3FFA-4E40-9B7E-B8EB364D7008}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppXDesigner", "Designers\AppXDesigner\AppXDesigner.csproj", "{7C470E97-D17B-41A2-B1E2-9EC665300E36}"
Expand Down Expand Up @@ -122,14 +116,6 @@ Global
{62EE9B37-D99A-4AC0-898A-EC822268467C}.Release|Any CPU.Build.0 = Release|Any CPU
{62EE9B37-D99A-4AC0-898A-EC822268467C}.Release|x86.ActiveCfg = Release|Any CPU
{62EE9B37-D99A-4AC0-898A-EC822268467C}.Release|x86.Build.0 = Release|Any CPU
{416B01C8-6E99-40A2-81D6-2F67B259C19E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{416B01C8-6E99-40A2-81D6-2F67B259C19E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{416B01C8-6E99-40A2-81D6-2F67B259C19E}.Debug|x86.ActiveCfg = Debug|Any CPU
{416B01C8-6E99-40A2-81D6-2F67B259C19E}.Debug|x86.Build.0 = Debug|Any CPU
{416B01C8-6E99-40A2-81D6-2F67B259C19E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{416B01C8-6E99-40A2-81D6-2F67B259C19E}.Release|Any CPU.Build.0 = Release|Any CPU
{416B01C8-6E99-40A2-81D6-2F67B259C19E}.Release|x86.ActiveCfg = Release|Any CPU
{416B01C8-6E99-40A2-81D6-2F67B259C19E}.Release|x86.Build.0 = Release|Any CPU
{9B75CED2-3FFA-4E40-9B7E-B8EB364D7008}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B75CED2-3FFA-4E40-9B7E-B8EB364D7008}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B75CED2-3FFA-4E40-9B7E-B8EB364D7008}.Debug|x86.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -174,7 +160,6 @@ Global
{D14BED47-FF47-49F4-B15E-E28E4607B757} = {94BCBA4B-1D51-406B-BA90-63E42F7629A2}
{4B733F56-A202-4813-9494-53B048FE07B6} = {94BCBA4B-1D51-406B-BA90-63E42F7629A2}
{62EE9B37-D99A-4AC0-898A-EC822268467C} = {94BCBA4B-1D51-406B-BA90-63E42F7629A2}
{416B01C8-6E99-40A2-81D6-2F67B259C19E} = {94BCBA4B-1D51-406B-BA90-63E42F7629A2}
{9B75CED2-3FFA-4E40-9B7E-B8EB364D7008} = {94BCBA4B-1D51-406B-BA90-63E42F7629A2}
{7C470E97-D17B-41A2-B1E2-9EC665300E36} = {94BCBA4B-1D51-406B-BA90-63E42F7629A2}
{461DDAB2-0B76-460D-9F3E-041CB88DF974} = {27EDD51D-A5F3-430F-80B1-49B13F450C89}
Expand Down
4 changes: 2 additions & 2 deletions Application/Designers/AppXDesigner/AppXDesigner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<Reference Include="DiffPlex, Version=1.4.3.0, Culture=neutral, PublicKeyToken=1d35e91d1bd7bc0f, processorArchitecture=MSIL">
<HintPath>..\..\packages\DiffPlex.1.4.3\lib\net40\DiffPlex.dll</HintPath>
</Reference>
<Reference Include="FireworksFramework, Version=5.1.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.10\lib\net40\FireworksFramework.dll</HintPath>
<Reference Include="FireworksFramework, Version=5.1.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.13\lib\net40\FireworksFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion Application/Designers/AppXDesigner/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DiffPlex" version="1.4.3" targetFramework="net462" />
<package id="fireworks" version="5.1.10" targetFramework="net462" />
<package id="fireworks" version="5.1.13" targetFramework="net462" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<Reference Include="DiffPlex, Version=1.4.3.0, Culture=neutral, PublicKeyToken=1d35e91d1bd7bc0f, processorArchitecture=MSIL">
<HintPath>..\..\packages\DiffPlex.1.4.3\lib\net40\DiffPlex.dll</HintPath>
</Reference>
<Reference Include="FireworksFramework, Version=5.1.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.10\lib\net40\FireworksFramework.dll</HintPath>
<Reference Include="FireworksFramework, Version=5.1.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.13\lib\net40\FireworksFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
Expand Down
2 changes: 1 addition & 1 deletion Application/Designers/CustomTablesDesigner/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DiffPlex" version="1.4.3" targetFramework="net462" />
<package id="fireworks" version="5.1.10" targetFramework="net462" />
<package id="fireworks" version="5.1.13" targetFramework="net462" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<Reference Include="DiffPlex, Version=1.4.3.0, Culture=neutral, PublicKeyToken=1d35e91d1bd7bc0f, processorArchitecture=MSIL">
<HintPath>..\..\packages\DiffPlex.1.4.3\lib\net40\DiffPlex.dll</HintPath>
</Reference>
<Reference Include="FireworksFramework, Version=5.1.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.10\lib\net40\FireworksFramework.dll</HintPath>
<Reference Include="FireworksFramework, Version=5.1.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.13\lib\net40\FireworksFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
Expand Down
2 changes: 1 addition & 1 deletion Application/Designers/FeaturesDesigner/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DiffPlex" version="1.4.3" targetFramework="net462" />
<package id="fireworks" version="5.1.10" targetFramework="net462" />
<package id="fireworks" version="5.1.13" targetFramework="net462" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<Reference Include="DiffPlex, Version=1.4.3.0, Culture=neutral, PublicKeyToken=1d35e91d1bd7bc0f, processorArchitecture=MSIL">
<HintPath>..\..\packages\DiffPlex.1.4.3\lib\net40\DiffPlex.dll</HintPath>
</Reference>
<Reference Include="FireworksFramework, Version=5.1.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.10\lib\net40\FireworksFramework.dll</HintPath>
<Reference Include="FireworksFramework, Version=5.1.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.13\lib\net40\FireworksFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DiffPlex" version="1.4.3" targetFramework="net462" />
<package id="fireworks" version="5.1.10" targetFramework="net462" />
<package id="fireworks" version="5.1.13" targetFramework="net462" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
<Reference Include="DiffPlex, Version=1.4.3.0, Culture=neutral, PublicKeyToken=1d35e91d1bd7bc0f, processorArchitecture=MSIL">
<HintPath>..\..\packages\DiffPlex.1.4.3\lib\net40\DiffPlex.dll</HintPath>
</Reference>
<Reference Include="FireworksFramework, Version=5.1.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.10\lib\net40\FireworksFramework.dll</HintPath>
<Reference Include="FireworksFramework, Version=5.1.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.13\lib\net40\FireworksFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Deployment.Compression, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ce35f76fcda82bad, processorArchitecture=MSIL">
<HintPath>..\..\packages\wix-libs.3.11.1\lib\net20\Microsoft.Deployment.Compression.dll</HintPath>
Expand Down Expand Up @@ -123,6 +123,7 @@
<Compile Include="Models\ProductModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\GeneralInformationViewModel.cs" />
<Compile Include="Views\CustomEditor.cs" />
<Compile Include="Views\GeneralInformationView.xaml.cs">
<DependentUpon>GeneralInformationView.xaml</DependentUpon>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using IsWiXAutomationInterface;
using FireworksFramework.Managers;
using FireworksFramework.Types;
using GeneralInformationDesigner.Views;

namespace Designers.GeneralInformation.Models
{
Expand All @@ -27,6 +28,7 @@ public class PackageModel : ObservableObject
YesNo? _adminImage;
[CategoryAttribute("Package")]
[Description(@"Set to 'yes' if the source is an admin image.")]
[Editor(typeof(CustomEditor<YesNo>), typeof(CustomEditor<YesNo>))]
public YesNo? AdminImage { get { return _adminImage; } set { _adminImage = value; RaisePropertyChangedEvent("AdminImage"); } }

string _comments;
Expand All @@ -37,6 +39,7 @@ public class PackageModel : ObservableObject
YesNo? _compressed;
[CategoryAttribute("Package")]
[Description("Set to 'yes' to have compressed files in the source. This attribute cannot be set for merge modules. ")]
[Editor(typeof(CustomEditor<YesNo>), typeof(CustomEditor<YesNo>))]
public YesNo? Compressed { get { return _compressed; } set { _compressed = value; RaisePropertyChangedEvent("Compressed"); } }

string _description;
Expand All @@ -46,6 +49,7 @@ public class PackageModel : ObservableObject

InstallPrivileges? _installPrivileges;
[CategoryAttribute("Package")]
[Editor(typeof(CustomEditor<InstallPrivileges>), typeof(CustomEditor<InstallPrivileges>))]
[Description(@"Use this attribute to specify the priviliges required to install the package on Windows Vista and above. This attribute's value must be one of the following:
limited
Set this value to declare that the package does not require elevated privileges to install.
Expand All @@ -58,6 +62,7 @@ Set this value to declare that the package does not require elevated privileges
[Description(@"Use this attribute to specify the installation scope of this package: per-machine or per-user. This attribute's value must be one of the following:
perMachine Set this value to declare that the package is a per-machine installation and requires elevated privileges to install. Sets the ALLUSERS property to 1.
perUser Set this value to declare that the package is a per-user installation and does not require elevated privileges to install. Sets the package's InstallPrivileges attribute to 'limited.'")]
[Editor(typeof(CustomEditor<InstallScope>), typeof(CustomEditor<InstallScope>))]
public InstallScope? InstallScope { get { return _installScope; } set { _installScope = value; RaisePropertyChangedEvent("InstallScope"); } }

string _keywords;
Expand All @@ -76,16 +81,19 @@ perMachine Set this value to declare that the package is a per-machine installat
x86 Set this value to declare that the package is an x86 package.
ia64 Set this value to declare that the package is an ia64 package. This value requires that the InstallerVersion property be set to 200 or greater.
x64 Set this value to declare that the package is an x64 package. This value requires that the InstallerVersion property be set to 200 or greater. ")]
[Editor(typeof(CustomEditor<Platform>), typeof(CustomEditor<Platform>))]
public Platform? Platform { get { return _platform; } set { _platform = value; RaisePropertyChangedEvent("Platform"); } }

YesNoDefault? _readOnly;
[CategoryAttribute("Package")]
[Description(@"The value of this attribute conveys whether the package should be opened as read-only. A database editing tool should not modify a read-only enforced database and should issue a warning at attempts to modify a read-only recommended database. ")]
[Editor(typeof(CustomEditor<YesNoDefault>), typeof(CustomEditor<YesNoDefault>))]
public YesNoDefault? ReadOnly { get { return _readOnly; } set { _readOnly = value; RaisePropertyChangedEvent("ReadOnly"); } }

YesNo? _shortNames;
[CategoryAttribute("Package")]
[Description(@"Set to 'yes' to have short filenames in the source.")]
[Editor(typeof(CustomEditor<YesNo>), typeof(CustomEditor<YesNo>))]
public YesNo? ShortNames { get { return _shortNames; } set { _shortNames = value; RaisePropertyChangedEvent("ShortNames"); } }

string _summaryCodepage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,7 @@ private void Package_PropertyChanged(object sender, PropertyChangedEventArgs e)
break;

case "Compressed":
if (Package.Compressed != null && _documentManager.Document.GetDocumentType() == IsWiXDocumentType.Module)
{
MessageBox.Show("The compressed attribute cannot be set in a Merge Module.");
Package.Compressed = null;
}
else
{
_iswixPackage.Compressed = Package.Compressed;
}
_iswixPackage.Compressed = Package.Compressed;
break;

case "Description":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using IsWiXAutomationInterface;
using System;
using System.Collections;
using System.Drawing.Imaging;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using Xceed.Wpf.Toolkit.PropertyGrid;

namespace GeneralInformationDesigner.Views
{
public class CustomEditor<T> : Xceed.Wpf.Toolkit.PropertyGrid.Editors.ComboBoxEditor
{


protected override IValueConverter CreateValueConverter()
{
return new CustomValueConverter<T>();
}

protected override ComboBox CreateEditor()
{
ComboBox comboBox = base.CreateEditor();
FrameworkElementFactory textBlock = new FrameworkElementFactory(typeof(TextBlock));
textBlock.SetBinding(TextBlock.TextProperty, new Binding(".") { Converter = new CustomValueConverter<T>() });
comboBox.ItemTemplate = new DataTemplate() { VisualTree = textBlock };
return comboBox;
}

protected override IEnumerable CreateItemsSource(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem)
{
return new string[1] { CustomValueConverter<T>.Null }
.Concat(Enum.GetValues(typeof(T)).OfType<T>().Select(x => x.ToString()));
}
}

public class CustomValueConverter<T>: IValueConverter
{
internal const string Null = "";
public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return Null;

return value.ToString();
}

public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture)
{
string s = value?.ToString();
if (s == Null)
return null;

return Enum.Parse(typeof(T), s);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<GridSplitter Grid.Row="1" Grid.ColumnSpan="3" Height="5" HorizontalAlignment="Stretch" />
<xctk:PropertyGrid Grid.Column="0" Grid.Row="0" x:Name="propertyGridProduct" SelectedObject="{Binding Product}" Visibility="{Binding ProductPropertyGridVisible}"/>
<xctk:PropertyGrid Grid.Column="0" Grid.Row="0" x:Name="propertyGridModule" SelectedObject="{Binding Module}" Visibility="{Binding ModulePropertyGridVisible}"></xctk:PropertyGrid>
<xctk:PropertyGrid Grid.Column="3" Grid.Row="0" x:Name="propertyGridPackage" SelectedObject="{Binding Package}" Visibility="{Binding PackagePropertyGridVisible}" ></xctk:PropertyGrid>
<xctk:PropertyGrid Grid.Column="3" Grid.Row="0" x:Name="propertyGridPackage" SelectedObject="{Binding Package, Mode=TwoWay}" Visibility="{Binding PackagePropertyGridVisible}" ></xctk:PropertyGrid>
<DockPanel Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="2">
<DockPanel DockPanel.Dock="Top">
<Label Content="Dependencies:"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using System.Reflection;
using System.Windows.Controls;
using static FireworksFramework.Types.Enums;
using System.Linq;
using System.Drawing.Imaging;

namespace GeneralInformationDesigner.Views
{
Expand Down Expand Up @@ -67,6 +69,21 @@ public bool IsValidContext()
public void LoadData()
{
viewModel.Load();
bool enabled = true;
if (_documentManager.Document.GetDocumentType() == IsWiXDocumentType.Module)
{
enabled = false;
}

foreach (Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem property in propertyGridPackage.Properties)
{
if (property.PropertyName == "Compressed")
{
property.IsEnabled = enabled;
break;
}
}

}

private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<packages>
<package id="DiffPlex" version="1.4.3" targetFramework="net462" />
<package id="Extended.Wpf.Toolkit" version="3.5.0" targetFramework="net462" />
<package id="fireworks" version="5.1.10" targetFramework="net462" />
<package id="fireworks" version="5.1.13" targetFramework="net462" />
<package id="wix-libs" version="3.11.1" targetFramework="net462" />
</packages>
4 changes: 2 additions & 2 deletions Application/Designers/MSIXDesigner/MSIXDesigner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<Reference Include="DiffPlex, Version=1.4.3.0, Culture=neutral, PublicKeyToken=1d35e91d1bd7bc0f, processorArchitecture=MSIL">
<HintPath>..\..\packages\DiffPlex.1.4.3\lib\net40\DiffPlex.dll</HintPath>
</Reference>
<Reference Include="FireworksFramework, Version=5.1.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.10\lib\net40\FireworksFramework.dll</HintPath>
<Reference Include="FireworksFramework, Version=5.1.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.13\lib\net40\FireworksFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion Application/Designers/MSIXDesigner/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DiffPlex" version="1.4.3" targetFramework="net462" />
<package id="fireworks" version="5.1.10" targetFramework="net462" />
<package id="fireworks" version="5.1.13" targetFramework="net462" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<Reference Include="DiffPlex, Version=1.4.3.0, Culture=neutral, PublicKeyToken=1d35e91d1bd7bc0f, processorArchitecture=MSIL">
<HintPath>..\..\packages\DiffPlex.1.4.3\lib\net40\DiffPlex.dll</HintPath>
</Reference>
<Reference Include="FireworksFramework, Version=5.1.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.10\lib\net40\FireworksFramework.dll</HintPath>
<Reference Include="FireworksFramework, Version=5.1.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\fireworks.5.1.13\lib\net40\FireworksFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
Expand Down
Loading

0 comments on commit 51f5e64

Please sign in to comment.