Example #1
0
        static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // todo: read this from something like a settings file, or something
            FileInfo flacExe = new FileInfo(@"C:\Program Files (x86)\FLAC Frontend\tools\flac.exe");

            CompressionLevelService mainService = BuildComponents(flacExe);

            using (var dialog = BuildOpenFileDialog())
            {
                var fileOpenDialog = new UI.FileOpenDialog(dialog);

                using (var form = new MainForm(
                           maxCompressionLevel,
                           minCompressionLevel,
                           defaultCompressionLevel,
                           mainService,
                           fileOpenDialog))
                {
                    Application.Run(form);
                };
            }
        }
Example #2
0
        public MainForm(
            uint maxCompressionLevel,
            uint minCompressionLevel,
            uint selectedCompressionLevel,
            CompressionLevelService compressionService,
            UI.FileOpenDialog openFileDialog)
        {
            this.compressionService = compressionService ?? throw new ArgumentNullException(nameof(compressionService));
            this.openFileDialog     = openFileDialog ?? throw new ArgumentNullException(nameof(openFileDialog));

            InitializeComponent();
            ExtraInitComponents();

            Trackbar_CompressionLevel.Maximum = (int)maxCompressionLevel;
            Trackbar_CompressionLevel.Minimum = (int)minCompressionLevel;
            Trackbar_CompressionLevel.Value   = (int)selectedCompressionLevel;

            metadataOptionsGroup = new MetadataOptionsGroup(
                this.Opt_Metadata_Keep,
                this.Opt_Metadata_Discard);
        }