Ejemplo n.º 1
0
        public async new Task <IActionResult> View(string id)
        {
            Device device = deviceRepo.GetDevice(id);
            var    events = eventsRepo.GetEvents(device.Id, 5);

            ViewVM viewModel = new ViewVM();

            viewModel.Device = device;
            viewModel.Events = events;

            AgentApiClient client = new AgentApiClient();

            try
            {
                var response = await client.GetConfiguration(device.Address);

                var hoursWithActivity = eventsRepo.GetEventsForTheLast24Hours(device.Id);
                var last24Hours       = GoogleChartHelpers.To24HourArray(hoursWithActivity);
                ViewData["Last24Hours"] = GoogleChartHelpers.ToGoogleChartString(last24Hours, "Hour", "Count");

                viewModel.Online          = true;
                viewModel.FirewallEnabled = response.FirewallEnabled;
            }
            catch (System.Net.Http.HttpRequestException)
            {
                viewModel.Online = false;
            }

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ViewVM             dialog        = new ViewVM();
            PaymentController  payController = new PaymentController(dialog);
            BeverageController bevController = new BeverageController(dialog);

            dialog.ShowDialog();
        }