private void MainWindow_Loaded() { VersionInDBServerRepo repo = new VersionInDBServerRepo("127.0.0.1", 8005); IList <AppVersion> versions = repo.FindAll(); ListApps.ItemsSource = versions; }
///<summary>Список приложений подверженных версионному контролю</summary> private List <AppVersion> listApp() { VersionInDBServerRepo repo_fileDB = new VersionInDBServerRepo("127.0.0.1", 8005); IDiscriptionApp discription = new DiscriptionAppInServer("127.0.0.1", 8005); IList <AppVersion> versionsDB = repo_fileDB.FindAll(); List <AppVersion> versionsSort = new List <AppVersion>(); string[] VersionsApps = (from vers in versionsDB select vers.VersionName.ToString()).Distinct().ToArray(); versionsSort.AddRange(from string vSort in VersionsApps where discription.GetAppVersion(vSort) != null select discription.GetAppVersion(vSort)); return(versionsSort); }
private void AddApp_Click(object sender, RoutedEventArgs e) { try { if (Number.Text != "" && NameApp.Text != "" && Path.Text != "") { IVersionRepo versionRepo = new VersionInDBServerRepo("127.0.0.1", 8005); IList <AppVersion> versions = versionRepo.FindAll(); AppVersion version = new AppVersion(NameApp.Text, new VersionNumber(1, 0)); if (!versions.Contains(version)) { if (service.AddAplicationNew(Path.Text, NameApp.Text, new VersionNumber(Convert.ToInt32(Number.Text), 0)).ToString() == new ServiceResult(true).ToString()) { message = "Приложение добавлено"; } else { message = "Ошибка обновления приложения"; } new Notifications.Notif(message).ShowDialog(); Close(); } else { if (service.AddAplication(NameApp.Text, new AppBuilder(Path.Text, NameApp.Text, new VersionNumber(Convert.ToInt32(Number.Text), 0))).ToString() == new ServiceResult(true).ToString()) { message = "Приложение добавлено"; new Notifications.Notif(message).ShowDialog(); Close(); } else { message = "Введена старая версия"; } } } else { string message = "Заполните все поля!"; new Notifications.Notif(message).ShowDialog(); } } catch (Exception) { string message = "Ошибка добавления приложения"; new Notifications.Notif(message).ShowDialog(); Close(); } }