public BriefingController(TacticsController tactics, MainWindow window) { this.tactics = tactics; this.mainwindow = window; adapter = new Briefing(); adapter.NetError += new NetCore.NetCoreErrorHandler(NetCoreErrorHandler); adapter.NetClientEvent += new NetCore.NetClientEventHandler(adapter_NetClientEvent); adapter.ReceiveObservers += new NetCore.NetPackageReceiveHandler(adapter_ReceiveObservers); }
public MainWindow() { Splash splash = new Splash(); splash.ShowDialog(); try { tactics = new TacticsController(this, System.AppDomain.CurrentDomain.BaseDirectory); briefing = new BriefingController(tactics, this); } catch (Exception) { MessageBox.Show("Error: unable to load core files! Please reinstall the application.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } freeBuffer = new List<Point>(); playTimer = new DispatcherTimer(); playTimer.Interval = new TimeSpan(100000); playTimer.IsEnabled = false; playTimer.Tick += new EventHandler(playTimer_Tick); pingTimer = new DispatcherTimer(); pingTimer.Interval = new TimeSpan(2000); pingTimer.IsEnabled = false; pingTimer.Tick += new EventHandler(pingTimer_Tick); InitializeComponent(); stampImage.Source = BitmapSource.Create(100, 100, 96, 96, PixelFormats.BlackWhite, BitmapPalettes.BlackAndWhite, new byte[100 * 20], 20); timePanelGrid.IsEnabled = menuBattleType.IsEnabled = staticPanelGrid.IsEnabled = dynamicPanelGrid.IsEnabled = playPanelGrid.IsEnabled = false; openServer.IsEnabled = kick.IsEnabled = false; briefingPanel.Hide(); foreach (Map map in tactics.getMaps()) { MenuItem newmap = new MenuItem(); newmap.Header = map.name; newmap.Name = "newmapMenuItem_" + map.id; newmap.Click += newmapMenu_Click; newMenu.Items.Add(newmap); } List<StaticIcon> staticIcons = tactics.getStaticIcons(); foreach (StaticIcon icon in staticIcons) { dynamicStaticList.Items.Add(icon); } dynamicStaticList.SelectedIndex = 0; List<DynamicIcon> dynamicIcons = tactics.getDynamicIcons(); dynamicEvents.Items.Add(new DynamicIcon("", "(none)", "")); foreach (DynamicIcon icon in dynamicIcons) { dynamicEvents.Items.Add(icon); } dynamicEvents.SelectedIndex = 0; }