Skip to content

Commit 482e9f6

Browse files
committed
Merge branch 'smtx' of https://github.com/Keboo/MaterialDesignInXamlToolkit into Keboo-smtx
2 parents 6114645 + 40f6340 commit 482e9f6

14 files changed

+457
-83
lines changed

.paket/Paket.Restore.targets

Lines changed: 267 additions & 0 deletions
Large diffs are not rendered by default.

.paket/paket.bootstrapper.exe

23.8 KB
Binary file not shown.

.paket/paket.exe

95.5 KB
Binary file not shown.

.paket/paket.targets

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,72 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
34
<PropertyGroup>
45
<!-- Enable the restore command to run before builds -->
56
<RestorePackages Condition=" '$(RestorePackages)' == '' ">true</RestorePackages>
6-
<!-- Download Paket.exe if it does not already exist -->
7-
<DownloadPaket Condition=" '$(DownloadPaket)' == '' ">true</DownloadPaket>
87
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
98
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
9+
<PaketLockFilePath>$(PaketRootPath)paket.lock</PaketLockFilePath>
10+
<PaketRestoreCacheFile>$(PaketRootPath)paket-files\paket.restore.cached</PaketRestoreCacheFile>
1011
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
1112
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
1213
</PropertyGroup>
14+
1315
<PropertyGroup>
1416
<!-- Paket command -->
17+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe')">$(PaketRootPath)paket.exe</PaketExePath>
1518
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
16-
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
1719
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
1820
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
19-
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)" $(PaketBootStrapperCommandArgs)</PaketBootStrapperCommand>
20-
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 $(PaketBootStrapperExePath) $(PaketBootStrapperCommandArgs)</PaketBootStrapperCommand>
21-
<!-- Commands -->
22-
<PaketReferences Condition="!Exists('$(MSBuildProjectFullPath).paket.references')">$(MSBuildProjectDirectory)\paket.references</PaketReferences>
23-
<PaketReferences Condition="!Exists('$(PaketReferences)')">$(MSBuildStartupDirectory)\paket.references</PaketReferences>
24-
<PaketReferences Condition="Exists('$(MSBuildProjectFullPath).paket.references')">$(MSBuildProjectFullPath).paket.references</PaketReferences>
25-
<RestoreCommand>$(PaketCommand) restore --references-files "$(PaketReferences)"</RestoreCommand>
26-
<DownloadPaketCommand>$(PaketBootStrapperCommand)</DownloadPaketCommand>
21+
</PropertyGroup>
22+
23+
<Choose> <!-- MyProject.fsproj.paket.references has the highest precedence -->
24+
<When Condition="Exists('$(MSBuildProjectFullPath).paket.references')">
25+
<PropertyGroup>
26+
<PaketReferences>$(MSBuildProjectFullPath).paket.references</PaketReferences>
27+
</PropertyGroup>
28+
</When> <!-- MyProject.paket.references -->
29+
<When Condition="Exists('$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references')">
30+
<PropertyGroup>
31+
<PaketReferences>$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketReferences>
32+
</PropertyGroup>
33+
</When> <!-- paket.references -->
34+
<When Condition="Exists('$(MSBuildProjectDirectory)\paket.references')">
35+
<PropertyGroup>
36+
<PaketReferences>$(MSBuildProjectDirectory)\paket.references</PaketReferences>
37+
</PropertyGroup>
38+
</When> <!-- Set to empty if a reference file isn't found matching one of the 3 format options -->
39+
<Otherwise>
40+
<PropertyGroup>
41+
<PaketReferences></PaketReferences>
42+
</PropertyGroup>
43+
</Otherwise>
44+
</Choose>
45+
46+
<PropertyGroup>
47+
<!-- Commands -->
48+
<RestoreCommand>$(PaketCommand) restore --references-file "$(PaketReferences)"</RestoreCommand>
2749
<!-- We need to ensure packages are restored prior to assembly resolve -->
2850
<BuildDependsOn Condition="$(RestorePackages) == 'true'">RestorePackages; $(BuildDependsOn);</BuildDependsOn>
2951
</PropertyGroup>
30-
<Target Name="CheckPrerequisites">
31-
<!-- Raise an error if we're unable to locate paket.exe -->
32-
<Error Condition="'$(DownloadPaket)' != 'true' AND !Exists('$(PaketExePath)')" Text="Unable to locate '$(PaketExePath)'" />
33-
<MsBuild Targets="DownloadPaket" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadPaket=$(DownloadPaket)" />
34-
</Target>
35-
<Target Name="DownloadPaket">
36-
<Exec Command="$(DownloadPaketCommand)" IgnoreStandardErrorWarningFormat="true" Condition=" '$(DownloadPaket)' == 'true' AND !Exists('$(PaketExePath)')" />
37-
</Target>
38-
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
39-
<Exec Command="$(RestoreCommand)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(PaketRootPath)" Condition="Exists('$(PaketReferences)')" ContinueOnError="true" />
52+
<Target Name="RestorePackages">
53+
<PropertyGroup>
54+
<PaketRestoreRequired>true</PaketRestoreRequired>
55+
</PropertyGroup>
56+
57+
<PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
58+
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
59+
<PaketRestoreLockFileHash>$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
60+
<PaketRestoreRequired>true</PaketRestoreRequired>
61+
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
62+
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
63+
</PropertyGroup>
64+
65+
<Exec Command="$(RestoreCommand)"
66+
IgnoreStandardErrorWarningFormat="true"
67+
WorkingDirectory="$(PaketRootPath)"
68+
ContinueOnError="false"
69+
Condition=" '$(PaketRestoreRequired)' == 'true' AND Exists('$(PaketReferences)') AND '$(PaketReferences)' != '' "
70+
/>
4071
</Target>
4172
</Project>

