예제 #1
0
 public AEScriptGenerator(ScriptApplyFactory scriptApplyFactory, AESettingViewModel setting, IMessageBoxService messageBoxService, SimpleAutoMapper autoMapper)
 {
     this.scriptApplyFactory = scriptApplyFactory;
     this.setting            = setting;
     this.messageBoxService  = messageBoxService;
     this.autoMapper         = autoMapper;
 }
예제 #2
0
        public AEMG SetupMainWindow()
        {
            //reset working directory
            Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            var dataIO          = new DataIO();
            var aeActionFactory = new AEActionFactory();
            var autoMapper      = new SimpleAutoMapper();
            var messageBox      = new MessageBoxService();

            var scriptApplyDict = new Dictionary <Emulator, IApplyScriptToFolder>()
            {
                { Emulator.Nox, new NoxScriptApply(messageBox) },
                { Emulator.Memu, new MemuScriptApply(messageBox) }
            };

            var scriptApply       = new ScriptApplyFactory(messageBox, scriptApplyDict);
            var scanner           = new MacroScanner(dataIO, aeActionFactory);
            var macroManager      = new AEMacroManager(scanner, messageBox);
            var aESettingVM       = new AESettingViewModel(new AESetting());
            var aeScriptGenerator = new AEScriptGenerator(scriptApply, aESettingVM, messageBox, autoMapper);
            var autoUpdater       = new AutoUpdater(messageBox);
            var actionList        = new AEActionListViewModel(macroManager);

            return(new AEMG
            {
                DataContext = new AEMGViewModel(macroManager, actionList, aESettingVM, aeScriptGenerator, messageBox, autoUpdater)
            });
        }
예제 #3
0
 public ScriptGenerator(ScriptApplyFactory scriptApplyFactory, SettingViewModel setting, IMessageBoxService messageBoxService, IEmulatorToScriptFactory emulatorToScriptFactory, IActionToScriptFactory actionToScriptFactory)
 {
     this.scriptApplyFactory      = scriptApplyFactory;
     this.setting                 = setting;
     this.messageBoxService       = messageBoxService;
     this.emulatorToScriptFactory = emulatorToScriptFactory;
     this.actionToScriptFactory   = actionToScriptFactory;
 }
예제 #4
0
 public AEScriptGenerator(ScriptApplyFactory scriptApplyFactory, AESettingViewModel setting, IMessageBoxService messageBoxService, SimpleAutoMapper autoMapper, IEmulatorToScriptFactory emulatorToScriptFactory, IActionToScriptFactory actionToScriptFactory, DataIO dataIO, IPredefinedActionProvider actionProvider)
 {
     this.scriptApplyFactory      = scriptApplyFactory;
     this.setting                 = setting;
     this.messageBoxService       = messageBoxService;
     this.autoMapper              = autoMapper;
     this.emulatorToScriptFactory = emulatorToScriptFactory;
     this.actionToScriptFactory   = actionToScriptFactory;
     this.dataIO         = dataIO;
     this.actionProvider = actionProvider;
 }
예제 #5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            //reset working directory
            Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            var autoMapper  = new SimpleAutoMapper();
            var dataIO      = new DataIO();
            var messageBox  = new MessageBoxService();
            var mouseHook   = new MouseHook();
            var timerTool   = new TimerTool();
            var autoUpdater = new AutoUpdater(messageBox);

            var DependencyDict = new Dictionary <Type, object>()
            {
                { typeof(SimpleAutoMapper), autoMapper },
                { typeof(MessageBoxService), messageBox }
            };

            var scriptApplyDict = new Dictionary <Emulator, IApplyScriptToFolder>()
            {
                { Emulator.Nox, new NoxScriptApply(messageBox) },
                { Emulator.Memu, new MemuScriptApply(messageBox) }
            };

            var viewModelFactory = new ViewModelFactory(DependencyDict);

            var settingVM           = new SettingViewModel(Settings.Default(), autoMapper);
            var macroManagerVM      = new MacroManagerViewModel(dataIO, messageBox, viewModelFactory);
            var scriptApplyFactory  = new ScriptApplyFactory(messageBox, scriptApplyDict);
            var scriptGenerator     = new ScriptGenerator(scriptApplyFactory, settingVM, messageBox);
            var scriptGeneratorVM   = new ScriptGeneratorViewModel(macroManagerVM, scriptGenerator, messageBox);
            var customActionManager = new CustomActionManager(macroManagerVM, viewModelFactory, dataIO, messageBox);

            var timerToolVM      = new TimerToolViewModel(mouseHook, timerTool);
            var resulutionTool   = new ResolutionConverterTool(viewModelFactory);
            var resolutionToolVM = new ResolutionConverterToolViewModel(resulutionTool, macroManagerVM, messageBox);
            var autoLocationVM   = new AutoLocationViewModel(new MouseHook(), new AutoLocation(), macroManagerVM);

            var mainWindowViewModel = new MainWindowViewModel(macroManagerVM, settingVM, autoUpdater, timerToolVM, resolutionToolVM, scriptGeneratorVM, customActionManager, autoLocationVM);

            MainWindow = new MainWindow
            {
                DataContext = mainWindowViewModel
            };

            //Handle arguments
            var agrs = Environment.GetCommandLineArgs();

            if (agrs.Length > 1)
            {
                var filepath = agrs.Where(s => s.Contains(".emm")).First();

                macroManagerVM.SetCurrentMacro(filepath);
            }

            // Select the text in a TextBox when it receives focus.
            EventManager.RegisterClassHandler(typeof(TextBox), TextBox.PreviewMouseLeftButtonDownEvent,
                                              new MouseButtonEventHandler(SelectivelyIgnoreMouseButton));
            EventManager.RegisterClassHandler(typeof(TextBox), TextBox.GotKeyboardFocusEvent,
                                              new RoutedEventHandler(SelectAllText));
            EventManager.RegisterClassHandler(typeof(TextBox), TextBox.MouseDoubleClickEvent,
                                              new RoutedEventHandler(SelectAllText));

            MainWindow.Show();
        }
예제 #6
0
 public ScriptGenerator(ScriptApplyFactory scriptApplyFactory, SettingViewModel setting, IMessageBoxService messageBoxService)
 {
     this.scriptApplyFactory = scriptApplyFactory;
     this.setting            = setting;
     this.messageBoxService  = messageBoxService;
 }