private void Application_Startup(object sender, StartupEventArgs args) { ITelnetClient telnetClient = new TelnetClient(); model = new Model(telnetClient); model.Connect(ConfigurationManager.AppSettings.Get("DEFAULT_IP"), int.Parse(ConfigurationManager.AppSettings.Get("DEFAULT_PORT"))); model.Start(); dashboardViewModel = new DashboardViewModel(model); mapViewModel = new MapViewModel(model); connectionVM = new ConnectionPanelVM(model); errorsVM = new ErrorsPanelVM(model); controellsVM = new ControllersPanelVM(model); }
/// <summary> /// Constructor for the errors panel view. /// Gets the vm and thus needs to be initialized in the code and not in the xaml. /// </summary> /// <param name="vm"> The View's VM. </param> public ErrorsPanel(IErrorsPanelMessager vm) { InitializeComponent(); this.vm = vm; DataContext = vm; }
/// <summary> /// The constructor. /// Gets it's components. /// </summary> /// <param name="controllersPanelVM"></param> /// <param name="connectionPanelVM"></param> /// <param name="errorsPanelVM"></param> public UserMainPanel(IControllersPanelVM controllersPanelVM, IConnectionPanelVM connectionPanelVM, IErrorsPanelMessager errorsPanelVM) { InitializeComponent(); // Add the controllers panel. ControllersPanel controllersp = new ControllersPanel(controllersPanelVM); controllersp.MouseUpOccurredReleaseJoystick += delegate(object sender, MouseButtonEventArgs e) { this.HandleJoystickMouseUp(sender, e); }; this.RegisterName("controllersPanel", controllersp); mainUserPanel.Children.Add(controllersp); Grid.SetRow(controllersp, 0); // Add the connections panel. ConnectionPanel connectionp = new ConnectionPanel(connectionPanelVM); connectionp.MouseUpOccurredReleaseJoystick += delegate(object sender, MouseButtonEventArgs e) { this.HandleJoystickMouseUp(sender, e); }; mainUserPanel.Children.Add(connectionp); Grid.SetRow(connectionp, 1); // Add the errors panel. ErrorsPanel errorsPanel = new ErrorsPanel(errorsPanelVM); mainUserPanel.Children.Add(errorsPanel); Grid.SetRow(errorsPanel, 2); }