Example #1
0
        public NotificationViewModel(IUnitOfWork unitOfWork, UaClientApi uaClientApi, Messenger messenger)
        {
            _uaClientApi = uaClientApi;
            _unitOfWork  = unitOfWork;
            _messenger   = messenger;

            _subscription = _uaClientApi.Subscribe(300, "Notifications");

            if (_subscription == null)
            {
                IoC.AppManager.ShowWarningMessage("Subscription creation failed, please restart application!");
            }

            LoadAndRegisterNotifications();

            NotificationListVm = new NotificationListViewModel();

            AddNotificationCommand        = new MixRelayCommand(AddNotification, AddNotificationCanUse);
            RemoveNotificationCommand     = new MixRelayCommand(RemoveNotification, RemoveNotificationCanUse);
            DeleteAllNotificationsCommand = new MixRelayCommand(DeleteAllNotifications, DeleteAllCanUse);

            _messenger.Register <SendSelectedRefNode>(msg => _selectedNode = msg.ReferenceNode);

            _messenger.Register <SendNewNotification>(msg => AddNotificationToSubscription(msg.Notification));
        }
Example #2
0
        public MenuToolBarViewModel(IUnitOfWork iUnitOfWork, UaClientApi uaClientApi)
        {
            _iUnitOfWork = iUnitOfWork;
            _uaClientApi = uaClientApi;

            DisconnectSessionCommand = new MixRelayCommand(DisconnectSession);
            SaveProjectCommand       = new MixRelayCommand(SaveProject, SaveprojectCanUse);

            IoC.AppManager.Timer = new Timer(SessionState, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5));
        }
Example #3
0
        public MenuBarViewModel(IUnitOfWork iUnitOfWork)
        {
            _iUnitOfWork = iUnitOfWork;

            NewProjectCommand      = new MixRelayCommand((obj) => GoToPageIfSaved(ApplicationPage.Endpoints));
            SaveProjectCommand     = new MixRelayCommand((obj) => _iUnitOfWork.CompleteAsync(), SaveprojectCanUse);
            OpenProjectCommand     = new MixRelayCommand((obj) => GoToPageIfSaved(ApplicationPage.Welcome));
            ExitApplicationCommand = new MixRelayCommand((obj) =>
            {
                IoC.AppManager.Timer.Dispose();
                IoC.AppManager.CloseApplication();
            });
            OpenGitHubCommand = new MixRelayCommand((obj) => Process.Start("https://github.com/magiino/BakalarskaPraca-OpcUa.Client"));
        }
Example #4
0
        public NodeAttributesViewModel(UaClientApi uaClientApi, Messenger messenger)
        {
            _uaClientApi = uaClientApi;

            WriteValueCommand = new MixRelayCommand(WriteValue);
            ReadValueCommand  = new MixRelayCommand(ReadValue);

            messenger.Register <SendSelectedRefNode>(
                msg =>
            {
                ReferenceDescription = msg.ReferenceNode;
                UpdateValues(ReferenceDescription);
            });
        }
Example #5
0
        public WelcomeViewModel(IUnitOfWork iUnitOfWork, UaClientApi uaClientApi, Messenger messenger)
        {
            _messenger   = messenger;
            _uaClientApi = uaClientApi;
            _unitOfWork  = iUnitOfWork;

            OnLoad();

            LoadProjectCommand   = new MixRelayCommand(LoadProject, LoadAndDeleteProjectCanUse);
            DeleteProjectCommand = new MixRelayCommand(DeleteProject, LoadAndDeleteProjectCanUse);
            CreateProjectCommand = new MixRelayCommand((obj) => IoC.Application.GoToPage(ApplicationPage.Endpoints));

            _messenger.Register <SendCredentials>(msg => Login(msg.UserName, msg.Password));
        }
Example #6
0
        public ArchiveViewModel(IUnitOfWork unitOfWork, UaClientApi uaClientApi, Messenger messenger)
        {
            _unitOfWork  = unitOfWork;
            _uaClientApi = uaClientApi;
            _messenger   = messenger;

            OnLoad();

            AddVariableToArchiveCommand      = new MixRelayCommand(AddVariableToArchive, AddVariableCanUse);
            DeleteVariableFromArchiveCommand = new MixRelayCommand(DeleteVariableFromArchive, DeleteVariableCanUse);
            StartArchiveCommand = new MixRelayCommand(StartArchive, StartArchiveCanUse);
            StopArchiveCommand  = new MixRelayCommand(StopArchive, StopArchiveCanUse);

            _messenger.Register <SendSelectedRefNode>(msg => _selectedNode = msg.ReferenceNode);
        }
Example #7
0
        public LiveChartViewModel(UaClientApi uaClientApi, Messenger messenger)
        {
            _uaClientApi = uaClientApi;

            _subscription = _uaClientApi.Subscribe(2000, "LiveCharts");

            if (_subscription == null)
            {
                IoC.AppManager.ShowWarningMessage("Subscription creation failed, please restart application!");
            }

            AddCommand    = new MixRelayCommand(AddVariable, AddVariableCanUse);
            RemoveCommand = new MixRelayCommand(RemoveVariable, RemoveVariableCanUse);

            // Nastavenia grafu
            DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss");
            AxisStep          = TimeSpan.FromSeconds(15).Ticks;
            AxisUnit          = TimeSpan.TicksPerSecond;
            SetAxisLimits(DateTime.Now);

            messenger.Register <SendSelectedRefNode>(msg => _selectedNode = msg.ReferenceNode);
        }