private async void Window_Activated(object sender, EventArgs e) { if (flag) { Back.Background = new ImageBrush(new BitmapImage(new Uri(path))); Back.Foreground = new ImageBrush(new BitmapImage(new Uri(path))); ProjectCommands pc = new ProjectCommands(); DataCommands dc = new DataCommands(); List <string> lst = await dc.GiveOwnersProjects(user); List <Project> prlst = await pc.GiveAllProjects(); try { for (int i = 0; i < prlst.Count; i++) { for (int j = 0; j < lst.Count; j++) { if (lst[j] == prlst[i].Name) { listBox.Items.Add(prlst[i]); } } } } catch (NullReferenceException) { MessageBox.Show("You havent projects and risks"); } flag = false; } }
private async void Window_Activated(object sender, EventArgs e) { if (flag) { Back.Background = new ImageBrush(new BitmapImage(new Uri(path))); Back.Foreground = new ImageBrush(new BitmapImage(new Uri(path))); ProjectCommands pc = new ProjectCommands(); List <Project> prlst = await pc.GiveProjectsForOwner(user.Login); for (int i = 0; i < prlst.Count; i++) { listBox.Items.Add(prlst[i]); } } }
private async void Window_Activated(object sender, EventArgs e) { if (flagApearing) { Back.Background = new ImageBrush(new BitmapImage(new Uri(path))); Back.Foreground = new ImageBrush(new BitmapImage(new Uri(path))); ProjectCommands pc = new ProjectCommands(); List <Project> list = await pc.GiveAllProjects(); for (int i = 0; i < list.Count; i++) { listBox.Items.Add(list[i]); listBox.Items.ToString(); } flagApearing = false; } }
private async void Create_Click(object sender, RoutedEventArgs e) { try { ProjectCommands pc = new ProjectCommands(); await pc.IsertNewProject(Name.Text, ((User)(Owners.SelectedItem)).Login, TypeOfProject.Text); Graphic cr = new Graphic(new Project(Name.Text, ((User)(Owners.SelectedItem)).Login, TypeOfProject.Text)); Close(); cr.Show(); } catch (ArgumentException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }