public AutoLocationViewModel(MouseHook mouseHook, AutoLocation autoLocation, MacroManagerViewModel macroManager) { this.autoLocation = autoLocation; this.mouseHook = mouseHook; this.macroManager = macroManager; InitializeCommands(); }
public CustomActionManager(MacroManagerViewModel macroManager, ViewModelFactory viewModelFactory, DataIO dataIO, IMessageBoxService messageBoxService) { this.macroManager = macroManager; this.viewModelFactory = viewModelFactory; this.dataIO = dataIO; this.messageBoxService = messageBoxService; LoadDefault(); LoadCustomActionList(this.savedCustomAction); InitializeCommands(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); //reset working directory Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //set culture Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); 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 clipboard = new ViewModelClipboard(); var recent = new RecentFileManager(); var mtpManager = new MTPManager(); var DependencyDict = new Dictionary <Type, object>() { { typeof(SimpleAutoMapper), autoMapper }, { typeof(MessageBoxService), messageBox }, { typeof(ViewModelClipboard), clipboard }, }; var viewModelFactory = new ViewModelFactory(DependencyDict); (new ScriptGenerateBootstrap()).SetUp(out IActionToScriptFactory actionToScriptFactory, out IEmulatorToScriptFactory emulatorToScriptFactory); var settingVM = new SettingViewModel(Settings.Default(), autoMapper, mtpManager); var macroManagerVM = new MacroManagerViewModel(dataIO, messageBox, viewModelFactory, recent); var scriptApplyFactory = new ScriptApplyBootStrap(messageBox, mtpManager).GetScriptApplyFactory(); var scriptGenerator = new ScriptGenerator(scriptApplyFactory, settingVM, messageBox, emulatorToScriptFactory, actionToScriptFactory); 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, agrs.Any(s => s.Equals(StaticVariables.NO_SAVE_AGRS))); } // 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(); }
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(); }
public ResolutionConverterToolViewModel(ResolutionConverterTool converterTool, MacroManagerViewModel macroManager, IMessageBoxService messageBoxService) { this.converterTool = converterTool; this.macroManager = macroManager; this.messageBoxService = messageBoxService; InitilizeCommandsAndEvents(); }