Beispiel #1
0
        public ConnPageViewModel()
        {
            // Start device watcher
            mDevWatcher                = new NurDeviceWatcher();
            mDevWatcher.DeviceAdded   += DevWatcher_DeviceAdded;
            mDevWatcher.DeviceRemoved += DevWatcher_DeviceRemoved;
            mDevWatcher.DeviceUpdated += DevWatcher_DeviceUpdated;
            mDevWatcher.Start();

            // Load previous connection device spec from settings
            if (mLocalSettings.Values.ContainsKey("devicespec"))
            {
                DeviceSpecStr = mLocalSettings.Values["devicespec"].ToString();
            }

            ConnInfo = "Disconnected";
        }
        public MainPage()
        {
            this.InitializeComponent();

            // Start device watcher
            mDevWatcher                = new NurDeviceWatcher();
            mDevWatcher.DeviceAdded   += DevWatcher_DeviceAddedAsync;
            mDevWatcher.DeviceRemoved += DevWatcher_DeviceRemovedAsync;
            mDevWatcher.DeviceUpdated += DevWatcher_DeviceUpdatedAsync;
            mDevWatcher.Start();

            mApi.ConnectedEvent            += MApi_ConnectedEvent;
            mApi.DisconnectedEvent         += MApi_DisconnectedEvent;
            mApi.TransportConnStateChanged += MApi_TransportConnStateChanged;
            mApi.LogEvent += MApi_LogEvent;

            // Enable all logs for debugging purposes
            //mApi.SetLogLevel(NurApi.LOG_ERROR | NurApi.LOG_USER | NurApi.LOG_VERBOSE | NurApi.LOG_DATA);
            //mApi.SetLogLevel(NurApi.LOG_ERROR | NurApi.LOG_USER | NurApi.LOG_VERBOSE);

            InventoryButton.IsEnabled = false;
            ConnInfo.Text             = "Please select connection. NurApi v" + mApi.GetFileVersion();
        }