private void AddTag_Click(object sender, RoutedEventArgs e) { mutex.WaitOne(); if (Tags.Items.Count != 0) { UserProfilerView userProfilerView = new UserProfilerView(); userProfilerView.AddTag(currentFeederId); } mutex.ReleaseMutex(); }
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(); }
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(); }
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(); }
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(); }
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); } }
private void Manual_Click(object sender, RoutedEventArgs e) { UserProfilerView userProfilerView = new UserProfilerView(); userProfilerView.ManualFeed(currentFeederId); }
private void AddSchedule_Click(object sender, RoutedEventArgs e) { UserProfilerView userProfilerView = new UserProfilerView(); userProfilerView.AddSchedule(currentFeederId); }