Beispiel #1
0
        public ChooseFiles(List <ConversationModel> conversations, List <FileModel> files)
        {
            _conversations = conversations;
            _files         = files;
            InitializeComponent();

            FileSortButton sortButton = (FileSortButton)LogicalTreeHelper.FindLogicalNode(this, "FileSortButton");

            FileList.BoundSortButton = sortButton;
            FileList.AllowSelect     = true;

            ReadyButton.Clicked += (s, ea) =>
            {
                SelectedFiles = FileList.SelectedFiles;
                ReadyButtonClicked?.Invoke(this, EventArgs.Empty);
            };

            CancelButton.Clicked += (s, ea) =>
            {
                CancelButtonClicked?.Invoke(this, EventArgs.Empty);
            };

            ConversationList.Clear();
            ConversationList.AddConversations(_conversations);

            ConversationList.SelectedConversationChanged += ConversationList_SelectedConversationChanged;

            if (ConversationList.Conversations.Any())
            {
                ConversationList.SelectedConversationItem = ConversationList.Conversations.First();
            }
        }
Beispiel #2
0
 void ChatView_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         ConversationList.ScrollIntoView(e.NewItems[0]);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Details to show (first tag after SOAP Body)
        /// </summary>
        public override String GetDetails()
        {
            if (!ContainsXml)
            {
                return(String.Empty);
            }

            if (null != mDetails)
            {
                return(mDetails);
            }

            try
            {
                XElement doc = XElement.Parse(GetXmlString(XmlNamespaceOption.IgnoreNamespaces));

                var element = doc.Element(SoapOptions.BODY_TAG);
                mDetails = element.Elements().First().Name.LocalName;
            }
            catch (Exception e)
            {
                Logger.WriteLine(String.Format("Frame:{0}{1}Conversation:{2}{1}{3}", FrameNumber, Environment.NewLine,
                                               ConversationList.GetConversations().IndexOf(mConversation) + 1, e.Message));

                mDetails = String.Empty;
            }

            return(mDetails);
        }
Beispiel #4
0
        private void LoadConversations()
        {
            ConversationList.Clear();
            ConversationList.AddConversations(_conversations);

            ConversationList.SelectedConversationChanged += ConversationList_SelectedConversationChanged;
        }
        public void ConversationListInitsWithNoArgs()
        {
            var conversationList = new ConversationList();

            Assert.NotNull(conversationList);
            Assert.IsType <ConversationList>(conversationList);
        }
Beispiel #6
0
        public static Dictionary <Conversation, HashSet <TestInfo> > GetMappedTests()
        {
            var mappedTests = new Dictionary <Conversation, HashSet <TestInfo> >();

            foreach (var conversation in ConversationList.GetConversations())
            {
                var device = conversation.Device as Device;

                if (null == device || !device.IsFeatureListAttached) //TODO think about Conversation w/ 2 Clients
                {
                    mappedTests.Add(conversation, new HashSet <TestInfo>(TestCaseSet.Instance.Tests));
                    continue;
                }

                var profiles = device.GetSupportedProfiles();

                var profileMandatoryFeatures   = profiles.SelectMany(profile => profile.GetMandatoryFeatures()).ToList();
                var profileConditionalFeatures = profiles.SelectMany(profile => profile.GetConditionalFeatures()).ToList();
                var deviceSpecificFeatures     = device.GetSupportedFeatures();

                var testList = profileMandatoryFeatures.Union(profileConditionalFeatures)
                               .Union(deviceSpecificFeatures)
                               .Select(feature => feature.GetDependingTest())
                               .ToList();

                mappedTests.Add(conversation, new HashSet <TestInfo>(testList));
            }

            return(mappedTests);
        }
        public async void StopButtonClicked(object sender, EventArgs e)
        {
            var botResponse = await _botService.SendStopConversation(CurrentUser);

            ConversationList.Add(botResponse);
            CheckMessage.Text = JsonConvert.SerializeObject(botResponse);
        }
        private void ProcessPairs(List <Frame> frameList, List <XElement> xmlList, IEnumerable <Tuple <XElement, XElement> > pairs)
        {
            foreach (var pair in pairs)
            {
                var requestFrame  = frameList[xmlList.IndexOf(pair.Item1)];
                var responseFrame = frameList[xmlList.IndexOf(pair.Item2)];

                var client = UnitSet.GetUnit(responseFrame.DestinationMac);
                var device = UnitSet.GetUnit(responseFrame.SourceMac);

                var conversation = ConversationList.Find(client, device);

                if (null == conversation)
                {
                    continue;
                }

                var request = new DiscoveryMessage(requestFrame, conversation, MessageType.Request);
                PackXml(pair.Item1, conversation, requestFrame, MessageType.Request);

                var response = new DiscoveryMessage(responseFrame, conversation, MessageType.Response);
                PackXml(pair.Item2, conversation, responseFrame, MessageType.Response);

                conversation.Add(new RequestResponsePair(request, response, mParser.NetworkTrace, conversation,
                                                         ContentType.WSDiscovery));
            }
        }
        private async void Randon_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var uri      = new Uri("https://baconipsum.com/api/?type=meat-and-filler&paras=5&format=text");
                var client   = new HttpClient();
                var response = await client.GetAsync(uri);

                var respoonsestring = await response.Content.ReadAsStringAsync();

                var mesage = new Message
                {
                    Body      = respoonsestring,
                    Alignment = HorizontalAlignment.Left,
                    Color     = (Windows.UI.Color)Application.Current.Resources["SystemAccentColorDark1"],
                    DateTime  = DateTime.Now.ToString("MM/dd, HH:mm"),
                    Margin    = new Thickness(10, 10, 60, 10)
                };
                Conversation.Add(mesage);
                ConversationList.ScrollIntoView(mesage);
            }
            catch
            {
            }
        }
