Пример #1
0
        private void MController_Authenticated(IPenClient sender, object args)
        {
            _controller.RequestPenStatus();
            _controller.AddAvailableNote();
            _controller.RequestOfflineDataList();

            // MController_Connected에 있으니 비밀번호 입력창이 뜰때 연결끊김
            // 펜 세팅값으로 넣어줘야 할듯
            cbColor.SelectedIndex = cbColor.Items.Count - 1;

            ShowToast("Device is connected");
        }
Пример #2
0
        private async void MController_Authenticated(IPenClient sender, object args)
        {
            _controller.RequestPenStatus();
            _controller.AddAvailableNote();
            _controller.RequestOfflineDataList();

            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                // MController_Connected에 있으니 비밀번호 입력창이 뜰때 연결끊김
                // 펜 세팅값으로 넣어줘야 할듯
                cbColor.SelectedIndex = cbColor.Items.Count - 1;
                CurrentStatus         = AppStatus.Connected;

                ShowToast("Device is connected");
            });
        }
Пример #3
0
        public void TestAvailableNoteRequest()
        {
            bool firstCheck = false;

            TypedEventHandler <IPenClient, object> availableNoteAccepted;

            availableNoteAccepted = new TypedEventHandler <IPenClient, object>((IPenClient sender, object args) =>
            {
                firstCheck = true;
                _autoResetEvent.Set();
            });

            _controller.AvailableNoteAdded += availableNoteAccepted;

            Task.Factory.StartNew(() =>
            {
                _controller.AddAvailableNote();
            });

            _autoResetEvent.WaitOne();

            _controller.AvailableNoteAdded -= availableNoteAccepted;

            bool secondCheck = false;

            availableNoteAccepted = new TypedEventHandler <IPenClient, object>((IPenClient sender, object args) =>
            {
                secondCheck = true;
                _autoResetEvent.Set();
            });

            _controller.AvailableNoteAdded += availableNoteAccepted;

            Task.Factory.StartNew(() =>
            {
                _controller.AddAvailableNote(DEFAULT_SECTION, DEFAULT_OWNER, new int[] { DEFAULT_NOTE });
            });

            _autoResetEvent.WaitOne();

            _controller.AvailableNoteAdded -= availableNoteAccepted;

            bool thirdCheck = false;

            availableNoteAccepted = new TypedEventHandler <IPenClient, object>((IPenClient sender, object args) =>
            {
                thirdCheck = true;
                _autoResetEvent.Set();
            });

            _controller.AvailableNoteAdded += availableNoteAccepted;

            Task.Factory.StartNew(() =>
            {
                _controller.AddAvailableNote(new int[] { DEFAULT_SECTION }, new int[] { DEFAULT_OWNER });
            });

            _autoResetEvent.WaitOne();

            _controller.AvailableNoteAdded -= availableNoteAccepted;

            bool fourthCheck = false;

            availableNoteAccepted = new TypedEventHandler <IPenClient, object>((IPenClient sender, object args) =>
            {
                fourthCheck = true;
                _autoResetEvent.Set();
            });

            _controller.AvailableNoteAdded += availableNoteAccepted;

            Task.Factory.StartNew(() =>
            {
                _controller.AddAvailableNote(DEFAULT_SECTION, DEFAULT_OWNER);
            });

            _autoResetEvent.WaitOne();

            _controller.AvailableNoteAdded -= availableNoteAccepted;

            bool fifthCheck = false;

            availableNoteAccepted = new TypedEventHandler <IPenClient, object>((IPenClient sender, object args) =>
            {
                fifthCheck = true;
                _autoResetEvent.Set();
            });

            _controller.AvailableNoteAdded += availableNoteAccepted;

            Task.Factory.StartNew(() =>
            {
                _controller.AddAvailableNote(DEFAULT_SECTION, DEFAULT_OWNER, null);
            });

            _autoResetEvent.WaitOne();

            _controller.AvailableNoteAdded -= availableNoteAccepted;

            bool sixthCheck = false;

            availableNoteAccepted = new TypedEventHandler <IPenClient, object>((IPenClient sender, object args) =>
            {
                sixthCheck = true;
                _autoResetEvent.Set();
            });

            _controller.AvailableNoteAdded += availableNoteAccepted;

            Task.Factory.StartNew(() =>
            {
                _controller.AddAvailableNote(DEFAULT_SECTION, DEFAULT_OWNER, new int[] { 601, 602, 603, 604, 605, 606, 607, 608, 609, 610 });
            });

            _autoResetEvent.WaitOne();

            _controller.AvailableNoteAdded -= availableNoteAccepted;

            Assert.IsTrue(firstCheck && secondCheck && thirdCheck && fourthCheck && fifthCheck && sixthCheck);
        }