public async void Concatenate()
        {
            if (isConnected && m_consumer != null)
            {
                if (String.IsNullOrWhiteSpace(m_inStr1) || String.IsNullOrWhiteSpace(m_inStr2))
                {
                    UpdateStatus("Input strings cannot be empty", NotifyType.ErrorMessage);
                }
                else
                {
                    // Call the Cat method with the input strings arguments.
                    SecureInterfaceCatResult catResult = await m_consumer.CatAsync(m_inStr1, m_inStr2);

                    if (catResult.Status == AllJoynStatus.Ok)
                    {
                        UpdateStatus(String.Format("Concatenation Ouput : {0}", catResult.outStr), NotifyType.StatusMessage);
                    }
                    else
                    {
                        UpdateStatus(String.Format("Error : {0}", catResult.Status.ToString()), NotifyType.ErrorMessage);
                    }
                }
            }
            else
            {
                UpdateStatus("Client not connected.", NotifyType.ErrorMessage);
            }
        }
示例#2
0
        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 Cat method with the input strings arguments.
                    SecureInterfaceCatResult catResult = await m_consumer.CatAsync(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("Client not connected.", NotifyType.ErrorMessage);
            }
        }
示例#3
0
        // Function to handle calls to the Cat method.
        public IAsyncOperation <SecureInterfaceCatResult> CatAsync(AllJoynMessageInfo info, string inStr1, string inStr2)
        {
            Task <SecureInterfaceCatResult> task = new Task <SecureInterfaceCatResult>(() =>
            {
                return(SecureInterfaceCatResult.CreateSuccessResult(inStr1 + inStr2));
            });

            task.Start();
            return(task.AsAsyncOperation());
        }
示例#4
0
        // Method to handle calls to the Cat method.
        public IAsyncOperation <SecureInterfaceCatResult> CatAsync(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 <SecureInterfaceCatResult> task = new Task <SecureInterfaceCatResult>(() =>
            {
                if (AppData.IsUpperCaseEnabled)
                {
                    inStr1 = inStr1.ToUpper();
                    inStr2 = inStr2.ToUpper();
                }
                return(SecureInterfaceCatResult.CreateSuccessResult(inStr1 + inStr2));
            });

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