private void LoaderSaverProviderCallback(ProviderCallbackType callbackType, string message)
        {
            switch (callbackType)
            {
            case ProviderCallbackType.ShowControl:
                TopContent = _currentLoaderSaverProvider.ShowControl;
                return;

            case ProviderCallbackType.ShowSpinner:
                Application.Current.Dispatcher.Invoke(() => { TopContent = StaticClasses.GetSpinner(message); });
                return;

            case ProviderCallbackType.End:
                // TopContent = null;
                if (_currentLoaderSaverProvider.Result)
                {
                    switch (_currentMultiCommand)
                    {
                    case "loadRender":
                        InitPost();
                        ShowRender();
                        break;
                    }
                }

                _currentMultiCommand = string.Empty;
                ActionFire.Invoke("MAIN_WINDOW_VIEWMODEL-SET_BOTTOM_STRING",
                                  _currentLoaderSaverProvider.ResultString);

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(callbackType), callbackType, null);
            }
        }
Пример #2
0
        public MainWindowViewModel()
        {
            CommandClosingWindow = new RelayCommand(HandlerWindowClosing);


            var thisType = GetType();

            ActionFire.AddOrReplace("MAIN_WINDOW_VIEWMODEL-SET_VERSION",
                                    new Action <int, int, int>(ActionSetVersionString), thisType);
            ActionFire.AddOrReplace("MAIN_WINDOW_VIEWMODEL-SET_BOTTOM_STRING",
                                    new Action <string>(ActionSetBottomString), thisType);
            ActionFire.AddOrReplace("MAIN_WINDOW_VIEWMODEL-SET_WINDOW_CONTENT",
                                    new Action <Control>(ActionSetWindowContent), thisType);
            ActionFire.AddOrReplace("MAIN_WINDOW_VIEWMODEL-SET_WINDOW_CONTENT_BY_PARAMS",
                                    new Action <string, object>(ActionSetWindowContentByParams), thisType);

            WindowContent = new CreateFlameView();
            // var v = new BaseValue("PanelModel", typeof(PanelModel), new PanelModel());
            // var c = new ConnectorPanelTransforms(new List<IValue> {v}, new List<IAction>(), new PanelTranforms());
            // WindowContent = (Control) c.ControlV;
            // var model = c.GetVal("PanelModel");
            // var obj = (PanelModel) model.ObjectOf;
            //

            // WindowContent = new FalamePanelsView();
        }
        private void MultiCommandHandler(object obj)
        {
            if (!(obj is string mc))
            {
                return;
            }
            _currentMultiCommand = mc;

            switch (mc)
            {
            case "toCreateFlame":
                RenderMachine.DestroyDisplay();
                ActionFire.Invoke("MAIN_WINDOW_VIEWMODEL-SET_WINDOW_CONTENT_BY_PARAMS", "CreateFlame", null);
                return;

            case "loadRender":
                _currentLoaderSaverProvider =
                    new LoaderSaverProvider(FileViewType.LoadRender, LoaderSaverProviderCallback);
                _currentLoaderSaverProvider.Exec();
                return;

            case "saveRender":
                return;

            case "saveImage":
                SaveImage();
                return;
            }

            _currentMultiCommand = string.Empty;
        }
Пример #4
0
 public PanelTransformsViewModel()
 {
     Command    = new RelayCommand(Handler);
     Transforms = new ObservableCollection <PanelTransform>();
     ActionFire.AddOrReplace("panel-transform-remove", new Action <int>(HandlerTransformRemove), GetType());
     PanelModel = new PanelModel();
     BindStorage.SetActionFor(HandlerChanged, "Transforms", "Final");
 }
        private void HandlerMain(object obj)
        {
            switch ((string)obj)
            {
            case "new":
                MainNew();
                break;

            case "load":
                MainLoadFlame();
                break;

            case "save":
                MainSaveFlame();
                break;

            case "loadRender":
                MainLoadRender();
                break;

            case "saveRender":
                MainSaveRender();
                break;

            case "startRender":
                MainActionCallRender("render");
                break;

            case "stopRender":
                RenderMachine.MainRenderStop();
                break;

            case "continueRender":
                MainActionCallRender("continue");
                break;

            case "renderSettings":
                MainRenderSettings();
                break;

            case "addTransform":
                MainAddTransform();
                break;

            case "addFinal":
                MainAddFinal();
                break;

            case "back color":
                MainSelectBackColor();
                break;

            case "toPostPro":
                ActionFire.Invoke("MAIN_WINDOW_VIEWMODEL-SET_WINDOW_CONTENT_BY_PARAMS", "PostFlame", null);
                break;
            }
        }
