private void Window_Loaded(object sender, RoutedEventArgs e) { #region Adjust to file type switch (Current.Type) { case Export.Gif: EncoderScreenToGifItem.IsEnabled = true; EncoderFfmpegItem.IsEnabled = true; EncoderGifskiItem.IsEnabled = Environment.Is64BitProcess; EncoderSystemItem.IsEnabled = true; break; case Export.Apng: EncoderScreenToGifItem.IsEnabled = true; EncoderFfmpegItem.IsEnabled = true; EncoderGifskiItem.IsEnabled = false; EncoderSystemItem.IsEnabled = false; break; case Export.Webp: case Export.Bpg: case Export.Avi: case Export.Mkv: case Export.Mov: case Export.Mp4: case Export.Webm: EncoderScreenToGifItem.IsEnabled = false; EncoderFfmpegItem.IsEnabled = true; EncoderGifskiItem.IsEnabled = false; EncoderSystemItem.IsEnabled = false; break; case Export.Jpeg: case Export.Png: case Export.Bmp: case Export.Stg: case Export.Psd: EncoderScreenToGifItem.IsEnabled = true; EncoderFfmpegItem.IsEnabled = false; EncoderGifskiItem.IsEnabled = false; EncoderSystemItem.IsEnabled = false; break; } #endregion TitleTextBox.Focus(); ExtensionTextBlock.Text = Current.Type.ToString(); EncoderComboBox.SelectedValue = Current.Encoder; if (IsNew) { AutoSaveCheckBox.IsChecked = true; return; } //Edit. IconBorder.Background = TryFindResource("Vector.Pen") as Brush; ModeTextBlock.Text = LocalizationHelper.Get("S.Edit"); EncoderComboBox.IsEnabled = false; TitleTextBox.Text = Current.Title ?? ""; DescriptionTextBox.Text = Current.Description ?? ""; AutoSaveCheckBox.IsChecked = Current.HasAutoSave; SaveInfoTextBlock.SetResourceReference(TextBlock.TextProperty, "S.Preset.Info." + (AutoSaveCheckBox.IsChecked == true ? "Automatic" : "Manual")); //If it's a default preset, just let the user edit the "auto save" feature. if (string.IsNullOrWhiteSpace(Current.TitleKey)) { return; } TitleTextBox.IsEnabled = false; DescriptionTextBox.IsEnabled = false; AutoSaveCheckBox.Focus(); StatusBand.Info(LocalizationHelper.Get("S.Preset.Warning.Readonly")); }
private void AutoSaveCheckBox_CheckedChanged(object sender, RoutedEventArgs e) { SaveInfoTextBlock.SetResourceReference(TextBlock.TextProperty, "S.Preset.Info." + (AutoSaveCheckBox.IsChecked == true ? "Automatic" : "Manual")); }