Esempio n. 1
0
        public AEMGViewModel(IMacroManager macroManager, AEActionListViewModel AEActionList, AESettingViewModel Settings, AEScriptGenerator scriptGenerator, IMessageBoxService messageBoxService, IAutoUpdater AutoUpdater)
        {
            this.MacroManager          = macroManager;
            this.AEActionListViewModel = AEActionList;
            this.Settings          = Settings;
            this.scriptGenerator   = scriptGenerator;
            this.messageBoxService = messageBoxService;
            this.AutoUpdater       = AutoUpdater;
            this.MacroManager.ScanForMacroes();

            InitializeCommandAndEvents();

            if (Settings.IsAutoUpdateEnable == true)
            {
                this.AutoUpdater.CheckForUpdate();
            }
        }
Esempio n. 2
0
        private void InitializeCommandAndEvents()
        {
            ConvertCommand = new RelayCommand(p =>
            {
                var result = this.scriptGenerator.GenerateScript(MacroManager.GetCurrentTemplate(), AEActionListViewModel.AEActionList);

                if (result == null)
                {
                    return;
                }

                if (result == true)
                {
                    this.messageBoxService.ShowMessageBox("Done", "Convert", MessageButton.OK, MessageImage.Information, MessageResult.OK);
                }
                else
                {
                    this.messageBoxService.ShowMessageBox("Error. Check your setting or contact me for help", "Convert", MessageButton.OK, MessageImage.Error, MessageResult.OK);
                }
            });

            TestSelectedCommand = new RelayCommand(p =>
            {
                this.scriptGenerator.GenerateScript(MacroManager.GetCurrentTemplate(), aEAction: AEActionListViewModel.GetSelected());
            });

            MacroManager.SelectChanged += (sender, e) =>
            {
                Settings.CustomName = MacroManager.GetCurrentTemplate()?.MacroName;
            };
        }
Esempio n. 3
0
        private void InitializeCommandAndEvents()
        {
            ConvertCommand = new RelayCommand(p =>
            {
                var result = this.scriptGenerator.GenerateScript(macroManager.GetCurrentTemplate(), AEActionListViewModel.AEActionList);

                if (result == null)
                {
                    return;
                }

                if (result == true)
                {
                    this.messageBoxService.ShowMessageBox("Done", "Convert", MessageButton.OK, MessageImage.Information, MessageResult.OK);
                }
                else
                {
                    this.messageBoxService.ShowMessageBox("Error. Check your setting or contact me for help", "Convert", MessageButton.OK, MessageImage.Error, MessageResult.OK);
                }
            });

            TestSelectedCommand = new RelayCommand(p =>
            {
                this.scriptGenerator.GenerateScript(macroManager.GetCurrentTemplate(), aEAction: AEActionListViewModel.GetSelected());
            });

            PreviewInEMMCommand = new RelayCommand(p =>
            {
                //check if EMM exist
                if (!File.Exists(Path.Combine(Environment.CurrentDirectory, AEMGStatic.EMM_NAME)))
                {
                    this.messageBoxService.ShowMessageBox("Cannot find EMM application. Put this application to the same folder as EMM.exe", "ERROR", MessageButton.OK, MessageImage.Error);
                    return;
                }

                var path = this.scriptGenerator.GenerateTempScript(macroManager.GetCurrentTemplate(), AEActionListViewModel.AEActionList);

                AEMGHelpers.StartEMM(path, StaticVariables.NO_SAVE_AGRS);
            });

            macroManager.SelectChanged += (sender, e) =>
            {
                Settings.CustomName = e.NewMacro?.MacroName;
            };
        }