public LiveBuildHelperVM(IDominoProvider pFParameters, int pBlockSize, Core.Orientation orientation, bool MirrorX, bool MirrorY) { BlockSize = pBlockSize; fParameters = pFParameters; intField = fParameters.GetBaseField(orientation, MirrorX, MirrorY); NextN = 500; CountRow = intField.GetLength(1); stonesPerLine = intField.GetLength(0); CountBlock = Convert.ToInt32(Math.Ceiling(((double)stonesPerLine / BlockSize))); SizeChanged = new RelayCommand(o => { RefreshCanvas(); }); MouseDown = new RelayCommand(o => { CurrentBlock.Focus(); }); PositionSnapshots = new ObservableCollection <PositionSnapshot>(); MakePositionSnapshot = new RelayCommand(o => { PositionSnapshots.RemoveAll(x => x.Column == SelectedBlock && x.Row == SelectedRow); if ((bool)o == true) { PositionSnapshots.Insert(0, new PositionSnapshot() { Column = SelectedBlock, Row = SelectedRow }); } RaisePropertyChanged(nameof(PositionSnapshots)); }); GoToPositionSnapshot = new RelayCommand(o => { if (o is PositionSnapshot ps) { SelectedBlock = ps.Column; SelectedRow = ps.Row; } }); ColumnConfig = new AvaloniaList <Column> { new Column() { DataField = "DominoColor.mediaColor", Header = "", Class = "Color" }, new Column() { DataField = "DominoColor.name", Header = _("Name") }, new Column() { DataField = "ProjectCount[0]", Header = GetParticularString("Number of stones available", "Total") }, new Column() { DataField = "ProjectCount[1]", Header = GetParticularString("Remaining number of stones", "Remaining"), Class = "Count" }, new Column() { DataField = "ProjectCount[2]", Header = string.Format(GetParticularString("Dominoes of the given color within the next {0}", "Next {0}"), NextN) } }; OpenPopup = new RelayCommand(x => { FillColorList(); PopupOpen = true; }); CurrentStones = new ObservableCollection <SolidColorBrush>(); HistStones = new ObservableCollection <SolidColorBrush>(); ColorNames = new ObservableCollection <ColorAmount>(); RefreshCanvas(); }
public LiveBuildHelperVM(IDominoProvider pFParameters, int pBlockSize, Core.Orientation orientation, bool MirrorX, bool MirrorY) { blockSize = pBlockSize; fParameters = pFParameters; intField = fParameters.GetBaseField(orientation, MirrorX, MirrorY); NextN = 500; CountRow = intField.GetLength(1); stonesPerLine = intField.GetLength(0); CountBlock = Convert.ToInt32(Math.Ceiling(((double)stonesPerLine / blockSize))); SizeChanged = new RelayCommand(o => { RefreshCanvas(); }); MouseDown = new RelayCommand(o => { currentBlock.Focus(); }); ColumnConfig = new ColumnConfig(); var columns = new ObservableCollection <Column>(); columns.Add(new Column() { DataField = "DominoColor.mediaColor", Header = "" }); columns.Add(new Column() { DataField = "DominoColor.name", Header = "Name" }); columns.Add(new Column() { DataField = "ProjectCount[0]", Header = "Total used" }); columns.Add(new Column() { DataField = "ProjectCount[1]", Header = "Remaining" }); columns.Add(new Column() { DataField = "ProjectCount[2]", Header = "Next " + NextN }); ColumnConfig.Columns = columns; OpenPopup = new RelayCommand(x => { FillColorList(); PopupOpen = true; }); }