/// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(
            SettingsViewModel settingsViewModel,
            DevicesViewModel devicesViewModel,
            InferenceServer inferenceServer)
        {
            if (settingsViewModel == null)
            {
                throw new ArgumentNullException(nameof(settingsViewModel));
            }
            if (devicesViewModel == null)
            {
                throw new ArgumentNullException(nameof(devicesViewModel));
            }
            if (inferenceServer == null)
            {
                throw new ArgumentNullException(nameof(inferenceServer));
            }
            SettingsViewModel = settingsViewModel;
            DevicesViewModel  = devicesViewModel;
            _inferenceServer  = inferenceServer;

            SaveCommand       = new RelayCommand(() => SaveAll(), () => !IsBusy);
            ShowDeviceCommand = new RelayCommand(() => OnShowDevice(), () => !IsBusy);
            Messenger.Default.Register <NotificationMessage>(this, OnStatusMessage);
            Messenger.Default.Register <DeviceMessage>(this, OnDeviceMessage);

            _startupTask = StartupAsync();
        }
示例#2
0
 public GroupControllerModule()
 {
     _devicesViewModel = new DevicesViewModel();
     _zonesViewModel = new ZonesViewModel();
     _directionsViewModel = new DirectionsViewModel();
     _filtersViewModel = new FiltersViewModel();
 }
示例#3
0
		public override void CreateViewModels()
		{
			ServiceFactory.Layout.AddAlarmGroups(new AlarmGroupsViewModel());
			ServiceFactory.Layout.AddToolbarItem(new GKConnectionIndicatorViewModel());

			DevicesViewModel = new DevicesViewModel();
			DeviceParametersViewModel = new DeviceParametersViewModel();
			ZonesViewModel = new ZonesViewModel();
			GuardZonesViewModel = new GuardZonesViewModel();
			SKDZonesViewModel = new SKDZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			DelaysViewModel = new DelaysViewModel();
			PimsViewModel = new PimsViewModel();
			PumpStationsViewModel = new PumpStationsViewModel();
			MPTsViewModel = new MPTsViewModel();
			DoorsViewModel = new DoorsViewModel();
			AlarmsViewModel = new AlarmsViewModel();
			DaySchedulesViewModel = new DaySchedulesViewModel();
			SchedulesViewModel = new SchedulesViewModel();
			ServiceFactory.Events.GetEvent<ShowGKAlarmsEvent>().Unsubscribe(OnShowAlarms);
			ServiceFactory.Events.GetEvent<ShowGKAlarmsEvent>().Subscribe(OnShowAlarms);
			ServiceFactory.Events.GetEvent<ShowGKDebugEvent>().Unsubscribe(OnShowGKDebug);
			ServiceFactory.Events.GetEvent<ShowGKDebugEvent>().Subscribe(OnShowGKDebug);

			SubscribeShowDelailsEvent();
		}
示例#4
0
		public override void CreateViewModels()
		{
			ServiceFactory.Layout.AddToolbarItem(new ConnectionIndicatorViewModel());
			ServiceFactory.Events.GetEvent<ShowDeviceDetailsEvent>().Subscribe(OnShowDeviceDetails);
			DevicesViewModel = new DevicesViewModel();
			ZonesViewModel = new ZonesViewModel();
		}
示例#5
0
        public async Task <IActionResult> ReadAllDevices()
        {
            var dvm = new DevicesViewModel();

            dvm.devices = await _db.GetAllDevices();

            return(View(dvm));
        }
        public DeviceListPage()
        {
            Title = "Select a Smart Mirror";
            DevicesViewModel vm;

            BindingContext = vm = new DevicesViewModel();
            InitializeComponent();
        }
示例#7
0
        public MainViewModel()
        {
            DataManager.DataManager dataManager = new DataManager.DataManager();
            dataManager.InitializeDatabase();

            DevicesVM   = new DevicesViewModel(new DevicesPresenter.DevicesManager());
            GoToDevices = new RelayCommand(ExecuteGoToDevices);
        }
示例#8
0
 public DevicesPage()
 {
     InitializeComponent();
     BindingContext = vm = new DevicesViewModel()
     {
         Navigation = Navigation
     };
 }
示例#9
0
        public DevicesWindow()
        {
            InitializeComponent();

            IContainer        container        = DependencyResolver.BuildContainer();
            IRequestBus       requestBus       = container.Resolve <IRequestBus>();
            IDeviceRepository deviceRepository = container.Resolve <IDeviceRepository>();

            DataContext = new DevicesViewModel(deviceRepository, requestBus);
        }
