public AreaViewModel(FootprintEditorViewModel parent, FTPT.Area area) { mParent = parent; mArea = area; mAreaTypeAttributes = new AreaTypeAttributes(mArea); mSurfaceTypeAttributes = new SurfaceTypeAttributes(mArea); mSurfaceAttributes = new SurfaceAttributes(mArea); mIntersectionAttributes = new IntersectionAttributes(mArea); mPoints = new ObservableCollection<PointViewModel>(); foreach (FTPT.PolygonPoint pt in area.ClosedPolygon) { Add(new PointViewModel(this, pt)); } SelectedPoint = Points.FirstOrDefault(); mDeletePointCommand = new UserCommand<AreaViewModel>(x => x != null && x.SelectedPoint != null && x.Points.Contains(x.SelectedPoint), x => x.Remove(x.SelectedPoint)); mAddPointCommand = new UserCommand<AreaViewModel>(x => x != null && true, x => x.Add()); }
private static void Main(string[] args) { byte[] buffer = null; using (Stream s = File.OpenRead(args[0])) { buffer = new byte[s.Length]; s.Read(buffer, 0, buffer.Length); } var app = new Application(); var rcol = new GenericRCOLResource(0, new MemoryStream(buffer)); var viewModel = new FootprintEditorViewModel(rcol); var win = new MainWindow(viewModel); app.Run(win); if (viewModel.IsSaving) { byte[] output = rcol.AsBytes; using (FileStream s = File.Create(args[0])) { s.Write(output, 0, output.Length); } } }
public MainWindow(FootprintEditorViewModel vm) : this() { viewModel = vm; DataContext = viewModel; }
public MainWindow(FootprintEditorViewModel vm) : this() { viewModel = vm; DataContext = viewModel; }