Example #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var portListViewModel       = new PortListViewModel();
            var hostListViewModel       = new HostListViewModel();
            var scannerResultsViewModel = new ScannerResultsViewModel();

            var window = new MainWindow();

            var viewModel = new MainWindowViewModel();

            viewModel.PortDetail     = portListViewModel;
            viewModel.HostDetail     = hostListViewModel;
            viewModel.ScannerResults = scannerResultsViewModel;
            viewModel.Initialise();

            EventHandler OnRequestClose = null;

            OnRequestClose = delegate
            {
                viewModel.RequestClose -= OnRequestClose;
                window.Close();
            };

            viewModel.RequestClose += OnRequestClose;
            window.Loaded          += viewModel.OnWindowLoaded;

            window.DataContext = viewModel;

            window.Show();
        }
Example #2
0
 public ActionResult Index()
 {
     try
     {
         var host = _host.GetAll();
         var hlvm = new HostListViewModel
         {
             Hosts = host
         };
         return(View(hlvm));
     }
     catch (Exception ex)
     {
         //Log exception
         return(View(ex.Message, "Error"));
     }
 }