private async void ConcatenateAsync()
        {
            if (m_consumer != null)
            {
                if (string.IsNullOrWhiteSpace(InputString1) || string.IsNullOrWhiteSpace(InputString2))
                {
                    UpdateStatusAsync("Input strings cannot be empty.", NotifyType.ErrorMessage);
                }
                else
                {
                    // Call the Concatenate method with the input strings arguments.
                    SecureInterfaceConcatenateResult catResult = await m_consumer.ConcatenateAsync(InputString1, InputString2);

                    if (catResult.Status == AllJoynStatus.Ok)
                    {
                        UpdateStatusAsync(string.Format("Concatenation output : \"{0}\".", catResult.OutStr), NotifyType.StatusMessage);
                    }
                    else
                    {
                        UpdateStatusAsync(string.Format("AllJoyn Error : 0x{0:X}.", catResult.Status), NotifyType.ErrorMessage);
                    }
                }
            }
            else
            {
                UpdateStatusAsync("Consumer not connected.", NotifyType.ErrorMessage);
            }
        }
예제 #2
0
        // Method to handle calls to the Concatenate method.
        public IAsyncOperation <SecureInterfaceConcatenateResult> ConcatenateAsync(AllJoynMessageInfo info, string inStr1, string inStr2)
        {
            IAsyncAction asyncAction = MainPage.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                MainPage.Current.NotifyUser(string.Format("Concatenation request recieved for \"{0}\" and \"{1}\".", inStr1, inStr2), NotifyType.StatusMessage);
            });

            Task <SecureInterfaceConcatenateResult> task = new Task <SecureInterfaceConcatenateResult>(() =>
            {
                if (AppData.IsUpperCaseEnabled)
                {
                    inStr1 = inStr1.ToUpper();
                    inStr2 = inStr2.ToUpper();
                }
                return(SecureInterfaceConcatenateResult.CreateSuccessResult(inStr1 + inStr2));
            });

            task.Start();
            return(task.AsAsyncOperation());
        }