Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ToolLayerExportGifControl.axaml.cs « Tools « Controls « UVtools.WPF - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8afc78a6f6dde324740b27b79bed95f81035fd12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Collections.Generic;
using System.IO;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using UVtools.Core.Operations;

namespace UVtools.WPF.Controls.Tools
{
    public class ToolLayerExportGifControl : ToolControl
    {
        public OperationLayerExportGif Operation => BaseOperation as OperationLayerExportGif;
        public ToolLayerExportGifControl()
        {
            InitializeComponent();
            BaseOperation = new OperationLayerExportGif(SlicerFile);
        }

        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);
        }

        public async void ChooseFilePath()
        {
            var dialog = new SaveFileDialog
            {
                Filters = new List<FileDialogFilter>
                {
                    new()
                    {
                        Extensions = new List<string>{"gif"},
                        Name = "GIF files"
                    }
                },
                InitialFileName = Path.GetFileName(SlicerFile.FileFullPath)+".gif",
                Directory = Path.GetDirectoryName(SlicerFile.FileFullPath)
            };
            var file = await dialog.ShowAsync(ParentWindow);
            if (string.IsNullOrWhiteSpace(file)) return;
            Operation.FilePath = file;
        }
    }
}