Exemplo n.º 1
0
        private void MController_PasswordRequested(IPenClient sender, PasswordRequestedEventArgs args)
        {
            ShowPasswordForm(args.RetryCount, args.ResetCount);

            //you can input password immediately, please refer to below code.
            //mController.InputPassword("0000");
        }
Exemplo n.º 2
0
        private void MController_PenStatusReceived(IPenClient sender, PenStatusReceivedEventArgs args)
        {
            cbPenCapPowerControl.IsChecked = args.PenCapPower;

            foreach (ComboBoxItem item in cbAutoPoweroffTime.Items)
            {
                short numValue = -1;

                bool result = Int16.TryParse(item.Content as string, out numValue);

                if (args.AutoShutdownTime == numValue)
                {
                    cbAutoPoweroffTime.SelectedItem = item;
                    continue;
                }
            }

            cbPowerOnByPenTip.IsChecked = args.AutoPowerOn;
            cbBeepSound.IsChecked       = args.Beep;
            cbOfflineData.IsChecked     = args.UseOfflineData;

            pbPower.Maximum         = 100;
            pbPower.Value           = args.Battery;
            pbStorage.Maximum       = 100;
            pbStorage.Value         = args.UsedMem;
            cbFSRStep.SelectedIndex = args.PenSensitivity - 1;
        }
Exemplo n.º 3
0
 private async void MController_FirmwareInstallationStarted(IPenClient sender, object args)
 {
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => {
         _progressDialog.Title = "Firmware Installation";
         await _progressDialog.ShowAsync();
     });
 }
Exemplo n.º 4
0
 private async void MController_OfflineDataDownloadStarted(IPenClient sender, object args)
 {
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => {
         _progressDialog.Title = "Offline Data Downloading";
         await _progressDialog.ShowAsync();
     });
 }
Exemplo n.º 5
0
 private void MController_BeepSoundChanged(IPenClient sender, SimpleResultEventArgs args)
 {
     if (isTest)
     {
         return;
     }
     _controller?.RequestPenStatus();
 }
Exemplo n.º 6
0
 private void MController_AutoPowerOffTimeChanged(IPenClient sender, SimpleResultEventArgs args)
 {
     if (isTest)
     {
         return;
     }
     _controller?.RequestPenStatus();
 }
Exemplo n.º 7
0
        private void MController_OfflineDataListReceived(IPenClient sender, OfflineDataListReceivedEventArgs args)
        {
            lvOfflineDataList.Items.Clear();

            foreach (var item in args.OfflineNotes)
            {
                lvOfflineDataList.Items.Add(item);
            }
        }
Exemplo n.º 8
0
        private async void MController_PasswordRequested(IPenClient sender, PasswordRequestedEventArgs args)
        {
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                ShowPasswordForm(args.RetryCount, args.ResetCount);
            });

            //you can input password immediately, please refer to below code.
            //mController.InputPassword("0000");
        }
Exemplo n.º 9
0
        private async void MController_Disconnected(IPenClient sender, object args)
        {
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                ToggleControls(this.Content, false);
                CurrentStatus = AppStatus.Disconnected;
                _progressDialog?.Hide();
            });

            ShowToast("Device is disconnected");
        }
Exemplo n.º 10
0
        private async void MController_OfflineDataListReceived(IPenClient sender, OfflineDataListReceivedEventArgs args)
        {
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                lvOfflineDataList.Items.Clear();

                foreach (var item in args.OfflineNotes)
                {
                    lvOfflineDataList.Items.Add(item);
                }
            });
        }
Exemplo n.º 11
0
        private async void MController_OfflineStrokeReceived(IPenClient sender, OfflineStrokeReceivedEventArgs args)
        {
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                foreach (Stroke stroke in args.Strokes)
                {
                    DrawStroke(_canvasArchived, stroke);
                }

                _progressDialog.Update(args.AmountDone, args.Total);
            });
        }
Exemplo n.º 12
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");
        }
Exemplo n.º 13
0
        private async void MController_OfflineStrokeReceived(IPenClient sender, OfflineStrokeReceivedEventArgs args)
        {
            foreach (Stroke stroke in args.Strokes)
            {
                _strokes.Add(new CachedDrawableStroke(_color, _thickness, stroke));
            }

            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                _progressDialog.Update(args.AmountDone, args.Total);
            });

            drawableCanvas.Invalidate();
        }
Exemplo n.º 14
0
 private async void _client_onUpdatePenController(IPenClient sender, PenUpdateInformation args)
 {
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         var item = lvDevices.Items.Where(p => (p as PenInformation)?.Id == args.Id);
         if (item != null)
         {
             PenInformation penInformation = item as PenInformation;
             if (penInformation != null)
             {
                 penInformation.Update(args);
             }
         }
     });
 }
Exemplo n.º 15
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");
            });
        }
Exemplo n.º 16
0
        private void MController_Connected(IPenClient sender, ConnectedEventArgs args)
        {
            ToggleControls(this.Content, true);

            if (args.DeviceName == null)
            {
                textBox.Text = String.Format("Firmware Version : {0}", args.FirmwareVersion);
            }
            else
            {
                textBox.Text = String.Format("Mac : {0}\r\n\r\nName : {1}\r\n\r\nSubName : {2}\r\n\r\nFirmware Version : {3}\r\n\r\nProtocol Version : {4}", args.MacAddress, args.DeviceName, args.SubName, args.FirmwareVersion, args.ProtocolVersion);
            }

            _client.StopWatcher();
        }
