Esempio n. 1
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)
            });
        }
Esempio n. 2
0
        public AEMG SetupMainWindow()
        {
            //reset working directory
            Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            //set culture
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            var dataIO     = new DataIO();
            var autoMapper = new SimpleAutoMapper();
            var messageBox = new MessageBoxService();
            var repository = new AERepository();
            var mtpManager = new MTPManager();
            var saverepo   = new AESavedSetupRepository();

            var actionProvider  = new ActionProvider(autoMapper, messageBox);
            var aeActionFactory = new AEActionFactory(actionProvider);

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

            var viewModelFactory = new ViewModelFactory(DependencyDict);
            var appSettingVM     = new ApplicationSettingViewModel(actionProvider, viewModelFactory);

            SetupWindowInit(appSettingVM, out IWindowInitlizer windowinit);

            (new ScriptGenerateBootstrap()).SetUp(out IActionToScriptFactory actionToScriptFactory, out IEmulatorToScriptFactory emulatorToScriptFactory);

            var scriptApply       = new ScriptApplyBootStrap(messageBox, mtpManager).GetScriptApplyFactory();
            var scanner           = new MacroScanner(dataIO, aeActionFactory);
            var macroManager      = new AEMacroManager(scanner);
            var macroManagerVM    = new AEMacroManagerViewModel(scanner, messageBox, macroManager, windowinit);
            var aESettingVM       = new AESettingViewModel(new AESetting(), mtpManager);
            var aeScriptGenerator = new AEScriptGenerator(scriptApply, aESettingVM, messageBox, autoMapper, emulatorToScriptFactory, actionToScriptFactory, dataIO, actionProvider);
            var autoUpdater       = new AutoUpdater(messageBox);
            var actionList        = new AEActionListViewModel(macroManager, repository, messageBox);
            var savemanager       = new AEMacroSaveManagerViewModel(saverepo, macroManager);

            return(new AEMG
            {
                DataContext = new AEMGViewModel(macroManagerVM, actionList, aESettingVM, aeScriptGenerator, messageBox, autoUpdater, savemanager, macroManager)
            });
        }