MainDemo.Wpf/App.xaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,21 @@
6767
</materialDesign:PackIcon>
6868
</materialDesign:PopupBox.ToggleContent>
6969
<Border MaxHeight="600" MaxWidth="800">
70-
<avalonEdit:TextEditor Document="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TextDocumentValueConverter}}"
71-
Style="{StaticResource AvalonTextEditorXamlDisplay}" />
70+
<StackPanel>
71+
<avalonEdit:TextEditor Document="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TextDocumentValueConverter}}"
72+
Style="{StaticResource AvalonTextEditorXamlDisplay}" />
73+
<Button
74+
Margin="0 10 0 0"
75+
Tag="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}"
76+
HorizontalAlignment="Right"
77+
Command="Copy"
78+
CommandParameter="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}"
79+
Content="_COPY"
80+
Style="{StaticResource MaterialDesignRaisedButton}">
81+
</Button>
82+
</StackPanel>
7283
</Border>
84+
7385
</materialDesign:PopupBox>
7486
<Grid>
7587
<AdornerDecorator>
@@ -96,3 +108,4 @@
96108
</ResourceDictionary>
97109
</Application.Resources>
98110
</Application>
111+

MainDemo.Wpf/App.xaml.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Configuration;
4-
using System.Data;
5-
using System.Globalization;
6-
using System.Linq;
7-
using System.Threading;
8-
using System.Threading.Tasks;
1+
using ShowMeTheXAML;
92
using System.Windows;
10-
using System.Windows.Markup;
11-
using ShowMeTheXAML;
123