Beispiel #10
0
        private void _parent_NewConversationArrived(object sender, NewConversationArrivedEventArgs e)
        {
            ConversationListItem conversationItem = new ConversationListItem(e.Conversation);

            ConversationList.AddConversation(conversationItem);
            ConversationList.SelectedConversationItem = conversationItem;
        }
Beispiel #11
0
 //TODO
 private void CheckConversations()
 {
     if (0 == ConversationList.GetConversations(NetworkTrace).Count)
     {
         DialogHelper.ShowError(NetworkTrace.Filename, "Communication was not detected between Client and Device using ONVIF standard.\r\nConversation list cannot be generated.");
     }
 }
Beispiel #12
0
    public ConversationList  Create()
    {
        ConversationList asset = ScriptableObject.CreateInstance <ConversationList> ();

        AssetDatabase.CreateAsset(asset, "Assets/ConversationList.asset");
        AssetDatabase.SaveAssets();
        return(asset);
    }
Beispiel #13
0
        private async Task SendMessage()
        {
            ProgressVisible = true;
            var botResponse = await _botConnector.SendMessage("Daniel", Message.Text);

            ProgressVisible = false;
            ConversationList.Add(botResponse);
        }
Beispiel #14
0
        private String GetPairInfo(RequestResponsePair pair)
        {
            var conversation        = pair.Conversation;
            int indexOfConversation = ConversationList.GetConversations().IndexOf(conversation) + 1;
            int indexOfPair         = conversation.IndexOf(pair) + 1;

            return(String.Format("Conversation:{0} - {1} \\ Pair:{2}", indexOfConversation, conversation.Name, indexOfPair));
        }
    static public void LoadConversationXml(Character character)
    {
        string           path  = Application.streamingAssetsPath + "/conversations.xml";
        ConversationList cList = XmlHandler <ConversationList> .GetNewT(path) as ConversationList;

        //Character[] characterArray = GameObject.FindObjectsOfType<Character>();
        SetText(cList, character);
    }
        private async void GetConvo(MessageThread messagethread)
        {
            reader = messagethread.ChatConversation.GetMessageReader();
            list   = await reader.ReadBatchAsync();

            foreach (var item in list)
            {
                if (item.IsIncoming)
                {
                    var mesage = new Message
                    {
                        Body      = item.Body,
                        Alignment = HorizontalAlignment.Left,
                        Color     = (Windows.UI.Color)Application.Current.Resources["SystemAccentColorDark1"],
                        DateTime  = item.LocalTimestamp.DateTime.ToString("MM/dd, HH:mm"),
                        Margin    = new Thickness(10, 10, 60, 10)
                    };
                    Conversation.Add(mesage);
                }
                else
                {
                    var mesage = new Message
                    {
                        Body      = item.Body,
                        Alignment = HorizontalAlignment.Left,
                        Color     = (Windows.UI.Color)Application.Current.Resources["SystemAccentColorLight1"],
                        DateTime  = item.LocalTimestamp.DateTime.ToString("MM/dd, HH:mm"),
                        Margin    = new Thickness(60, 10, 10, 10)
                    };
                    Conversation.Add(mesage);
                }
            }
            var ordered = Conversation.OrderBy(x => x.DateTime);

            ConversationList.ItemsSource = ordered;
            ConversationList.ScrollIntoView(ordered.Last());
            if (messagethread.ChatConversation.Participants.Count > 1)
            {
                var list   = new List <MenuFlyoutItem>();
                var flyout = new MenuFlyout();
                for (int i = 0; i > messagethread.ChatConversation.Participants.Count; i++)
                {
                    var flyitem = new MenuFlyoutItem
                    {
                        Text = messagethread.ChatConversation.Participants[i],
                        Tag  = messagethread.ChatConversation.Participants[i]
                    };
                    flyitem.Tapped += Flyitem_Tapped;
                    flyout.Items.Add(flyitem);
                }
                CallButton.Flyout = flyout;
            }
            else
            {
                CallButton.Tag    = messagethread.ChatConversation.Participants.FirstOrDefault();
                CallButton.Click += CallButton_Click;
            }
        }
        /// <summary>
        /// Handles text message input sent by user.
        /// </summary>
        /// <param name="activity">Incoming request from Bot Framework.</param>
        /// <param name="connectorClient">Connector client instance for posting to Bot Framework.</param>
        /// <returns>Task tracking operation.</returns>
        private static async Task HandleTextMessages(Activity activity, ConnectorClient connectorClient)
        {
            if (activity.Text.Contains("GetChannels"))
            {
                Activity replyActivity = activity.CreateReply();
                replyActivity.AddMentionToText(activity.From, MentionTextLocation.PrependText);

                ConversationList channels = connectorClient.GetTeamsConnectorClient().Teams.FetchChannelList(activity.GetChannelData <TeamsChannelData>().Team.Id);

                // Adding to existing text to ensure @Mention text is not replaced.
                replyActivity.Text = replyActivity.Text + " <p>" + string.Join("</p><p>", channels.Conversations.ToList().Select(info => info.Name + " --> " + info.Id));
                await connectorClient.Conversations.ReplyToActivityAsync(replyActivity);
            }
            else if (activity.Text.Contains("GetTenantId"))
            {
                Activity replyActivity = activity.CreateReply();
                replyActivity.AddMentionToText(activity.From, MentionTextLocation.PrependText);
                replyActivity.Text += " Tenant ID - " + activity.GetTenantId();
                await connectorClient.Conversations.ReplyToActivityAsync(replyActivity);
            }
            else if (activity.Text.Contains("Create1on1"))
            {
                var      response    = connectorClient.Conversations.CreateOrGetDirectConversation(activity.Recipient, activity.From, activity.GetTenantId());
                Activity newActivity = new Activity()
                {
                    Text         = "Hello",
                    Type         = ActivityTypes.Message,
                    Conversation = new ConversationAccount
                    {
                        Id = response.Id
                    },
                };

                await connectorClient.Conversations.SendToConversationAsync(newActivity, response.Id);
            }
            else if (activity.Text.Contains("GetMembers"))
            {
                var response = await connectorClient.Conversations.GetTeamsConversationMembersAsync(activity.Conversation.Id, activity.GetTenantId());

                StringBuilder stringBuilder = new StringBuilder();
                Activity      replyActivity = activity.CreateReply();
                replyActivity.Text = string.Join("</p><p>", response.ToList().Select(info => info.GivenName + " " + info.Surname + " --> " + info.ObjectId));
                await connectorClient.Conversations.ReplyToActivityAsync(replyActivity);
            }
            else
            {
                var accountList = connectorClient.Conversations.GetConversationMembers(activity.Conversation.Id);

                Activity replyActivity = activity.CreateReply();
                replyActivity.Text = "Help " +
                                     "<p>Type GetChannels to get List of Channels. </p>" +
                                     "<p>Type GetTenantId to get Tenant Id </p>" +
                                     "<p>Type Create1on1 to create one on one conversation. </p>" +
                                     "<p>Type GetMembers to get list of members in a conversation (team or direct conversation). </p>";
                replyActivity.AddMentionToText(activity.From);
                await connectorClient.Conversations.ReplyToActivityAsync(replyActivity);
            }
        }
Beispiel #18
0
        private void ConversationList_ItemAppearing(object sender, ItemVisibilityEventArgs e)
        {
            if (ConversationList.ItemsSource == null)
            {
                return;
            }
            var last = ConversationList.ItemsSource.Cast <object>().LastOrDefault();

            ConversationList.ScrollTo(last, ScrollToPosition.MakeVisible, true);
        }
        public async Task <GetConversationsResponse> GetConversations(string username, string continuationToken, int limit, long lastSeenConversationTime)
        {
            using (_logger.BeginScope("{Username}", username))
            {
                var stopWatch = Stopwatch.StartNew();
                ConversationList conversations = await _conversationStore.GetConversations(username, continuationToken, limit, lastSeenConversationTime);

                _telemetryClient.TrackMetric("ConversationStore.GetConversations.Time", stopWatch.ElapsedMilliseconds);
                string nextUri = "";
                if (!string.IsNullOrWhiteSpace(conversations.ContinuationToken))
                {
                    nextUri = $"api/conversations?username={username}&continuationToken={WebUtility.UrlEncode(conversations.ContinuationToken)}&limit={limit}&lastSeenConversationTime={lastSeenConversationTime}";
                }

                string  recipientUsername;
                Profile recipient;
                List <GetConversationsResponseEntry> conversationEntries = new List <GetConversationsResponseEntry>();
                for (int index = 0; index < conversations.Conversations.Length; index++)
                {
                    if (conversations.Conversations[index].Participants[0] != username)
                    {
                        recipientUsername = conversations.Conversations[index].Participants[0];
                    }
                    else
                    {
                        recipientUsername = conversations.Conversations[index].Participants[1];
                    }
                    try
                    {
                        recipient = await _profileStore.GetProfile(recipientUsername);

                        conversationEntries.Add(new GetConversationsResponseEntry
                        {
                            LastModifiedUnixTime = conversations.Conversations[index].LastModifiedUnixTime,
                            Id        = conversations.Conversations[index].Id,
                            Recipient = recipient
                        }
                                                );
                    }
                    catch (ProfileNotFoundException)
                    {
                        //Disregard this profile because it is now not existing.
                    }
                }


                GetConversationsResponse conversationsResponse = new GetConversationsResponse
                {
                    Conversations = conversationEntries.ToArray(),
                    NextUri       = nextUri
                };

                return(conversationsResponse);
            }
        }
