Пример #1
0
        /// <summary>
        /// Finds all files in the Render DLL and renders them to the Abgabe directory
        /// </summary>
        /// <param name="w">width of all images</param>
        /// <param name="h">height of all images</param>
        async void Render(int w, int h)
        {
            var target = System.IO.Path.GetFullPath("..\\..\\..\\doc\\");

            if (!Directory.Exists(target))
            {
                Directory.CreateDirectory(target);
            }
            for (var n = 0; n < lib.OutputFiles.Count; n++)
            {
                lib.Render(n, w, h);
                tbConsole.Text += $"Rendering {lib.OutputFiles[n]}...\n";
                while (w != lib.Status)
                {
                    await Task.Delay(33);
                }
                tbConsole.Text += "Exporting png\n";
                while (lib.ReturnCode == -1)
                {
                    await Task.Delay(100);
                }
                tbConsole.Text += "Moving to Output\n";
                var tfile = target + lib.OutputFiles[n];
                if (File.Exists(tfile))
                {
                    File.Delete(tfile);
                }
                File.Move(lib.OutputFiles[n], target + lib.OutputFiles[n]);
            }
            tbConsole.Text += $"Abgabe complete.\nResults in {System.IO.Path.GetFullPath(target)}\n";
        }
Пример #2
0
        /// <summary>
        /// Render button click. Starts renderer
        /// </summary>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var idx = cbFiles.SelectedIndex;

            if (idx == -1)
            {
                MessageBox.Show("Please Select a Target File");
                return;
            }
            try {
                int w = int.Parse(tbW.Text), h = int.Parse(tbH.Text);
                if (renderer.Render(idx, w, h))
                {
                    switchToRenderPage(new RenderPage(renderer, idx, w));
                }
                else
                {
                    MessageBox.Show("Returned False!");
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }