using System.Windows.Forms;
using FastReport.Export;
using FastReport.Export.XAML;
using FastReport.Utils;

namespace FastReport.Forms
{
    /// <summary>
    /// Form for <see cref="XAMLExport"/>.
    /// For internal use only.
    /// </summary>
    public partial class XAMLExportForm : BaseExportForm
    {
        /// <inheritdoc/>
        public override void Init(ExportBase export)
        {
            base.Init(export);
            XAMLExport xamlExport = Export as XAMLExport;
            comboBox1.SelectedIndex = (int)xamlExport.ImageFormat;
            cbToMultipleFiles.Checked = xamlExport.HasMultipleFiles;
            cbScroll.Checked = xamlExport.IsScrolled;
        }
        
        /// <inheritdoc/>
        protected override void Done()
        {
            base.Done();
            XAMLExport xamlExport = Export as XAMLExport;
            xamlExport.ImageFormat = (XamlImageFormat)comboBox1.SelectedIndex;
            xamlExport.HasMultipleFiles = cbToMultipleFiles.Checked;
            xamlExport.IsScrolled = cbScroll.Checked;
        }
        
        /// <inheritdoc/>
        public override void Localize()
        {
            base.Localize();
            MyRes res = new MyRes("Export,Xaml");
            Text = res.Get("");
            cbScroll.Text = res.Get("IsScrolled");
            res = new MyRes("Export,Misc");
            gbOptions.Text = res.Get("Options");
            lblImageFormat.Text = res.Get("Pictures");
            cbToMultipleFiles.Text = res.Get("ToMultipleFiles");
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="XAMLExportForm"/> class.
        /// </summary>
        public XAMLExportForm()
        {
            InitializeComponent();
        }
    }
}

