Example #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < 9; i++)
            {
                _default = Properties.Resources.base_thumbnail.Convert();
                var control = ((Image)FindName($@"thumbnail_{i}"));
                if (control != null)
                {
                    control.Source = _default;
                }
            }

            StyleMode.SelectedIndex = Properties.Settings.Default.Style;

            if (File.Exists("frames.xml"))
            {
                _frames = (Dictionary <string, BoxArtFrame>)_frames.GetType().GetXmlDictionary(DictionaryExtension.ReadXmlToString("frames.xml"));
            }
            else
            {
                _frames.Add("16x9", new BoxArtFrame(1422, 800, "16x9"));
                _frames.Add("4x3", new BoxArtFrame(1066, 800, "4x3"));
                _frames.Add("3x4", new BoxArtFrame(600, 800, "3x4"));
                _frames.Add("2x3", new BoxArtFrame(533, 800, "2x3"));
                _frames.GetXmlString().SaveXmlToFile("frames.xml");
            }

            foreach (KeyValuePair <string, BoxArtFrame> frame in _frames)
            {
                frame_list.Items.Add(new ListViewItem()
                {
                    Tag = frame.Key, Content = frame.Value.ToString()
                });
            }
        }
Example #2
0
        public Export(ImageSource source)
        {
            InitializeComponent();
            StyleMode.SelectedIndex = Properties.Settings.Default.Style;
            _source = (BitmapSource)source;
            _frames = (Dictionary <string, BoxArtFrame>) typeof(Dictionary <string, BoxArtFrame>).GetXmlDictionary(DictionaryExtension.ReadXmlToString("frames.xml"));

            if (File.Exists("default_banner.png"))
            {
                var bmi = new BitmapImage();
                bmi.BeginInit();
                bmi.UriSource   = new Uri(new FileInfo("default_banner.png").FullName);
                bmi.CacheOption = BitmapCacheOption.OnLoad;
                bmi.EndInit();
                banner_file.Source = bmi;
            }

            _dispatcher.Interval = TimeSpan.FromMilliseconds(500);

            _dispatcher.Tick += (s, a) =>
            {
                foreach (var boxArtFrame in ExportTabFrames.Items)
                {
                    var item = boxArtFrame as TabItem;

                    var editor = item?.Content as EditorWindow;
                    editor?.RenderFrames();
                }
                _dispatcher.Stop();
            };

            Typeface = new Typeface(new FontFamily("Museo Sans 500"), FontStyles.Normal, FontWeights.Regular,
                                    FontStretches.Normal);

            title_typeface.Text =
                $"@Typeface: ({Typeface.FontFamily},{Typeface.Style},{Typeface.Weight},{Typeface.Stretch})";


            foreach (var frame in _frames)
            {
                var editor   = new EditorWindow();
                var tabFrame = new TabItem
                {
                    Header  = frame.Key,
                    Name    = "TabItem_" + frame.Key.Replace("x", "_").Replace(" ", "_"),
                    Style   = FindResource("CrimsonTabStyle") as Style,
                    Content = editor
                };

                ExportTabFrames.Items.Add(tabFrame);
                editor.SetImage(_source, frame.Value, this);
            }
        }