示例#10
0
 public GKModuleLoader()
 {
     ServiceFactory.Layout.AddToolbarItem(new GKConnectionIndicatorViewModel());
     ServiceFactory.Events.GetEvent<ShowXDeviceDetailsEvent>().Subscribe(OnShowXDeviceDetails);
     DevicesViewModel = new DevicesViewModel();
     ZonesViewModel = new ZonesViewModel();
     DirectionsViewModel = new DirectionsViewModel();
     JournalsViewModel = new JournalsViewModel();
     ArchiveViewModel = new ArchiveViewModel();
 }
		public DevicePropertiesViewModel(DevicesViewModel devicesViewModel, ElementXDevice elementDevice)
		{
			Title = "Свойства фигуры: Устройство ГК";
			_elementXDevice = elementDevice;
			_devicesViewModel = devicesViewModel;

			RootDevice = AddDeviceInternal(XManager.DeviceConfiguration.RootDevice, null);
			if (SelectedDevice != null)
				SelectedDevice.ExpandToThis();
		}
		public DeviceCommandsViewModel(DevicesViewModel devicesViewModel)
		{
			_devicesViewModel = devicesViewModel;

			ReadConfigurationCommand = new RelayCommand(OnReadConfiguration, CanReadConfiguration);
            WriteConfigCommand = new RelayCommand(OnWriteConfig, CanWriteConfig);
			ShowInfoCommand = new RelayCommand(OnShowInfo, CanShowInfo);
			SynchroniseTimeCommand = new RelayCommand(OnSynchroniseTime, CanSynchroniseTime);
			ReadJournalCommand = new RelayCommand(OnReadJournal, CanReadJournal);
			UpdateFirmwhareCommand = new RelayCommand(OnUpdateFirmwhare, CanUpdateFirmwhare);
		}
        // GET: Device
        public ActionResult Index()
        {
            var devices = _deviceService.Get();

            var deviceVM = new DevicesViewModel()
            {
                Devices = devices
            };

            return(View(deviceVM));
        }
示例#14
0
        public DevicesPage()
        {
            InitializeComponent();

            BindingContext = viewModel = new DevicesViewModel();


            MessagingCenter.Subscribe <string>(this, "messageDevices", (string message) =>
            {
                DisplayAlert(viewModel.Title, message, "Ok");
            });
        }
示例#15
0
        public MainPageViewModel(Dispatcher dispatcher,
                                 Storage storage,
                                 Configuration configuration,
                                 AlarmSound alarmSound,
                                 MainWindowViewModel mainWindowViewModel)
        {
            _alarms   = new AlarmsViewModel(dispatcher, storage, configuration, alarmSound, mainWindowViewModel);
            _devices  = new DevicesViewModel(dispatcher, storage, mainWindowViewModel);
            _programs = new ProgramsViewModel();

            SelectedTab = _alarms;
        }
示例#16
0
        public DevicesView()
        {
            InitializeComponent();

            DataContext = new DevicesViewModel();

            detailTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(2)
            };
            detailTimer.Tick += RefreshDetailInfo;
            detailTimer.Start();
        }
示例#17
0
        public object Execute(DevicesArgs args)
        {
            var model = new DevicesViewModel();

            int waveInDevices = WaveIn.DeviceCount;

            for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++)
            {
                WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice);
                model.Devices.Add($"Device {waveInDevice}: {deviceInfo.ProductName}, {deviceInfo.Channels} channels");
            }

            return(View("Devices", model));
        }
