示例#1
0
        private void Feeders_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            mutex.WaitOne();
            UserProfilerView userView     = new UserProfilerView();
            DataGrid         gd           = (DataGrid)sender;
            DataRowView      row_selected = gd.SelectedItem as DataRowView;

            feeders = userView.updateFeederList(UserId);
            if (row_selected != null)
            {
                int feederId = Convert.ToInt32(row_selected["feederId"].ToString());
                tags            = userView.showTags(feederId);
                currentFeederId = feederId;
            }
            Tags.Dispatcher.BeginInvoke(new Action(delegate()
            {
                Tags.ItemsSource = tags.DefaultView;
            }));
            mutex.ReleaseMutex();
        }
示例#2
0
 public void thread()
 {
     while (true)
     {
         UserProfilerView userView = new UserProfilerView();
         tags    = userView.showTags(currentFeederId);
         feeders = userView.updateFeederList(UserId);
         Tags.Dispatcher.BeginInvoke(new Action(delegate()
         {
             Tags.ItemsSource = tags.DefaultView;
         }));
         time.Dispatcher.BeginInvoke(new Action(delegate()
         {
             int t        = userView.AskTime();
             time.Content = (t / 60).ToString() + ":" + (t - (t / 60) * 60).ToString();
         }));
         Feeders.Dispatcher.BeginInvoke(new Action(delegate()
         {
             Feeders.ItemsSource = feeders.DefaultView;
         }));
         Thread.Sleep(2000);
     }
 }