Пример #6
0
 private void InitCommands()
 {
     CommandCanvasLoaded  = new RelayCommand(CanvasLoadedHandler);
     CommandCanvasLeftMd  = new RelayCommand(CanvasLeftMd);
     CommandCanvasMidMd   = new RelayCommand(CanvasMidMd);
     CommandCanvasMidMm   = new RelayCommand(CanvasMidMm);
     CommandCanvasRightMd = new RelayCommand(CanvasRightMd);
     CommandCanvasMidMrd  = new RelayCommand(CanvasMidMrd);
     CommandCanvasMidMu   = new RelayCommand(CanvasMidMu);
     CommandSizeChanged   = new RelayCommand(SizeChanged);
     Command = new RelayCommand(ButtonsHandler);
     ActionFire.AddOrReplace("GRADIENT_PICKER_VIEWMODEL-CALLBACK", new Action <Color>(ActionCallback), GetType());
 }
Пример #7
0
        private static void ButtonsHandler(object obj)
        {
            var button = (string)obj;

            switch (button)
            {
            case "ok":
                ActionFire.Invoke(_callbackString1, true);
                break;

            case "cancel":
                ActionFire.Invoke(_callbackString1, false);
                break;
            }
        }
        private void InitActions()
        {
            var thisType = GetType();

            ActionFire.AddOrReplace("CREATE_FLAME_VIEWMODEL-TRANSFORM_REMOVE", new Action <int>(ActionTransformRemove),
                                    thisType);
            ActionFire.AddOrReplace("CREATE_FLAME_VIEWMODEL-CALL_RENDER", new Action <string>(MainActionCallRender),
                                    thisType);

            ActionFire.AddOrReplace("CREATE_FLAME_VIEWMODEL-TRANSFORM_PICK_COLOR",
                                    new Action <int, Color>(ActionTransformPickColor), thisType);

            ActionFire.AddOrReplace("CREATE_FLAME_VIEWMODEL-TRANSFORM_PICK_GRADIENT_COLOR",
                                    new Action <int, double>(ActionTransformPickGradientColor), thisType);

            _renderActionsPack = new RenderActionsModel(ActRenderSetImage, ActRenderSetMessage, ActRenderSetState);
        }
        private void HandlerCommand(object obj)
        {
            var command = (string)obj;

            switch (command)
            {
            case "remove":
                ActionFire.Invoke("panel-transform-remove", Id);
                break;

            case "randomize":
                ActionFire.Invoke("panel-transform-randomize", Id);
                break;

            case "selectColor":
                ActionFire.Invoke("panel-transform-select-color", Id);
                break;
            }
        }
Пример #10
0
        private void CommandHandler(object obj)
        {
            switch ((string)obj)
            {
            case "ok":
                _canvasColumn.Children.Remove(_columnArrows);
                ActionFire.Invoke(_actionFireCallback, true, ColorNew.Color);
                break;

            case "cancel":
                _canvasColumn.Children.Remove(_columnArrows);
                ActionFire.Invoke(_actionFireCallback, false, ColorNew.Color);
                break;

            case "current":
                ColorNew = new SolidColorBrush(ColorCurrent.Color);
                ColorPickerCoordinatesModel.Get(ColorNew.Color, _colorMode, out _cubeXy, out _columnY);
                ColorCube   = ColorPickerCubeModel.Get(_colorMode, _columnY, (int)_canvasCube.ActualWidth);
                ColorColumn = ColorPickerColumnModel.Get(_cubeXy, _colorMode, (int)_canvasColumn.ActualWidth,
                                                         (int)_canvasColumn.ActualHeight);
                SetIndicators();
                break;
            }
        }