示例#1
0
        private void startNTRinputRedirection()
        {
            try
            {
                tokenSource         = new CancellationTokenSource();
                ct                  = tokenSource.Token;
                ntrInputRedirection = new NTRInputRedirection();

                bottomCommandBar.GotFocus  += bottomCommandBar_GotFocus;
                bottomCommandBar.LostFocus += bottomCommandBar_LostFocus;
                bottomCommandBar.Opening   += bottomCommandBar_Opening;
                bottomCommandBar.Closed    += bottomCommandBar_Closed;
                helpPopup.Opened           += helpPopup_Opened;

                ntrInputRedirectionTask = new Task(() => { while (true)
                                                           {
                                                               ntrInputRedirection.ReadMain();
                                                           }
                                                   }, ct);

                ntrInputRedirection.CheckConnection();
                ntrInputRedirectionTask.Start();
            }
            catch (Exception e)
            {
                var ip            = localSettings.Values["ip"].ToString();
                var messageDialog = new Windows.UI.Popups.MessageDialog("Error Initiating NTR Input Redirection on: \n" + ip, "Input Redirection Error");
            }
        }
        private void startNTRinputRedirection(string ip)
        {
            try
            {
                tokenSource         = new CancellationTokenSource();
                ct                  = tokenSource.Token;
                ntrInputRedirection = new NTRInputRedirection(ip);

                ntrInputRedirectionTask = new Task(() => { while (true)
                                                           {
                                                               ntrInputRedirection.ReadMain();
                                                           }
                                                   }, ct);

                ntrInputRedirection.CheckConnection();
                ntrInputRedirectionTask.Start();
            }
            catch (Exception e)
            {
                MessageBox.Show("Error Initiating NTR Input Redirection on: \n" + ip, "Input Redirection Error");
            }
        }