public void AddOverlay() { var ret = new OverlayBlockDefinitionItemModel(OverlayBlocks); OverlayBlocks.Add(ret); Selection = ret; }
public void AddOverlay() { var ret = new ProxyOverlayItemModel(); OverlayBlocks.Add(ret); RaisePropertyChanged("OverlayBlocks"); }
public void UpdateProxyTemplate(ProxyTemplateChangedMessage message) { if (Templates.SelectedItem == null) { return; } var selectedTemplate = ((TemplateModel)Templates.SelectedItem); var properties = StoredProxyProperties.Where(x => x.Name != null).ToDictionary(x => x.Name, x => x.Value); //this stuff generates the real proxy image, maybe we'll need to keep it in for more accurate image var proxy = ProxyGenerator.GenerateProxy(_proxydef.BlockManager, selectedTemplate._def, properties, null); using (var ms = new MemoryStream()) { proxy.Save(ms, System.Drawing.Imaging.ImageFormat.Png); ms.Position = 0; ProxyImage = new BitmapImage(); ProxyImage.BeginInit(); ProxyImage.CacheOption = BitmapCacheOption.OnLoad; ProxyImage.StreamSource = ms; ProxyImage.EndInit(); } proxy.Dispose(); BaseImage = new BitmapImage(new Uri(selectedTemplate._def.src)); ActiveOverlayLayers = new ObservableCollection <OverlayBlockDefinitionItemModel>( selectedTemplate._def.GetOverLayBlocks(properties).Where(x => x.SpecialBlock == null).Select( x => (OverlayBlockDefinitionItemModel)OverlayBlocks.First(y => ((OverlayBlockDefinitionItemModel)y).Name == x.Block))); ActiveTextLayers = new ObservableCollection <ProxyTextLinkItemModel>( selectedTemplate._def.GetTextBlocks(properties).Select( x => new ProxyTextLinkItemModel(x))); RaisePropertyChanged("BaseImage"); RaisePropertyChanged("BaseWidth"); RaisePropertyChanged("BaseHeight"); RaisePropertyChanged(""); }