Exemplo n.º 17
0
        private void Mcontroller_PenProfileReceived(IPenClient sender, PenProfileReceivedEventArgs args)
        {
            if (args.Result == PenProfileReceivedEventArgs.ResultType.Failed)
            {
                OutputConsole += "PenProfile Failed";
                return;
            }

            if (isTest)
            {
                lastArgs = args;
                autoResetEvent.Set();
                return;
            }
            switch (args.Type)
            {
            case PenProfileReceivedEventArgs.PenProfileType.Create:
                CreatePenProfile(args);
                break;

            case PenProfileReceivedEventArgs.PenProfileType.Delete:
                DeletePenProfile(args);
                break;

            case PenProfileReceivedEventArgs.PenProfileType.Info:
                PenProfileInfo(args);
                break;

            case PenProfileReceivedEventArgs.PenProfileType.ReadValue:
                ReadProfileValue(args);
                ClearKeyValuePenProfile();
                break;

            case PenProfileReceivedEventArgs.PenProfileType.WriteValue:
                WriteProfileValue(args);
                ClearKeyValuePenProfile();
                break;

            case PenProfileReceivedEventArgs.PenProfileType.DeleteValue:
                DeleteProfileValue(args);
                ClearKeyValuePenProfile();
                break;
            }
        }
Exemplo n.º 18
0
        private async void MController_Connected(IPenClient sender, ConnectedEventArgs args)
        {
            MaxForce = args.MaxForce;

            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                ToggleControls(this.Content, true);

                if (sender.PenController?.Protocol == Protocols.V1)
                {
                    textBox.Text = String.Format("Firmware Version : {0}", args.FirmwareVersion);
                }
                else
                {
                    textBox.Text    = String.Format("Mac : {0}\r\n\r\nName : {1}\r\n\r\nSubName : {2}\r\n\r\nFirmware Version : {3}\r\n\r\nProtocol Version : {4}", args.MacAddress, args.DeviceName, args.SubName, args.FirmwareVersion, args.ProtocolVersion);
                    txtPenName.Text = args.SubName;
                }
            });

            _client.StopLEAdvertisementWatcher();
        }
Exemplo n.º 19
0
        private async void MController_PenStatusReceived(IPenClient sender, PenStatusReceivedEventArgs args)
        {
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                if (isTest)
                {
                    return;
                }

                cbPenCapPowerControl.IsChecked = args.PenCapPower;

                foreach (ComboBoxItem item in cbAutoPoweroffTime.Items)
                {
                    short numValue = -1;

                    bool result = Int16.TryParse(item.Content as string, out numValue);

                    if (args.AutoShutdownTime == numValue)
                    {
                        cbAutoPoweroffTime.SelectedItem = item;
                        continue;
                    }
                }

                cbPowerOnByPenTip.IsChecked = args.AutoPowerOn;
                cbBeepSound.IsChecked       = args.Beep;
                cbOfflineData.IsChecked     = args.UseOfflineData;

                pbPower.Maximum   = 100;
                pbPower.Value     = args.Battery;
                pbStorage.Maximum = 100;
                pbStorage.Value   = args.UsedMem;

                if (sender.PenController?.Protocol == Protocols.V1)
                {
                    txtPenName.Text = args.ModelName;
                }
            });
        }
Exemplo n.º 20
0
 private void MController_BatteryAlarmReceived(IPenClient sender, BatteryAlarmReceivedEventArgs args)
 {
     _controller?.RequestPenStatus();
 }
Exemplo n.º 21
0
 private async void MController_FirmwareInstallationFinished(IPenClient sender, SimpleResultEventArgs args)
 {
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => _progressDialog.Hide());
 }
Exemplo n.º 22
0
 private void MController_DotReceived(IPenClient sender, DotReceivedEventArgs args)
 {
     ProcessDot(args.Dot);
 }
Exemplo n.º 23
0
 private async void MController_FirmwareInstallationStarted(IPenClient sender, object args)
 {
     _progressDialog.Title = "Firmware Installation";
     await _progressDialog.ShowAsync();
 }
Exemplo n.º 24
0
 private void _controller_PenColorChanged(IPenClient sender, SimpleResultEventArgs args)
 {
     lastStatusResultArgs = args;
     autoResetEvent.Set();
 }
Exemplo n.º 25
0
 private void MController_SensitivityChanged(IPenClient sender, SimpleResultEventArgs args)
 {
     _controller?.RequestPenStatus();
 }
Exemplo n.º 26
0
 private void MController_PasswordChanged(IPenClient sender, SimpleResultEventArgs args)
 {
     ShowToast("Changing password is " + (args.Result ? "complete" : "failure"));
 }
Exemplo n.º 27
0
 private async void MController_OfflineDownloadFinished(IPenClient sender, SimpleResultEventArgs args)
 {
     _controller.RequestOfflineDataList();
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => _progressDialog.Hide());
 }
Exemplo n.º 28
0
 private async void MController_FirmwareInstallationStatusUpdated(IPenClient sender, ProgressChangeEventArgs args)
 {
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => _progressDialog.Update(args.AmountDone, args.Total));
 }
Exemplo n.º 29
0
 private async void MController_OfflineDataDownloadStarted(IPenClient sender, object args)
 {
     _progressDialog.Title = "Offline Data Downloading";
     await _progressDialog.ShowAsync();
 }
Exemplo n.º 30
0
 private void MController_AutoPowerOnChanged(IPenClient sender, SimpleResultEventArgs args)
 {
     _controller?.RequestPenStatus();
 }