示例#1
0
        public void SvgDirToXaml_with_defaultSettingsTest()
        {
            var resKeyInfo = new ResKeyInfo {
                XamlName = "Test", Prefix = "NamePrefix"
            };
            var xaml = ConverterLogic.SvgDirToXaml("TestFiles\\", resKeyInfo, null);

            Console.WriteLine(xaml);
        }
示例#2
0
        public void SvgDirToXaml_with_defaultSettingsTest()
        {
            var resKeyInfo = new ResKeyInfo {
                XamlName = "Test", Prefix = "NamePrefix"
            };
            var xaml = ConverterLogic.SvgDirToXaml("TestFiles\\", resKeyInfo, null, false);

            CheckXamlOutput(xaml);
        }
示例#3
0
        public void SvgDirToXamlTest()
        {
            var settings = new WpfDrawingSettings
            {
                IncludeRuntime = false,
                TextAsGeometry = false,
                OptimizePath   = true,
            };
            var xaml = ConverterLogic.SvgDirToXaml("..\\..\\TestFiles\\", "Test", settings);

            Console.WriteLine(xaml);
        }
示例#4
0
        public void SvgDirToXamlTest_withUseCompResKey()
        {
            var settings = new WpfDrawingSettings
            {
                IncludeRuntime = false,
                TextAsGeometry = false,
                OptimizePath   = true,
            };

            var xaml = ConverterLogic.SvgDirToXaml("TestFiles\\", ResKeyInfoUseCompResKey, settings, false);

            CheckXamlOutput(xaml);
        }
示例#5
0
        private void ExportDirExecute()
        {
            string outFileName = Path.Combine(CurrentDir, Path.GetFileNameWithoutExtension(CurrentDir) + ".xaml");
            var    saveDlg     = new SaveFileDialog {
                AddExtension = true, DefaultExt = ".xaml", Filter = "Xaml-File|*.xaml", FileName = outFileName
            };

            if (saveDlg.ShowDialog() == DialogResult.OK)
            {
                outFileName = saveDlg.FileName;
                File.WriteAllText(outFileName, ConverterLogic.SvgDirToXaml(CurrentDir, Path.GetFileNameWithoutExtension(outFileName)));
                MessageBox.Show(outFileName + "\nhas been written");
            }
        }
示例#6
0
        public void SvgDirToXamlTest_withNamePrefix()
        {
            var settings = new WpfDrawingSettings
            {
                IncludeRuntime = false,
                TextAsGeometry = false,
                OptimizePath   = true,
            };
            var resKeyInfo = new ResKeyInfo {
                XamlName = "Test", Prefix = "NamePrefix"
            };
            var xaml = ConverterLogic.SvgDirToXaml("TestFiles\\", resKeyInfo, settings, true);

            CheckXamlOutput(xaml);
        }
示例#7
0
        public void SvgDirToXamlTest_withUseCompResKey()
        {
            var settings = new WpfDrawingSettings
            {
                IncludeRuntime = false,
                TextAsGeometry = false,
                OptimizePath   = true,
            };

            var xaml = ConverterLogic.SvgDirToXaml("TestFiles\\", ResKeyInfoUseCompResKey, settings);

            Console.WriteLine(xaml);
            File.WriteAllText("TestFiles\\ExpectedXaml_SvgDirToXamlTest_withUseCompResKey.xaml", xaml);
            var expectedXaml = File.ReadAllText("TestFiles\\ExpectedXaml_SvgDirToXamlTest_withUseCompResKey.xaml");

            xaml.Should().Be(expectedXaml);
        }
示例#8
0
        private void ExportDirExecute()
        {
            string outFileName = Path.GetFileNameWithoutExtension(CurrentDir) + ".xaml";
            var    saveDlg     = new SaveFileDialog {
                AddExtension = true, DefaultExt = ".xaml", Filter = "Xaml-File|*.xaml", InitialDirectory = CurrentDir, FileName = outFileName
            };

            if (saveDlg.ShowDialog() == DialogResult.OK)
            {
                string namePrefix = null;

                bool   useComponentResKeys = false;
                string nameSpaceName       = null;
                var    nameSpace           = Microsoft.VisualBasic.Interaction.InputBox("Enter a NameSpace for using static ComponentResKeys (or leave empty to not use it)", "NameSpace");
                if (!string.IsNullOrWhiteSpace(nameSpace))
                {
                    useComponentResKeys = true;
                    nameSpaceName       =
                        Microsoft.VisualBasic.Interaction.InputBox(
                            "Enter a Name of NameSpace for using static ComponentResKeys", "NamespaceName");
                }
                else
                {
                    namePrefix = Microsoft.VisualBasic.Interaction.InputBox("Enter a namePrefix (or leave empty to not use it)", "Name Prefix");
                    if (string.IsNullOrWhiteSpace(namePrefix))
                    {
                        namePrefix = null;
                    }
                }

                outFileName = Path.GetFullPath(saveDlg.FileName);
                var resKeyInfo = new ResKeyInfo
                {
                    XamlName            = Path.GetFileNameWithoutExtension(outFileName),
                    Prefix              = namePrefix,
                    UseComponentResKeys = useComponentResKeys,
                    NameSpace           = nameSpace,
                    NameSpaceName       = nameSpaceName,
                };
                File.WriteAllText(outFileName, ConverterLogic.SvgDirToXaml(CurrentDir, resKeyInfo));

                BuildBatchFile(outFileName, resKeyInfo);
            }
        }
示例#9
0
        public void SvgDirToXamlTest_withNamePrefix()
        {
            var settings = new WpfDrawingSettings
            {
                IncludeRuntime = false,
                TextAsGeometry = false,
                OptimizePath   = true,
            };
            var resKeyInfo = new ResKeyInfo {
                XamlName = "Test", Prefix = "NamePrefix"
            };
            var xaml = ConverterLogic.SvgDirToXaml("TestFiles\\", resKeyInfo, settings);

            Console.WriteLine(xaml);
            //File.WriteAllText("TestFiles\\ExpectedXaml_SvgDirToXamlTest_withNamePrefix.xaml", xaml);
            var expectedXaml = File.ReadAllText("TestFiles\\ExpectedXaml_SvgDirToXamlTest_withNamePrefix.xaml");

            xaml.Should().Be(expectedXaml);
        }
示例#10
0
        private void ExportDirExecute()
        {
            string outFileName = Path.GetFileNameWithoutExtension(CurrentDir) + ".xaml";
            var    saveDlg     = new SaveFileDialog {
                AddExtension = true, DefaultExt = ".xaml", Filter = "Xaml-File|*.xaml", InitialDirectory = CurrentDir, FileName = outFileName
            };

            if (saveDlg.ShowDialog() == DialogResult.OK)
            {
                outFileName = Path.GetFullPath(saveDlg.FileName);
                var resKeyInfo = new ResKeyInfo
                {
                    XamlName            = Path.GetFileNameWithoutExtension(outFileName),
                    Prefix              = null,
                    UseComponentResKeys = false,
                    NameSpace           = null,
                    NameSpaceName       = null,
                };
                File.WriteAllText(outFileName, ConverterLogic.SvgDirToXaml(CurrentDir, resKeyInfo, false));

                BuildBatchFile(outFileName, resKeyInfo);
            }
        }
示例#11
0
        public void SvgDirToXaml_with_defaultSettingsTest()
        {
            var xaml = ConverterLogic.SvgDirToXaml("..\\..\\TestFiles\\", "Test", null);

            Console.WriteLine(xaml);
        }