-
Notifications
You must be signed in to change notification settings - Fork 5
/
MainContext.as
69 lines (56 loc) · 2.01 KB
/
MainContext.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package
{
import controllers.ShowAboutCommand;
import views.AboutMediator;
import views.AboutView;
import controllers.CloseSettingCommand;
import controllers.CompileCommand;
import controllers.InitModelCommand;
import controllers.SaveConfigCommand;
import controllers.ShowSettingCommand;
import controllers.StartupCommand;
import events.AppEvent;
import events.CompileEvent;
import events.SaveEvent;
import koffee.managers.IPopupManager;
import koffee.managers.PopupManager;
import models.AppModel;
import views.AppMediator;
import views.AppView;
import views.BarMediator;
import views.BarView;
import views.SettingMediator;
import views.SettingView;
import org.robotlegs.base.ContextEvent;
import org.robotlegs.mvcs.Context;
import flash.display.DisplayObjectContainer;
/**
* @author Kevin Cao
*/
public class MainContext extends Context
{
public function MainContext(contextView : DisplayObjectContainer = null)
{
super(contextView, true);
}
override public function startup() : void
{
injector.mapSingleton(AppModel);
var pm : PopupManager = new PopupManager();
pm.init(contextView.stage);
injector.mapValue(IPopupManager, pm);
mediatorMap.mapView(AppView, AppMediator); mediatorMap.mapView(SettingView, SettingMediator);
mediatorMap.mapView(BarView, BarMediator);
mediatorMap.mapView(AboutView, AboutMediator);
commandMap.mapEvent(ContextEvent.STARTUP_COMPLETE, StartupCommand, ContextEvent); commandMap.mapEvent(ContextEvent.STARTUP_COMPLETE, InitModelCommand, ContextEvent);
commandMap.mapEvent(AppEvent.SHOW_SETTING, ShowSettingCommand, AppEvent);
commandMap.mapEvent(AppEvent.CLOSE_SETTING, CloseSettingCommand, AppEvent);
commandMap.mapEvent(AppEvent.SHOW_ABOUT, ShowAboutCommand, AppEvent);
commandMap.mapEvent(CompileEvent.COMPILE_REQUEST, CompileCommand, CompileEvent);
commandMap.mapEvent(SaveEvent.SAVE, SaveConfigCommand, SaveEvent);
super.startup();
}
}
}