コード例 #1
0
ファイル: ChatWindow.xaml.cs プロジェクト: crisionas/ChatRoom
 private void chatrooms_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     chatrooms.SelectedIndex = 1;
     if (chatrooms.Text == "Select a chatroom")
     {
         chatrooms.SelectedIndex = -1;
         Message quitCr = new Message(Message.Header.QUIT_CR);
         client.sendMessage(quitCr);
         if (messagesBindingList != null && usersBindingList != null)
         {
             messagesBindingList.Clear();
             usersBindingList.Clear();
         }
     }
     // Join the chatroom wanted otherwise
     if (chatrooms.Text != "" &&
         chatrooms.Text != "Select a chatroom" &&
         chatrooms.SelectedItem != null)
     {
         client.User.Chatroom = new Chatroom(chatrooms.Text);
         Message joinCr = new Message(Message.Header.JOIN_CR);
         joinCr.addData(chatrooms.Text);
         client.sendMessage(joinCr);
     }
 }
コード例 #2
0
ファイル: Chat.cs プロジェクト: dave-star/packages
        /// <summary>
        /// Action performed on chatroom change
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void chatrooms_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Do nothing if we select the dummy chatroom "Select a chatroom"
            // Meaning: leave the current chatroom, clear the interface
            if (chatrooms.Text == "Select a chatroom")
            {
                chatrooms.SelectedIndex = -1;
                ChatMessage quitCr = new ChatMessage(ChatMessage.Header.QUIT_CR);
                client.sendMessage(quitCr);
                if (messagesBindingList != null && usersBindingList != null)
                {
                    messagesBindingList.Clear();
                    usersBindingList.Clear();
                }
            }

            // Join the chatroom wanted otherwise
            if (chatrooms.Text != "" &&
                chatrooms.Text != "Select a chatroom" &&
                chatrooms.SelectedItem != null)
            {
                client.User.Chatroom = new Chatroom(chatrooms.Text);
                ChatMessage joinCr = new ChatMessage(ChatMessage.Header.JOIN_CR);
                joinCr.addData(chatrooms.Text);
                client.sendMessage(joinCr);
            }
        }
コード例 #3
0
ファイル: Marketplace.cs プロジェクト: PersonalityPi/Test
        void marketplace_XmlDocChanged(object sender, EventArgs a)
        {
            contentview.SuppressSelectionChanged();
            _content.RaiseListChangedEvents = false;
            _batchhandler.Abort();
            //while (!batchhandler.WorkDone) Task.Delay(10);
            _content.Clear();
            var xdoc = _helper.XmlDoc;

            if (xdoc != null)
            {
                var entries = xdoc.Descendants(Constants.NetworkConnectivity.Namespaces.Atom + "entry");
                foreach (var entry in entries)
                {
                    MarketPlaceContent tempContent = new MarketPlaceContent(entry, (Language)querylanguage_sel.SelectedItem);
                    tempContent.Load();
                    _content.Add(tempContent);
                }
                numitems_sync_label.Text = xdoc.Descendants(Constants.NetworkConnectivity.Namespaces.Live + "totalItems").First().Value;
                cat_sync_label.Text      = _helper.MediaTypes.Name;
                int numItems;
                if (Int32.TryParse(numitems_sync_label.Text, out numItems))
                {
                    int max = (int)Math.Ceiling(numItems / entrys_num.Value);
                    if (max < page_num.Value)
                    {
                        page_num.Value = max;
                    }
                    page_num.Maximum = max;
                    Constants.BindingLists.Categorys[Constants.BindingLists.Categorys.IndexOf((MediaId)cat_select.SelectedItem)].TotalCount = numItems;
                }
            }
            _content.RaiseListChangedEvents = true;
            _content.ResetBindings();
            _batchhandler.StartUrlCheck(false);
            contentview.ResumeSelectionChanged();
        }