示例#1
0
 private void AddTag_Click(object sender, RoutedEventArgs e)
 {
     mutex.WaitOne();
     if (Tags.Items.Count != 0)
     {
         UserProfilerView userProfilerView = new UserProfilerView();
         userProfilerView.AddTag(currentFeederId);
     }
     mutex.ReleaseMutex();
 }
示例#2
0
        private void AddFeeder_Click(object sender, RoutedEventArgs e)
        {
            mutex.WaitOne();
            UserProfilerView view = new UserProfilerView();

            view.AddFeeder(UserId);
            feeders = view.updateFeederList(UserId);
            Feeders.Dispatcher.BeginInvoke(new Action(delegate()
            {
                Feeders.ItemsSource = feeders.DefaultView;
            }));
            mutex.ReleaseMutex();
        }
示例#3
0
        private void Tags_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            mutex.WaitOne();
            UserProfilerView userView     = new UserProfilerView();
            DataGrid         gd           = (DataGrid)sender;
            DataRowView      row_selected = gd.SelectedItem as DataRowView;

            if (row_selected != null)
            {
                int tagId = Convert.ToInt32(row_selected["tagId"].ToString());
                userView.deleteTag(tagId);
            }
            mutex.ReleaseMutex();
        }
示例#4
0
        public UserProfiler(int UserId)
        {
            InitializeComponent();
            this.UserId = UserId;
            UserProfilerView view = new UserProfilerView();

            feeders = view.updateFeederList(UserId);
            Feeders.Dispatcher.BeginInvoke(new Action(delegate()
            {
                Feeders.ItemsSource = feeders.DefaultView;
            }));
            mutex      = new Mutex();
            tagsThread = new Thread(new ThreadStart(thread));
            tagsThread.Start();
        }
示例#5
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();
        }
示例#6
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);
     }
 }
示例#7
0
        private void Manual_Click(object sender, RoutedEventArgs e)
        {
            UserProfilerView userProfilerView = new UserProfilerView();

            userProfilerView.ManualFeed(currentFeederId);
        }
示例#8
0
        private void AddSchedule_Click(object sender, RoutedEventArgs e)
        {
            UserProfilerView userProfilerView = new UserProfilerView();

            userProfilerView.AddSchedule(currentFeederId);
        }