Esempio n. 1
0
        public EditProjectVM(IDominoProvider dominoProvider) : base()
        {
            HaveBuildtools = dominoProvider.HasProtocolDefinition;

            UICursor = null;
            Dominoes = new AvaloniaList <EditingDominoVM>();
            PossiblePastePositions = new List <int>();
            UnsavedChanges         = false;
            CurrentProject         = dominoProvider;

            _DominoList = new ObservableCollection <ColorListEntry>();

            _DominoList.Clear();
            CurrentProject.colors.Anzeigeindizes.CollectionChanged += Anzeigeindizes_CollectionChanged;
            RefreshList();
            selectedColors       = new int[CurrentProject.colors.Length];
            SaveField            = new RelayCommand(o => { Save(); });
            RestoreBasicSettings = new RelayCommand(o => { redoStack = new Stack <PostFilter>(); Editing = false; });

            SelectColor       = new RelayCommand(o => { SelectAllStonesWithColor(); });
            MouseClickCommand = new RelayCommand(o => { ChangeColor(); });
            ClearSelection    = new RelayCommand(o => { ClearFullSelection(true); });
            CopyCom           = new RelayCommand(o => { Copy(); });

            AddRowAbove         = new RelayCommand(o => { AddRow(false); });
            AddRowBelow         = new RelayCommand(o => { AddRow(true); });
            AddColumnRight      = new RelayCommand(o => { AddColumn(true); });
            AddColumnLeft       = new RelayCommand(o => { AddColumn(false); });
            RemoveRows          = new RelayCommand(o => { RemoveSelRows(); });
            RemoveColumns       = new RelayCommand(o => { RemoveSelColumns(); });
            FlipHorizontallyCom = new RelayCommand(o => { System.Diagnostics.Debug.WriteLine("asdf");; });
            FlipVerticallyCom   = new RelayCommand(o => { System.Diagnostics.Debug.WriteLine("asdf");; });
            MouseInPicture      = new RelayCommand(o => { UICursor = new Cursor(StandardCursorType.Hand); });
            MouseOutPicture     = new RelayCommand(o => { UICursor = null; });
            SelectAllCom        = new RelayCommand(o => { SelectAll(); });
            ChangeColorCom      = new RelayCommand(o => { if (o is IDominoColor dc)
                                                          {
                                                              ChangeColor(dc);
                                                          }
                                                   });
            UnsavedChanges      = false;
            SelectionTool       = new SelectionToolVM(this);
            DisplaySettingsTool = new DisplaySettingsToolVM(this);
            ZoomTool            = new ZoomToolVM(this);
            RulerTool           = new RulerToolVM(this);
            EditingTools        = new ObservableCollection <EditingToolVM>()
            {
                SelectionTool,
                RulerTool,
                new EditingToolVM(this)
                {
                    Image = "textDrawingImage", Name = "Write text"
                },
                ZoomTool,
                DisplaySettingsTool
            };
            if (this.CurrentProject is IRowColumnAddableDeletable)
            {
                RowColumnTool = new RowColumnInsertionVM(this);
                EditingTools.Insert(2, RowColumnTool);
            }
            SelectedTool = SelectionTool;
            UpdateUIElements();
        }
        public EditProjectVM(IDominoProvider dominoProvider) : base()
        {
            HaveBuildtools = dominoProvider.HasProtocolDefinition ? Visibility.Visible : Visibility.Hidden;

            UICursor         = null;
            selectedDominoes = new List <int>();
            UnsavedChanges   = false;
            CurrentProject   = dominoProvider;

            _DominoList = new ObservableCollection <ColorListEntry>();

            _DominoList.Clear();
            CurrentProject.colors.Anzeigeindizes.CollectionChanged += Anzeigeindizes_CollectionChanged;
            refreshList();
            selectedColors       = new int[CurrentProject.colors.Length];
            SaveField            = new RelayCommand(o => { Save(); });
            RestoreBasicSettings = new RelayCommand(o => { redoStack = new Stack <PostFilter>(); Editing = false; });

            SelectColor       = new RelayCommand(o => { SelectAllStonesWithColor(); });
            MouseClickCommand = new RelayCommand(o => { ChangeColor(); });
            ClearSelection    = new RelayCommand(o => { ClearFullSelection(true); });
            CopyCom           = new RelayCommand(o => { Copy(); });
            PasteCom          = new RelayCommand(o => { Paste(); });

            AddRowAbove         = new RelayCommand(o => { AddRow(false); });
            AddRowBelow         = new RelayCommand(o => { AddRow(true); });
            AddColumnRight      = new RelayCommand(o => { AddColumn(true); });
            AddColumnLeft       = new RelayCommand(o => { AddColumn(false); });
            RemoveRows          = new RelayCommand(o => { RemoveSelRows(); });
            RemoveColumns       = new RelayCommand(o => { RemoveSelColumns(); });
            FlipHorizontallyCom = new RelayCommand(o => { System.Diagnostics.Debug.WriteLine("asdf");; });
            FlipVerticallyCom   = new RelayCommand(o => { System.Diagnostics.Debug.WriteLine("asdf");; });
            MouseInPicture      = new RelayCommand(o => { UICursor = Cursors.Hand; });
            MouseOutPicture     = new RelayCommand(o => { UICursor = null; });
            SelectAllCom        = new RelayCommand(o => { SelectAll(); });
            UnsavedChanges      = false;
            SelectionTool       = new SelectionToolVM(this);
            DisplaySettingsTool = new DisplaySettingsToolVM(this);
            ZoomTool            = new ZoomToolVM(this);
            EditingTools        = new ObservableCollection <EditingToolVM>()
            {
                SelectionTool,
                new EditingToolVM()
                {
                    Image = "ruler2DrawingImage", Name = "Measure distance"
                },
                new EditingToolVM()
                {
                    Image = "add_delete_rowDrawingImage", Name = "Add or delete rows and columns"
                },
                new EditingToolVM()
                {
                    Image = "textDrawingImage", Name = "Write text"
                },
                new EditingToolVM()
                {
                    Image = "fill_bucketDrawingImage", Name = "Fill area"
                },
                ZoomTool,
                DisplaySettingsTool
            };
            SelectedTool = SelectionTool;
            UpdateUIElements();
        }