示例#18
0
        public async Task <IActionResult> Edit(int id, [Bind("DeviceId,DeviceName,Description,DeviceTypeTypeId")] DevicesViewModel vm)
        {
            if (id != vm.DeviceId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                var device = new Device()
                {
                    DeviceId    = vm.DeviceId,
                    DeviceName  = vm.DeviceName,
                    Description = vm.Description,
                    DeviceType  = _context.DeviceTypes.First(x => x.TypeId == int.Parse(vm.DeviceTypeTypeId)),
                    AddedBy     = _context.Users.Find(_userManager.GetUserId(User))
                };

                try
                {
                    _context.Update(device);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DeviceExists(device.DeviceId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            var lst = _context
                      .DeviceTypes
                      .Select(x => new SelectListItem(x.TypeName, x.TypeId.ToString()))
                      .ToList();

            ViewBag.DeviceTypes = lst;
            return(View(new DevicesViewModel()
            {
                DeviceId = vm.DeviceId,
                DeviceName = vm.DeviceName,
                Description = vm.Description,
                DeviceTypeTypeId = vm.DeviceTypeTypeId.ToString()
            }));
        }
示例#19
0
		public override void CreateViewModels()
		{
			ServiceFactory.Events.GetEvent<CreateZoneEvent>().Subscribe(OnCreateZone);
			ServiceFactory.Events.GetEvent<EditZoneEvent>().Subscribe(OnEditZone);
			ServiceFactory.Events.GetEvent<ShowDeviceEvent>().Subscribe(OnShowDevice);

			DevicesViewModel = new DevicesViewModel();
			DeviceParametersViewModel = new DeviceParametersViewModel();
			ParameterTemplatesViewModel = new ParameterTemplatesViewModel();
			ZonesViewModel = new ZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			GuardViewModel = new GuardViewModel();
			SimulationViewModel = new SimulationViewModel();
			_planExtension = new PlanExtension(DevicesViewModel, ZonesViewModel);
		}
示例#20
0
        public DeviceCommandsViewModel(DevicesViewModel devicesViewModel)
        {
            ConvertFromFiresecCommand = new RelayCommand(OnConvertFromFiresec);
            ConvertToBinCommand = new RelayCommand(OnConvertToBin);
            ConvertToBinaryFileCommand = new RelayCommand(OnConvertToBinaryFile);

            SynchroniseTimeCommand = new RelayCommand(OnSynchroniseTime, CanSynchroniseTime);
            ReadJournalCommand = new RelayCommand(OnReadJournal, CanReadJournal);
            WriteConfigCommand = new RelayCommand(OnWriteConfig);
            GetParametersCommand = new RelayCommand(OnGetParameters);
            WriteParametersCommand = new RelayCommand(OnWriteParameters);
            UpdateFirmwhareCommand = new RelayCommand(OnUpdateFirmwhare, CanUpdateFirmwhare);

            _devicesViewModel = devicesViewModel;
        }
示例#21
0
        public async void StartReceive()
        {
            try
            {
                PropertyService property = new PropertyService();
                await Connect(property.Read(Property.User.token).ToString());

                while (socket.State == WebSocketState.Open)
                {
                    ArraySegment <byte> bytes = new ArraySegment <byte>(new byte[1024]);

                    WebSocketReceiveResult result = await socket.ReceiveAsync(bytes, CancellationToken.None);

                    string values = Encoding.UTF8.GetString(bytes.Array, 0, result.Count);

                    string deviceName = jsonService.ReadJson(values, Property.Device.name);
                    string state      = jsonService.ReadJson(values, Property.Log.state);

                    if (state == "create")
                    {
                        DependencyService.Get <DIPushAlarm>().Create(deviceName);
                        DevicesViewModel.GetInstance().Init();
                    }

                    else
                    {
                        bool isClosed       = bool.Parse(jsonService.ReadJson(values, Property.Log.state));
                        bool userOpenAlert  = bool.Parse(property.Read(Property.User.openAlert).ToString());
                        bool userCloseAlert = bool.Parse(property.Read(Property.User.closeAlert).ToString());

                        if ((!isClosed && userOpenAlert) || (isClosed && userCloseAlert))
                        {
                            DependencyService.Get <DIPushAlarm>().Update(deviceName, isClosed);
                        }
                    }
                }
            }

            catch
            {
            }

            finally
            {
                socket.Dispose();
                DependencyService.Get <DIForeground>().StopRun();
            }
        }
示例#22
0
        // GET: Devices/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Device _model     = db.Devices.Find(id);
            var    _viewModel = DevicesViewModel.GetViewModelDatas(_model);

            if (_model == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DeviceID = new SelectList(db.DeviceDocuments, "DeviceID", "ActPuttingOperationFileName", _model.DeviceID);
            return(View(_viewModel));
        }
示例#23
0
		public DeviceCommandsViewModel(DevicesViewModel devicesViewModel)
		{
			_devicesViewModel = devicesViewModel;

			ReadConfigurationCommand = new RelayCommand(OnReadConfiguration, CanReadConfiguration);
			ReadConfigFileCommand = new RelayCommand(OnReadConfigFile, CanReadConfigFile);
			WriteConfigCommand = new RelayCommand(OnWriteConfig, CanWriteConfig);
			ShowInfoCommand = new RelayCommand(OnShowInfo, CanShowInfo);
			SynchroniseTimeCommand = new RelayCommand(OnSynchroniseTime, CanSynchroniseTime);
			ReadJournalCommand = new RelayCommand(OnReadJournal, CanReadJournal);
			//UpdateFirmwareCommand = new RelayCommand(OnUpdateFirmware, CanUpdateFirmware);
			AutoSearchCommand = new RelayCommand(OnAutoSearch, CanAutoSearch);
			GetUsersCommand = new RelayCommand(OnGetUsers, CanGetUsers);
			RewriteUsersCommand = new RelayCommand(OnRewriteUsers, CanRewriteUsers);
			RewriteAllSchedulesCommand = new RelayCommand(OnRewriteAllSchedules, CanRemoveAllSchedules);
		}
示例#24
0
        public ActionResult Laptops()
        {
            ViewData["Title"] = "Laptops";

            var laptops = this.laptopsService
                          .GetAll()
                          .OrderByDescending(x => x.ModifiedOn)
                          .ProjectTo <LaptopViewModel>()
                          .ToList();

            var viewModel = new DevicesViewModel()
            {
                Laptops = laptops
            };

            return(PartialView(viewModel));
        }
示例#25
0
        static async Task Main(string[] args)
        {
            var devicesViewModel = new DevicesViewModel();

            var initialDeviceHeaders = new DeviceHeaderEntity[] {
                new DeviceHeaderEntity()
                {
                    Serial = "5", State = new DeviceHeaderStateEntity()
                },
                new DeviceHeaderEntity()
                {
                    Serial = "2", State = new DeviceHeaderStateEntity()
                },
                new DeviceHeaderEntity()
                {
                    Serial = "3", State = new DeviceHeaderStateEntity()
                    {
                        IsFactory = false
                    }
                }
            };

            var deviceHeaders = new DeviceHeaderEntity[] {
                new DeviceHeaderEntity()
                {
                    Serial = "1", State = new DeviceHeaderStateEntity()
                },
                new DeviceHeaderEntity()
                {
                    Serial = "3", State = new DeviceHeaderStateEntity()
                    {
                        IsFactory = true
                    }
                },
                new DeviceHeaderEntity()
                {
                    Serial = "5", State = new DeviceHeaderStateEntity()
                }
            };

            await devicesViewModel.UpdateDevicesAsync(initialDeviceHeaders);

            await devicesViewModel.UpdateDevicesAsync(deviceHeaders);

            ;
        }
        public DeviceCommandsViewModel(DevicesViewModel devicesViewModel)
        {
            AutoDetectCommand = new RelayCommand(OnAutoDetect, CanAutoDetect);
            ReadDeviceCommand = new RelayCommand<bool>(OnReadDevice, CanReadDevice);
            WriteDeviceCommand = new RelayCommand<bool>(OnWriteDevice, CanWriteDevice);
            WriteAllDeviceCommand = new RelayCommand(OnWriteAllDevice, CanWriteAllDevice);
            SynchronizeDeviceCommand = new RelayCommand<bool>(OnSynchronizeDevice, CanSynchronizeDevice);
            UpdateSoftCommand = new RelayCommand<bool>(OnUpdateSoft, CanUpdateSoft);
            GetDescriptionCommand = new RelayCommand<bool>(OnGetDescription, CanGetDescription);
            GetDeviceJournalCommand = new RelayCommand<bool>(OnGetDeviceJournal, CanGetDeviceJournal);
            SetPasswordCommand = new RelayCommand<bool>(OnSetPassword, CanSetPassword);
            BindMsCommand = new RelayCommand(OnBindMs, CanBindMs);
            ExecuteCustomAdminFunctionsCommand = new RelayCommand<bool>(OnExecuteCustomAdminFunctions, CanExecuteCustomAdminFunctions);
			ConvertCommand = new RelayCommand(OnConvert);

            DevicesViewModel = devicesViewModel;
        }
示例#27
0
        public ActionResult Displays()
        {
            ViewData["Title"] = "Displays";

            var displays = this.displaysService
                           .GetAll()
                           .OrderByDescending(x => x.ModifiedOn)
                           .ProjectTo <DisplayViewModel>()
                           .ToList();

            var viewModel = new DevicesViewModel()
            {
                Displays = displays
            };

            return(PartialView(viewModel));
        }
示例#28
0
        public ActionResult Computers()
        {
            ViewData["Title"] = "Computers";

            var computers = this.computersService
                            .GetAll()
                            .OrderByDescending(x => x.ModifiedOn)
                            .ProjectTo <ComputerViewModel>()
                            .ToList();

            var viewModel = new DevicesViewModel()
            {
                Computers = computers
            };

            return(PartialView(viewModel));
        }
示例#29
0
        // GET: Devices
        public ActionResult Index(string searchString, int?page)
        {
            #region DefaultCode
            //var devices = db.Devices.Include(d => d.DeviceDocument);
            //return View(devices.ToList());

            #endregion // end of DefaultCode


            #region LINQ Expression
            //var qData = from q in db.Devices.Include(d => d.DeviceDocument) select q;

            var qData = (from q in db.Devices.Include(d => d.DeviceDocument) select q).OrderBy(s => s.Vendor).Skip(0);
            if (!string.IsNullOrEmpty(searchString))
            {
                qData = qData.Where(s => s.DeviceType.Contains(searchString));
            }

            int pageSize   = 8;
            int pageNumber = (page ?? 1);

            var _viewModel = new List <DevicesViewModel>();
            foreach (var item in qData)
            {
                _viewModel.Add(DevicesViewModel.GetViewModelDatas(item));
            }

            return(View("Index", _viewModel.ToPagedList(pageNumber, pageSize)));

            //return View(_listViewModel.ToPagedList(pageNumber, pageSize));

            #endregion // end of LINQ Expression

            #region List
            //var _model = db.Devices.Include(d => d.DeviceDocument);
            //var _viewModel = new List<DevicesViewModel>();

            //foreach (var item in _model)
            //{
            //    _viewModel.Add(DevicesViewModel.GetViewModelDatas(item));
            //}

            //return View(_viewModel);
            #endregion // end of List
        }
示例#30
0
        public async Task <IActionResult> Create([Bind("DeviceName,Description,DeviceTypeTypeId,Files")] DevicesViewModel vm)
        {
            if (ModelState.IsValid)
            {
                Device device = new Device()
                {
                    DeviceName  = vm.DeviceName,
                    Description = vm.Description,
                    DeviceType  = _context.DeviceTypes.First(x => x.TypeId == int.Parse(vm.DeviceTypeTypeId)),
                    AddedBy     = _context.Users.Find(_userManager.GetUserId(User))
                };
                _context.Add(device);
                await _context.SaveChangesAsync();

                //Convert the list of files into a list of images and thumbnails
                var lst = MakeImageList(vm.Files, device);

                //Save the image(s) to the database, presuming there's anything to save
                if (lst.Count > 0)
                {
                    await _context.AddRangeAsync(lst);

                    await _context.SaveChangesAsync();
                }
                else
                {
                    //If there are no attached images (for whatever reason), send it back
                    ViewBag.DeviceTypes = _context
                                          .DeviceTypes
                                          .Select(x => new SelectListItem(x.TypeName, x.TypeId.ToString()))
                                          .ToList();

                    return(View());
                }

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.DeviceTypes = _context
                                  .DeviceTypes
                                  .Select(x => new SelectListItem(x.TypeName, x.TypeId.ToString()))
                                  .ToList();
            return(View());
        }
示例#31
0
        public ActionResult Computers(int?page)
        {
            ViewData["Title"] = "Computers";

            var computers = this.computersService
                            .GetAll()
                            .OrderByDescending(x => x.ModifiedOn)
                            .ProjectTo <ComputerViewModel>()
                            .ToList();

            var viewModel = new DevicesViewModel()
            {
                Computers = computers
            };

            var pageNumber = page ?? 1;
            var pageSize   = 10;

            return(View(viewModel.Computers.ToPagedList(pageNumber, pageSize)));
        }
示例#32
0
        public ActionResult Displays(int?page)
        {
            ViewData["Title"] = "Displays";

            var displays = this.displaysService
                           .GetAll()
                           .OrderByDescending(x => x.ModifiedOn)
                           .ProjectTo <DisplayViewModel>()
                           .ToList();

            var viewModel = new DevicesViewModel()
            {
                Displays = displays
            };

            var pageNumber = page ?? 1;
            var pageSize   = 10;

            return(View(viewModel.Displays.ToPagedList(pageNumber, pageSize)));
        }
示例#33
0
        public ActionResult Laptops(int?page)
        {
            ViewData["Title"] = "Laptops";

            var laptops = this.laptopsService
                          .GetAll()
                          .OrderByDescending(x => x.ModifiedOn)
                          .ProjectTo <LaptopViewModel>()
                          .ToList();

            var viewModel = new DevicesViewModel()
            {
                Laptops = laptops
            };

            var pageNumber = page ?? 1;
            var pageSize   = 10;

            return(View(viewModel.Laptops.ToPagedList(pageNumber, pageSize)));
        }
示例#34
0
		public override void CreateViewModels()
		{
			SKDManager.UpdateConfiguration();

			ServiceFactory.Events.GetEvent<ShowSkudEvent>().Unsubscribe(OnShowSkud);
			ServiceFactory.Events.GetEvent<ShowSkudEvent>().Subscribe(OnShowSkud);

			_skudViewModel = new SkudViewModel();
			_employeeCardIndexViewModel = new EmployeeCardIndexViewModel();
			_employeeDepartmentsViewModel = new EmployeeDepartmentsViewModel();
			_employeeGroupsViewModel = new EmployeeGroupsViewModel();
			_employeePositionsViewModel = new EmployeePositionsViewModel();
			_passCardDesignerViewModel = new PassCardsDesignerViewModel();
			DevicesViewModel = new DevicesViewModel();
			LibraryViewModel = new LibraryViewModel();
			TimeIntervalsViewModel = new TimeIntervalsViewModel();
			SlideDayIntervalsViewModel = new SlideDayIntervalsViewModel();
			SlideWeekIntervalsViewModel = new SlideWeekIntervalsViewModel();
			WeeklyIntervalsViewModel = new WeeklyIntervalsViewModel();
			HolidaysViewModel = new HolidaysViewModel();
		}
示例#35
0
        public async Task <IActionResult> Devices()
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }
            using (var context = _context){
                user = context.Users.Include(ApplicationUser => ApplicationUser.Devices)
                       .Include(ApplicationUser => ApplicationUser.MedicalSensorData)
                       .Single(u => u.Id == user.Id);
            }

            var model = new DevicesViewModel
            {
                Devices = user.Devices.ToList()
            };

            return(View(model));
        }
        /// <summary>
        /// Metoda NavigationHelper'a. Pobiera dane przekazywane z widoku źródłowego (DevicesPage).
        /// deviceId jest argumentem przekazywanym z widoku Produktów.
        /// Następnie ładowany jest ViewModel DevicesViewModel by pobrać nazwę urządzenia (w celu wyświetlenia jako nagłówek strony)
        /// Komentarze dla danego produkty są pobierane z bazy danych oraz przypisywane do listy i wyświetlane.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            navigationHelper.OnNavigatedTo(e);



            var deviceID = (long)e.Parameter;

            var commViewModel = DevicesViewModel.GetDefault();

            pageTitle.Text = commViewModel.GetItem(deviceID).Name;

            if (viewModel != null && (deviceID == viewModel.DeviceId) && (timestamp >= viewModel.Timestamp))
            {
                return;
            }

            viewModel = CommentsViewModel.GetForDeviceId(deviceID);
            CommentsList.ItemsSource = viewModel.GetAllItems();

            timestamp = DateTime.Now;
        }
示例#37
0
		public override void CreateViewModels()
		{
			ServiceFactory.Events.GetEvent<CreateXZoneEvent>().Subscribe(OnCreateXZone);
			ServiceFactory.Events.GetEvent<EditXZoneEvent>().Subscribe(OnEditXZone);
			ServiceFactory.Events.GetEvent<CreateXDirectionEvent>().Subscribe(OnCreateXDirection);
			ServiceFactory.Events.GetEvent<EditXDirectionEvent>().Subscribe(OnEditXDirection);

			DevicesViewModel = new DevicesViewModel();
			ParameterTemplatesViewModel = new ParameterTemplatesViewModel();
			ZonesViewModel = new ZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			PumpStationsViewModel = new PumpStationsViewModel();
			GuardViewModel = new GuardViewModel();
			FiltersViewModel = new FiltersViewModel();
			DeviceLidraryViewModel = new LibraryViewModel();
			InstructionsViewModel = new InstructionsViewModel();
			OPCDevicesViewModel = new OPCDevicesViewModel();
			OPCZonesViewModel = new OPCZonesViewModel();
			OPCDirectionsViewModel = new OPCDirectionsViewModel();
			DiagnosticsViewModel = new DiagnosticsViewModel();
			DescriptorsViewModel = new DescriptorsViewModel();
			_planExtension = new GKPlanExtension(DevicesViewModel, ZonesViewModel, DirectionsViewModel);
		}
示例#38
0
 public ActionResult Edit(DevicesViewModel _viewModel)
 {
     if (ModelState.IsValid)
     {
         Device _model = new Device()
         {
             DeviceID        = _viewModel.DeviceID,
             DeviceType      = _viewModel.DeviceType.ToString(),
             Vendor          = _viewModel.Vendor.ToString(),
             Model           = _viewModel.Model,
             VendorArticle   = _viewModel.VendorArticle,
             SerialNumber    = _viewModel.SerialNumber,
             InventoryNumber = _viewModel.InventoryNumber,
             NoteDevice      = _viewModel.NoteDevice,
             ChangeDateTime  = _viewModel.ChangeDateTime
         };
         db.Entry(_model).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DeviceID = new SelectList(db.DeviceDocuments, "DeviceID", "ActPuttingOperationFileName", _viewModel.DeviceID);
     return(View(_viewModel));
 }
        public DeviceListPage()
        {
            InitializeComponent();
            vm             = new DevicesViewModel();
            BindingContext = vm;

            DevicesList.ItemSelected += async(object sender, SelectedItemChangedEventArgs e) =>
            {
                if (e.SelectedItem == null)
                {
                    return;
                }

                IDevice selectedDevice = e.SelectedItem as IDevice;
                await Navigation.PushAsync(new DeviceServicesPage(selectedDevice));

                ((ListView)sender).SelectedItem = null;
            };

            InstructionsButton.Clicked += (sender, e) =>
            {
                Navigation.PushAsync(new InstructionsPage());
            };
        }
示例#40
0
		public override void CreateViewModels()
		{
			ServiceFactory.Events.GetEvent<SelectGKZoneEvent>().Subscribe(OnSelectGKZone);
			ServiceFactory.Events.GetEvent<SelectGKZonesEvent>().Subscribe(OnSelectGKZones);
			ServiceFactory.Events.GetEvent<SelectGKGuardZoneEvent>().Subscribe(OnSelectGKGuardZone);
			ServiceFactory.Events.GetEvent<SelectGKGuardZonesEvent>().Subscribe(OnSelectGKGuardZones);
			ServiceFactory.Events.GetEvent<SelectGKDelayEvent>().Subscribe(OnSelectGKDelay);
			ServiceFactory.Events.GetEvent<SelectGKDelaysEvent>().Subscribe(OnSelectGKDelays);
			ServiceFactory.Events.GetEvent<SelectGKDirectionEvent>().Subscribe(OnSelectGKDirection);
			ServiceFactory.Events.GetEvent<SelectGKDirectionsEvent>().Subscribe(OnSelectGKDirections);
			ServiceFactory.Events.GetEvent<SelectGKMPTEvent>().Subscribe(OnSelectGKMPT);
			ServiceFactory.Events.GetEvent<SelectGKMPTsEvent>().Subscribe(OnSelectGKMPTs);
			ServiceFactory.Events.GetEvent<SelectGKDoorEvent>().Subscribe(OnSelectGKDoor);
			ServiceFactory.Events.GetEvent<SelectGKDoorsEvent>().Subscribe(OnSelectGKDoors);
			ServiceFactory.Events.GetEvent<SelectGKDeviceEvent>().Subscribe(OnSelectGKDevice);
			ServiceFactory.Events.GetEvent<SelectGKDevicesEvent>().Subscribe(OnSelectGKDevices);
			ServiceFactory.Events.GetEvent<SelectGKPumpStationEvent>().Subscribe(OnSelectGKPumpStation);
			ServiceFactory.Events.GetEvent<SelectGKPumpStationsEvent>().Subscribe(OnSelectGKPumpStations);

			DevicesViewModel = new DevicesViewModel();
			ParameterTemplatesViewModel = new ParameterTemplatesViewModel();
			ZonesViewModel = new ZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			DelaysViewModel = new DelaysViewModel();
			PumpStationsViewModel = new PumpStationsViewModel();
			MPTsViewModel = new MPTsViewModel();
			CodesViewModel = new CodesViewModel();
			GuardZonesViewModel = new GuardZonesViewModel();
			DoorsViewModel = new DoorsViewModel();
			SKDZonesViewModel = new SKDZonesViewModel();
			DeviceLidraryViewModel = new LibraryViewModel();
			OPCViewModel = new OPCsViewModel();
			DescriptorsViewModel = new DescriptorsViewModel();
			DiagnosticsViewModel = new DiagnosticsViewModel();
			_planExtension = new GKPlanExtension();
		}
示例#41
0
        public async Task <ActionResult> Index()
        {
            IEnumerable <string> devices = await _serverService.GetAllConnectedDevicesIdAsync();

            List <DeviceViewModel> devicesViewModel = new List <DeviceViewModel>();

            foreach (string deviceId in devices)
            {
                DeviceViewModel currenteDevice = new DeviceViewModel
                {
                    DeviceId  = deviceId,
                    Threshold = await GetThresholdAsync(deviceId)
                };
                devicesViewModel.Add(currenteDevice);
            }

            DevicesViewModel model = new DevicesViewModel()
            {
                DevicesConnected = await _serverService.GetConnectedDeviceCountAsync(),
                Devices          = devicesViewModel
            };

            return(View(model));
        }
示例#42
0
		public override void CreateViewModels()
		{
			ServiceFactory.Layout.AddAlarmGroups(new AlarmGroupsViewModel());
			ServiceFactory.Layout.AddToolbarItem(new GKConnectionIndicatorViewModel());
			ServiceFactory.Events.GetEvent<ShowXJournalEvent>().Unsubscribe(OnShowJournal);
			ServiceFactory.Events.GetEvent<ShowXJournalEvent>().Subscribe(OnShowJournal);
			ServiceFactory.Events.GetEvent<NewXJournalEvent>().Unsubscribe(OnNewJournalRecord);
			ServiceFactory.Events.GetEvent<NewXJournalEvent>().Subscribe(OnNewJournalRecord);
			DevicesViewModel = new DevicesViewModel();
			ZonesViewModel = new ZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			DelaysViewModel = new DelaysViewModel();
			PimsViewModel = new PimsViewModel();
			PumpStationsViewModel = new PumpStationsViewModel();
			JournalsViewModel = new JournalsViewModel();
			ArchiveViewModel = new ArchiveViewModel();
			AlarmsViewModel = new AlarmsViewModel();
			ServiceFactory.Events.GetEvent<ShowXAlarmsEvent>().Unsubscribe(OnShowAlarms);
			ServiceFactory.Events.GetEvent<ShowXAlarmsEvent>().Subscribe(OnShowAlarms);
			ServiceFactory.Events.GetEvent<ShowXArchiveEvent>().Unsubscribe(OnShowArchive);
			ServiceFactory.Events.GetEvent<ShowXArchiveEvent>().Subscribe(OnShowArchive);
			ServiceFactory.Events.GetEvent<ShowGKDebugEvent>().Unsubscribe(OnShowGKDebug);
			ServiceFactory.Events.GetEvent<ShowGKDebugEvent>().Subscribe(OnShowGKDebug);
		}
示例#43
0
 /// <summary>
 /// Metoda ładująca dane do listy Produktów.
 /// By poprawnie wyświetlić dane ładowany jest ViewModel napisany specjalnie dla tego widoku.
 /// ViewModel jest potrzebny, by poprawnie załadować dane z bazy SQLite.
 /// Następnie pobrane dane z ViewModel'u ładowane są do kontrolki ListView i prezentowane na odpowiedniej stronie aplikacji.
 /// </summary>
 private void LoadData()
 {
     viewModel = DevicesViewModel.GetDefault();
     DevicesListView.ItemsSource = viewModel.GetAllItems();
 }
示例#44
0
 public PropertiesViewModel(DevicesViewModel deviceViewModel)
 {
     Context = deviceViewModel;
 }
 /// <summary>
 /// Metoda ładująca dane do listy Produktów.
 /// By poprawnie wyświetlić dane ładowany jest ViewModel napisany specjalnie dla tego widoku.
 /// ViewModel jest potrzebny, by poprawnie załadować dane z bazy SQLite.
 /// Następnie pobrane dane z ViewModel'u ładowane są do kontrolki ListView i prezentowane na odpowiedniej stronie aplikacji.
 /// </summary>
 private void LoadData()
 {
     viewModel = DevicesViewModel.GetDefault();
     DevicesListView.ItemsSource = viewModel.GetAllItems();
 }
 public DevicesView()
 {
     InitializeComponent();
     BindingContext = DevicesViewModel.GetInstance();
     DevicesViewModel.GetInstance().Init();
 }
示例#47
0
		public void ChangeDriverDeviceTest()
		{
			var mpt = new GKMPT();
			var am1Device = CreateDevice(GKDriverType.RSR2_AM_1);
			var mptDevice = new GKMPTDevice { Device = am1Device, DeviceUID = am1Device.UID, MPTDeviceType = GKMPTDeviceType.HandStart };
			mpt.MPTDevices.Add(mptDevice);
			GKManager.DeviceConfiguration.MPTs.Add(mpt);
			CreateGroupControllerModule();
			ClientManager.PlansConfiguration = new RubezhAPI.Models.PlansConfiguration();
			var devicesViewModel = new DevicesViewModel();
			devicesViewModel.Initialize();
			var deviceViewModel = devicesViewModel.AllDevices.FirstOrDefault(x => x.Device == am1Device);
			var mptViewModel = GroupControllerModule.MPTsViewModel.MPTs[0];
			Assert.IsTrue(mpt.MPTDevices.Count == 1);
			Assert.IsTrue(mpt.InputDependentElements.Count == 1 && mpt.InputDependentElements[0] == am1Device);
			Assert.IsTrue(mptViewModel.Devices.Count == 1 && mptViewModel.Devices[0].MPTDevice.Device.DriverType == GKDriverType.RSR2_AM_1);

			var cardReaderDriver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_CardReader);
			deviceViewModel.Driver = cardReaderDriver;
			Assert.IsTrue(mpt.MPTDevices.Count == 0);
			Assert.IsTrue(mpt.InputDependentElements.Count == 0);
			Assert.IsTrue(mptViewModel.Devices.Count == 1);
			GroupControllerModule.MPTsViewModel.OnShow();
			Assert.IsTrue(mptViewModel.Devices.Count == 0);
		}
示例#48
0
		public DevicesMenuViewModel(DevicesViewModel devicesViewModel)
		{
			Context = devicesViewModel;
		}