/// <summary> /// метод, который запускается при открытии окна /// открывается список проектов менеджера /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void Window_Activated(object sender, EventArgs e) { if (flag) { ProjectActions projectActions = new ProjectActions(); DatabaseActions databaseActions = new DatabaseActions(); List <string> listName = await databaseActions.ShowUserProjects(user); List <Project> listProjects = await projectActions.ShowProjects(); BackButton.Background = new ImageBrush(new BitmapImage(new Uri(path))); BackButton.Foreground = new ImageBrush(new BitmapImage(new Uri(path))); try { for (int i = 0; i < listProjects.Count; i++) { for (int j = 0; j < listName.Count; j++) { if (listName[j] == listProjects[i].Name) { listBox.Items.Add(listProjects[i]); } } } } catch (NullReferenceException) { MessageBox.Show("You havent projects and risks"); } flag = false; } }
/// <summary> /// метод, запускающийся при активации окна /// отображается список существующих проектов пользователя /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void Window_Activated(object sender, EventArgs e) { if (flag) { BackButton.Background = new ImageBrush(new BitmapImage(new Uri(path))); BackButton.Foreground = new ImageBrush(new BitmapImage(new Uri(path))); ProjectActions projectActions = new ProjectActions(); List <Project> listProjects = await projectActions.ShowProjects(); for (int i = 0; i < listProjects.Count; i++) { listBoxProjects.Items.Add(listProjects[i]); listBoxProjects.Items.ToString(); } flag = false; } }