public MainWindow() { _imgScale = 1; _mapFile = null; _barContext = new ArtCardBarWrapper(); DataContext = _barContext; InitializeComponent(); }
public void UpdateBar() { if (CardArtDb.All.ContainsKey(CardId)) { CardBar = new ArtCardBarWrapper(CardArtDb.All[CardId]); } else { CardBar = new ArtCardBarWrapper(); } }
private void LoadFile(FileObject file) { if (file != null) { StatusWrite(file.CardBar.CardId); StatusWrite(file.CardBar.TexturePath); ImgBase.Source = _original = file.Image; _barContext = file.CardBar; DataContext = _barContext; ResetView(_barContext); SetImageTitle(); } }
private void ResetView(ArtCardBarWrapper bar) { Rectangle rect = bar.GetRectangle(); if (rect.Width != 0 && rect.Height != 0) { var calc = CalculateFromBar(rect); ScaleImage(calc.Item1); ImgBase.SetValue(Canvas.LeftProperty, calc.Item2); ImgBase.SetValue(Canvas.TopProperty, calc.Item3); } else { ResetView(); } }