Esempio n. 1
0
        public ConnectionPageViewModel(
            INavigationService navigationService,
            IUnityContainer container,
            INotification notification,
            IUserDialogs userDialogs)
        {
            this.userDialogs         = userDialogs;
            this.container           = container;
            this.navigationService   = navigationService;
            this.notificationService = notification;

            connection            = new QTMNetworkConnection();
            CurrentConnectionMode = ConnectionMode.NONE;

            RefreshQTMServers = new DelegateCommand(() => Task.Run(() => LoadQTMServers()));

            ConnectionModeDiscoveryCommand = new DelegateCommand(() => {
                LoadQTMServers();
                IsDiscovery = true;
            }).ObservesCanExecute(() => IsDiscoverButtonEnabled);

            ConnectionModeManuallyCommand = new DelegateCommand(() => { IsManually = true; }).ObservesCanExecute(() => IsManualButtonEnabled);
            ConnectionModeDemoCommand     = new DelegateCommand(() => Task.Run(() => StartDemoMode()));

            ConnectCommand = new DelegateCommand(() => Task.Run(() => OnConnectionStarted()));

            OnAboutButtonPressedCommand = new DelegateCommand(() => OnAboutButtonPressed());

            OnQualisysLinkTappedCommand = new DelegateCommand(() => Device.OpenUri(new Uri("http://www.qualisys.com/start/")));

            // Get LAN address
            // RUN ASYNCHRONOUSLY OR APP WILL CRASH WITH NO ERROR MESSAGE!
            Task.Run(() => IPAddress = GetLocalIPAddress());
        }
Esempio n. 2
0
        public bool ConnectToIP(string ipAddress)
        {
            // Create network connection with given IP
            qtmConnection = QTMNetworkConnection.Instance;

            // Attempt to connect
            bool success = qtmConnection.Connect(ipAddress);

            if (success)
            {
                // Get qtm version (because why not?)
                qtmConnection.protocol.GetQTMVersion(out qtmVersion);
            }

            return(success);
        }
        public QTMEventListener(int freq, bool startListening = true)
        {
            // Init variables
            frequency = 30;

            // TODO: Mmmph.. new connection?
            networkConnection = new QTMNetworkConnection();

            // Initialize with frequency
            networkConnection.Protocol.StreamFrames(QTMRealTimeSDK.StreamRate.RateFrequency, frequency);

            // Start listening if necessary
            if (startListening)
            {
                StartListening();
            }
        }
        public ConnectionViewModel()
        {
            connectionIPAddress = "127.0.0.1";
            networkConnection   = QTMNetworkConnection.Instance;

            RefreshQTMServers = new Command(
                execute: () =>
            {
                LoadQTMServers();
            },
                canExecute: () =>
            {
                return(!IsRefreshing);
            }
                );

            // Add button command to binding context
            ConnectCommand = new Command(OnConnectionStarted);
        }