Beispiel #20
0
        private void lVConversations_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (0 == lVConversations.SelectedIndices.Count)
            {
                ClearSelection();
                return;
            }

            mSelectedConversationIndex = lVConversations.SelectedIndices[0];
            requestResponseList.SelectedConversation = ConversationList.GetConversations()[mSelectedConversationIndex];
        }
        private async Task SendMessage()
        {
            ProgressVisible = true;
            ConversationList.Add(new BotMessage()
            {
                From = "Me", Text = Message.Text
            });
            var botResponse = await _botConnector.SendMessage("Me", Message.Text);

            ProgressVisible = false;
            ConversationList.Add(botResponse);
        }
Beispiel #22
0
        public void NotifyMe(NotificationMessage notificationMessage)
        {
            string notification = notificationMessage.Notification;

            ConversationList.Clear();
            _history = new History();
            foreach (var item in _history.Histories)
            {
                ConversationList.Add(item);
            }
            FilterCollection();
        }
Beispiel #23
0
        private static ChannelInfo GetChannelId(ConnectorClient connectorClient, IDialogContext context, string channelName)
        {
            var teamInfo = context.Activity.GetChannelData <TeamsChannelData>().Team;
            ConversationList channels = connectorClient.GetTeamsConnectorClient().Teams.FetchChannelList(teamInfo.Id);
            var channelInfo           = channels.Conversations.FirstOrDefault(c => c.Name != null && c.Name.Equals(channelName));

            if (channelInfo == null)
            {
                throw new System.Exception($"{channelName} doesn't exist in {context.Activity.GetChannelData<TeamsChannelData>().Team.Name} Team");
            }
            return(channelInfo);
        }
Beispiel #24
0
        private Conversation FindConversation(Frame frame, String protocol)
        {
            if (protocol.Contains(TSharkHelper.PROTOCOL_RTSP)) // HACK //TODO
            {
                return
                    (ConversationList.GetConversations(
                         item => (item.Client.Mac == frame.SourceMac && item.Device.Mac == frame.DestinationMac) ||
                         item.Client.Mac == frame.DestinationMac && item.Device.Mac == frame.SourceMac).FirstOrDefault());
            }

            return(ConversationList.GetConversations(item => item.ContainsFrame(frame)).FirstOrDefault());
        }