134
namespace MaterialDesignColors.WpfExample
145
{

MainDemo.Wpf/Dialogs.xaml

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -102,49 +102,52 @@
102102

103103
<!--#region SAMPLE 2-->
104104
<TextBlock Grid.Column="1" Grid.Row="0" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8 0 8 0">SAMPLE 2: Top level dialog, using OpenDialog, passing content via the Parameter. You can pass a view model, provided a corresponding DataTemplate can be found in the scope of the root DialogHost.</TextBlock>
105-
<StackPanel Grid.Column="1" Grid.Row="1" VerticalAlignment="Center">
106-
<!--the request to open the dialog will bubble up to the top-most DialogHost, but we can used the attached property based event to handle the response -->
107-
<Button Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"
108-
materialDesign:DialogHost.DialogClosingAttached="Sample2_DialogHost_OnDialogClosing"
109-
Width="128">
110-
<Button.CommandParameter>
111-
<StackPanel Margin="16">
112-
<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="16" IsIndeterminate="True" Value="0" />
113-
<Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
114-
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
115-
CommandParameter="Sample2Cancel"
116-
HorizontalAlignment="Center">CANCEL</Button>
117-
</StackPanel>
118-
</Button.CommandParameter>
119-
PASS VIEW
120-
</Button>
121-
<Button Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"
122-
Width="128" Margin="0 32 0 0">
123-
<Button.CommandParameter>
124-
<!-- the simplest view model of all, a DateTime. the view can be found in the resources of MainWindow.xaml -->
125-
<system:DateTime>1966-JUL-30</system:DateTime>
126-
</Button.CommandParameter>
127-
PASS MODEL
128-
</Button>
129-
</StackPanel>
105+
<smtx:XamlDisplay Grid.Column="1" Grid.Row="1" Key="dialogs_sample2">
106+
<StackPanel VerticalAlignment="Center">
107+
<!--the request to open the dialog will bubble up to the top-most DialogHost, but we can used the attached property based event to handle the response -->
108+
<Button Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"
109+
materialDesign:DialogHost.DialogClosingAttached="Sample2_DialogHost_OnDialogClosing"
110+
Width="128">
111+
<Button.CommandParameter>
112+
<StackPanel Margin="16">
113+
<ProgressBar Style="{DynamicResource MaterialDesignCircularProgressBar}" HorizontalAlignment="Center" Margin="16" IsIndeterminate="True" Value="0" />
114+
<Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True"
115+
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
116+
CommandParameter="Sample2Cancel"
117+
HorizontalAlignment="Center">CANCEL</Button>
118+
</StackPanel>
119+
</Button.CommandParameter>
120+
PASS VIEW
121+
</Button>
122+
<Button Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"
123+
Width="128" Margin="0 32 0 0">
124+
<Button.CommandParameter>
125+
<!-- the simplest view model of all, a DateTime. the view can be found in the resources of MainWindow.xaml -->
126+
<system:DateTime>1966-JUL-30</system:DateTime>
127+
</Button.CommandParameter>
128+
PASS MODEL
129+
</Button>
130+
</StackPanel>
131+
</smtx:XamlDisplay>
130132
<!--#endregion-->
131133

132134
<!--#region SAMPLE 3-->
133135
<TextBlock Grid.Column="2" Grid.Row="0" TextWrapping="Wrap" VerticalAlignment="Top" Margin="8 0 8 0">SAMPLE 3: Open and listen to the dialog entirely from code in a view model.</TextBlock>
134136
<!-- Executes a command on DialogsViewModel.cs, which will launch the dialog from code -->
135-
<StackPanel Grid.Column="2" Grid.Row="1" >
136-
<Button Command="{Binding RunDialogCommand}"
137-
Width="128">
138-
RUN CODE
139-
</Button>
140-
<Button Command="{Binding RunExtendedDialogCommand}"
141-
Width="128" Margin="0 32 0 0">
142-
EXTENDED
143-
</Button>
144-
</StackPanel>
137+
<smtx:XamlDisplay Grid.Column="2" Grid.Row="1" Key="dialogs_sample3">
138+
<StackPanel>
139+
<Button Command="{Binding RunDialogCommand}"
140+
Width="128">
141+
RUN CODE
142+
</Button>
143+
<Button Command="{Binding RunExtendedDialogCommand}"
144+
Width="128" Margin="0 32 0 0">
145+
EXTENDED
146+
</Button>
147+
</StackPanel>
148+
</smtx:XamlDisplay>
145149
<!--#endregion-->
146150

147-
148151
<!--#region SAMPLE 4-->
149152
<TextBlock TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Top"
150153
Grid.Column="3" Margin="8 0 8 0"

MainDemo.Wpf/MainWindow.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
TextOptions.TextRenderingMode="Auto"
1414
Background="{DynamicResource MaterialDesignPaper}"
1515
FontFamily="{StaticResource MaterialDesignFont}" Icon="favicon.ico">
16+
<Window.CommandBindings>
17+
<CommandBinding Command="Copy" Executed="OnCopy"></CommandBinding>
18+
</Window.CommandBindings>
1619
<Window.Resources>
1720
<ResourceDictionary>
1821
<ResourceDictionary.MergedDictionaries>

MainDemo.Wpf/MainWindow.xaml.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using MaterialDesignColors.WpfExample.Domain;
1+
using System;
2+
using System.Diagnostics;
3+
using MaterialDesignColors.WpfExample.Domain;
24
using MaterialDesignThemes.Wpf;
35
using System.Threading;
46
using System.Threading.Tasks;
@@ -55,5 +57,20 @@ private async void MenuPopupButton_OnClick(object sender, RoutedEventArgs e)
5557

5658
await DialogHost.Show(sampleMessageDialog, "RootDialog");
5759
}
60+
61+
private void OnCopy(object sender, ExecutedRoutedEventArgs e)
62+
{
63+
if (e.Parameter is string stringValue)
64+
{
65+
try
66+
{
67+
Clipboard.SetDataObject(stringValue);
68+
}
69+
catch (Exception ex)
70+
{
71+
Trace.WriteLine(ex.ToString());
72+
}
73+
}
74+
}
5875
}
5976
}

MainDemo.Wpf/MaterialDesignDemo.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,8 @@
457457
</Target>
458458
-->
459459
<Import Project="..\.paket\paket.targets" />
460-
<Target Name="Foo" BeforeTargets="BuildXamlDictionary">
461-
<Message Text="Kevin: $(ShowMeTheXAMLRequireKeySet)" />
460+
<Target Name="ShowMeTheXAML_EnsureXamlCreated" AfterTargets="BeforeCompile">
461+
<Error Condition="('$(ShowMeTheXAMLGeneratedFileName)' == '' Or $(ShowMeTheXAMLGeneratedFileName) == '*Undefined*') And Exists('..\packages\ShowMeTheXAML.MSBuild\build\$(__paket__ShowMeTheXAML_MSBuild_targets).targets')" Text="ShowMeTheXAML was added to the $(ProjectName) project. Please rebuild the project." />
462462
</Target>
463463
<Choose>
464464
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.2')">

0 commit comments

Comments
 (0)