Ejemplo n.º 1
0
        //copying data from SetCAColors viewmodel to CAGrid viewmodel
        private void CopyFromSetCAColorsVM_To_CAGrid2DVM(SetCAColorsVM setCAColorsVM, ref CAGrid2DVM caGrid2DVMIn)
        {
            caGrid2DVMIn.SelectedGridColor           = setCAColorsVM.SelectedGridColor;
            caGrid2DVMIn.SelectedMarkingColor        = setCAColorsVM.SelectedMarkingColor;
            caGrid2DVMIn.SelectedMouseOverColor      = setCAColorsVM.SelectedMouseOverColor;
            caGrid2DVMIn.SelectedSelectionFrameColor = setCAColorsVM.SelectedSelectionFrameColor;
            caGrid2DVMIn.SelectedBackgroundColor     = setCAColorsVM.SelectedBackgroundColor;
            caGrid2DVMIn.SelectedStartInterpColor    = setCAColorsVM.SelectedStartInterpColor;
            caGrid2DVMIn.SelectedEndInterpColor      = setCAColorsVM.SelectedEndInterpColor;

            if (setCAColorsVM.SetStateColorsDirectlyChecked)
            {
                caGrid2DVMIn.StateColorAssigning = StateColorAssigningType.Direct;
            }
            else if (setCAColorsVM.SetStateColorsInterpChecked)
            {
                caGrid2DVMIn.StateColorAssigning = StateColorAssigningType.Interpolated;
            }
            else
            {
                throw new CAExplorerException("Unknown state color assigning was used!");
            }

            caGrid2DVMIn.StateToColorCollection.Clear();
            foreach (StateAndColor aStateAndColor in setCAColorsVM.StateColorsCollection)
            {
                caGrid2DVMIn.StateToColorCollection.Add(new StateAndColor(aStateAndColor));
            }
        }
Ejemplo n.º 2
0
        //setting state colors for specific CA
        public void SetCAColorsInSelectedCA(object messageIn)
        {
            if (mySelectedCAGrid2DViewModel != null)
            {
                try
                {
                    mySelectedCAGrid2DViewModel.StopTimer();

                    //instantiating of SetCAColors viewmodel
                    var aSetCAColorsVM = new SetCAColorsVM();

                    bool?aDialogResult = null;

                    //copying data from CAGrid viewmodel to SetCAColors viewmodel.
                    CopyFromCAGrid2DVM_To_SetCAColorsVM(mySelectedCAGrid2DViewModel, ref aSetCAColorsVM);

                    //showing of SetCAColors dialog
                    aDialogResult = DialogMediator.ShowModalDialog("Set CA colors", aSetCAColorsVM, this);

                    if (aDialogResult == true)
                    {
                        //copying data from SetCAColors viewmodel to CAGrid2D viewmodel
                        CopyFromSetCAColorsVM_To_CAGrid2DVM(aSetCAColorsVM, ref mySelectedCAGrid2DViewModel);

                        //redrawing CA after CA colors modification
                        mySelectedCAGrid2DViewModel.RedrawGrid();
                    }
                }
                catch (Exception ex)
                {
                    DialogMediator.ShowMessageBox(null, "Exception during showing Set State Colors dialog", "Following exception occured : \n" + ex.Message, System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning);
                    throw;
                }
            }
        }
Ejemplo n.º 3
0
        //copying data from CAGrid viewmodel to SetCAColors viewmodel.
        private void CopyFromCAGrid2DVM_To_SetCAColorsVM(CAGrid2DVM caGrid2DVMIn, ref SetCAColorsVM setCAColorsVM)
        {
            setCAColorsVM.SelectedGridColor           = caGrid2DVMIn.SelectedGridColor;
            setCAColorsVM.SelectedMarkingColor        = caGrid2DVMIn.SelectedMarkingColor;
            setCAColorsVM.SelectedMouseOverColor      = caGrid2DVMIn.SelectedMouseOverColor;
            setCAColorsVM.SelectedSelectionFrameColor = caGrid2DVMIn.SelectedSelectionFrameColor;
            setCAColorsVM.SelectedBackgroundColor     = caGrid2DVMIn.SelectedBackgroundColor;
            setCAColorsVM.SelectedStartInterpColor    = caGrid2DVMIn.SelectedStartInterpColor;
            setCAColorsVM.SelectedEndInterpColor      = caGrid2DVMIn.SelectedEndInterpColor;

            setCAColorsVM.SetStateColorsDirectlyRBEnabled = caGrid2DVMIn.CAGrid2DModel.NumberOfStates < Constants.MaxColorCountForDirectColors ? true : false;

            if (caGrid2DVMIn.StateColorAssigning == StateColorAssigningType.Direct)
            {
                setCAColorsVM.SetStateColorsDirectlyChecked = true;
                setCAColorsVM.SetStateColorsInterpChecked   = false;
            }
            else if (caGrid2DVMIn.StateColorAssigning == StateColorAssigningType.Interpolated)
            {
                setCAColorsVM.SetStateColorsInterpChecked   = true;
                setCAColorsVM.SetStateColorsDirectlyChecked = false;
            }

            if (setCAColorsVM.SetStateColorsDirectlyRBEnabled == false)
            {
                setCAColorsVM.SetStateColorsDirectlyChecked = false;
                setCAColorsVM.SetStateColorsInterpChecked   = true;
            }

            setCAColorsVM.StateCount = (int)caGrid2DVMIn.CAGrid2DModel.NumberOfStates;

            setCAColorsVM.StateColorsCollection.Clear();
            if (setCAColorsVM.SetStateColorsDirectlyRBEnabled == true)
            {
                for (int i = 0; i < caGrid2DVMIn.CAGrid2DModel.NumberOfStates; i++)
                {
                    setCAColorsVM.StateColorsCollection.Add(new StateAndColor(caGrid2DVMIn.StateToColorCollection[i]));
                }
            }
        }