Beispiel #25
0
        private void _parent_ConversationRemoved(object sender, ConversationRemovedEventArgs e)
        {
            ConversationModel conversation = _conversations.Find(obj => obj.Id == e.ConversationId);

            if (ConversationList.SelectedConversation.Id == e.ConversationId)
            {
                ConversationList.SelectedConversation = ConversationList.Conversations.First().Conversation;
            }

            ConversationList.RemoveConversationFromList(
                ConversationList.Conversations.Find(obj => obj.Conversation == conversation));
        }
    static public void SetText(ConversationList cList, Character character)
    {
        Conversation conversation = GetConversation(cList, character);

        if (conversation != null)
        {
            List <ConversationStage> conversationStages = GetConversationStages(character, conversation);
            if (conversationStages != null)
            {
                List <ConversationStage> correctedStages = CorrectLines(conversationStages);
                character.FillConversations(correctedStages);
            }
        }
    }
Beispiel #27
0
        public async Task TeamsAPI_FetchChannelListAsyncWithHttpMessagesTest()
        {
            Microsoft.Rest.ServiceClientTracing.IsEnabled = true;
            ConversationList conversationList = new ConversationList
            {
                Conversations = new List <ChannelInfo>
                {
                    new ChannelInfo
                    {
                        Id   = "ChannelId",
                        Name = "ChannelName"
                    }
                }
            };

            TestDelegatingHandler testHandler = new TestDelegatingHandler((request) =>
            {
                StringContent stringContent = new StringContent(JsonConvert.SerializeObject(conversationList));
                var response     = new HttpResponseMessage(HttpStatusCode.OK);
                response.Content = stringContent;
                Assert.IsNotNull(request.Headers.GetValues("Authorization"));
                Assert.AreEqual(request.Headers.GetValues("Authorization").Count(), 1);
                Assert.AreEqual(request.Headers.GetValues("Authorization").ToList()[0], "CustomValue");
                return(Task.FromResult(response));
            });

            ConnectorClient connectorClient = new ConnectorClient(
                new Uri("https://smba.trafficmanager.net/amer-client-ss.msg/"),
                ConfigurationManager.AppSettings["MicrosoftAppId"],
                ConfigurationManager.AppSettings["MicrosoftAppPassword"],
                testHandler);

            TeamsConnectorClient teamsConnectorClient = connectorClient.GetTeamsConnectorClient();

            ConversationList conversationListResponse = (await teamsConnectorClient.Teams.FetchChannelListWithHttpMessagesAsync(
                                                             "TestTeamId",
                                                             new Dictionary <string, List <string> >()
            {
                { "Authorization", new List <string>()
                  {
                      "CustomValue"
                  } }
            })).Body;

            Assert.IsNotNull(conversationListResponse);
            Assert.IsNotNull(conversationListResponse.Conversations);
            Assert.AreEqual(conversationListResponse.Conversations.Count, 1);
            Assert.AreEqual(conversationListResponse.Conversations[0].Id, conversationList.Conversations[0].Id);
            Assert.AreEqual(conversationListResponse.Conversations[0].Name, conversationList.Conversations[0].Name);
        }
        public async Task TeamsAPI_FetchChannelListTestInvalidHttpCodeWithoutResponseContentAsync()
        {
            Microsoft.Rest.ServiceClientTracing.IsEnabled = true;
            TestDelegatingHandler testHandler = new TestDelegatingHandler((request) =>
            {
                var response = new HttpResponseMessage(HttpStatusCode.NotFound);
                return(Task.FromResult(response));
            });

            TeamsConnectorClient teamsConnectorClient = new TeamsConnectorClient(
                new Uri("https://smba.trafficmanager.net/amer-client-ss.msg/"),
                new MicrosoftAppCredentials("Test", "Test"),
                testHandler);
            ConversationList conversationListResponse = await teamsConnectorClient.Teams.FetchChannelListAsync("TestTeamId").ConfigureAwait(false);
        }
    static public Conversation GetConversation(ConversationList cList, Character character)
    {
        Conversation conversation = new Conversation();

        character.characterName = character.gameObject.name;
        for (int i = 0; i < cList.xList.Count; i++)
        {
            if (cList.xList[i].name == character.characterName)
            {
                conversation = cList.xList[i];
                return(conversation);
            }
        }
        return(null);
    }
Beispiel #30
0
        private void LoadConversations()
        {
            if (ConversationList == null)
            {
                return;
            }

            ConversationList.Clear();
            ConversationList.AddConversations(_conversations);

            if (ConversationList.Conversations.Any())
            {
                ConversationList.SelectedConversationItem = ConversationList.Conversations.First();
            }
        }