123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace RedmineOracle
- {
- /// <summary>
- /// Логика взаимодействия для pgListLRP.xaml
- /// </summary>
- public partial class pgListLRP : Page
- {
- OracleWork ow;
- Thread refreshTread;
- Thread refreshOpen;
- int maxDrp;
- int maxOpen;
- int countOpen;
- int countDrp;
- public pgListLRP()
- {
- InitializeComponent();
- ow = new OracleWork();
- lbLRP.ItemsSource = ow.dtLrp().DefaultView;
- lbLRPOpen.ItemsSource = ow.outputOpen().DefaultView;
- tbResrond.ItemsSource = ow.listUsers();
- maxDrp = ow.CheckMaxDrp();
- maxOpen = ow.CheckMaxOpen();
- countOpen = ow.CheckCountOpen();
- tbResrond.SelectedValuePath = "Id";
- tbResrond.DisplayMemberPath = "Name";
- refreshTread = new Thread(refreshListOther);
- refreshTread.Start();
- refreshOpen = new Thread(refreshListOpen);
- refreshOpen.Start();
- //cbStatus.ItemsSource = ow.getAllStatus();
- //cbStatus.SelectedValuePath = "idStatus";
- //cbStatus.DisplayMemberPath = "statusName";
- }
- async void refreshListOther()
- {
- while (true)
- {
- ow = new OracleWork();
- if (maxDrp != ow.CheckMaxDrp())
- {
- maxDrp = ow.CheckMaxDrp();
- Application.Current.Dispatcher.Invoke(() =>
- {
- if (tbResrond.SelectedIndex == -1)
- {
- lbLRP.ItemsSource = ow.dtLrp().DefaultView;
- }
- else
- {
- lbLRP.ItemsSource = ow.findRespondLRP(tbResrond.SelectedValue.ToString()).DefaultView;
- }
- });
- }
- await Task.Delay(10000);
- }
- }
- async void refreshListOpen()
- {
- while (true)
- {
- ow = new OracleWork();
- if (maxOpen != ow.CheckMaxOpen() || countOpen != ow.CheckCountOpen())
- {
- Application.Current.Dispatcher.Invoke(() =>
- {
- lbLRPOpen.ItemsSource = ow.outputOpen().DefaultView;
- });
- maxOpen = ow.CheckMaxOpen();
- countOpen = ow.CheckCountOpen();
- }
- await Task.Delay(10000);
- }
- }
- private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
- {
- TextBlock tb = (TextBlock)sender;
- MessageBox.Show(lbLRP.Items.Count.ToString());
- LoadPages.forumFrame.Navigate(new pgLRP(Convert.ToInt32(tb.Text)));
-
- }
- private void btnFind_Click(object sender, RoutedEventArgs e)
- {
- if (ow.findLRP(tbIdLRP.Text) == 1)
- {
- LoadPages.forumFrame.Navigate(new pgLRP(Convert.ToInt32(tbIdLRP.Text)));
- }
- else
- MessageBox.Show("ЛРП с таким номером не существует!");
- }
- private void tbResrond_TextChanged(object sender, TextChangedEventArgs e)
- {
- if (tbResrond.Text != "")
- {
- tbResrond.ItemsSource = ow.listUsers().Where(x => x.Name.Contains(tbResrond.Text));
- }
- else
- {
- tbResrond.ItemsSource = ow.listUsers();
- tbResrond.SelectedIndex = -1;
- }
- tbResrond.SelectedValuePath = "Id";
- tbResrond.DisplayMemberPath = "Name";
- }
- private void tbResrond_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- //MessageBox.Show(tbResrond.SelectedValue.ToString());
- if (tbResrond.SelectedValue != null)
- lbLRP.ItemsSource = ow.findRespondLRP(tbResrond.SelectedValue.ToString()).DefaultView;
- }
- }
- }
|