private void AddCommandMethod(object arg) { WindowAddView windowAdd = new WindowAddView { DataContext = new WindowAddEditViewModel(), Owner = arg as Window, }; var showDialog = windowAdd.ShowDialog(); if (showDialog != null && showDialog.Value) { var result = windowAdd.DataContext as WindowAddEditViewModel; if (result != null) { var book = new RegistryBook { Author = result.Author, YearPublic = result.YearPublic, Title = result.Title, NumOfInvent = result.NumOfInvent }; LibraryList.Add(book); } } }
public Program() { m_fileName = null; m_isModified = false; m_procedures = new ProgramProcedureList(this, new ObservableCollection<Procedure>()); m_isOptimized = false; m_libraries = LibraryList.Create(); m_libraries.Add(Library.Standard); }
public Query(CodeSentence codeSentence) { if (codeSentence == null) { throw new ArgumentNullException("codeSentence"); } m_codeSentence = codeSentence; m_libraries = LibraryList.Create(); m_libraries.Add(Library.Standard); }
/// <summary> /// Adds given WBImage at given filePath to the library if it is not already in library /// </summary> /// <param name="image"></param> /// <param name="filePath"></param> private void AddImage(WBImage image) { // Give user message and don't add this image if it is already in library if (LibraryList.Any(checkImage => checkImage.Path.Equals(image.Path))) { _notifier.ShowInformation(string.Format("{0} was not added since it is already in the library", Path.GetFileName(image.Path))); } // Otherwise add the image to the library else { LibraryList.Add(image); } }
private void Button_addCustomJavaLibrary_Click(object sender, RoutedEventArgs e) { var openFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Jar Files (*.*)|*.*" }; var result = openFileDialog.ShowDialog(); if (result == true) { LibraryList.Add(openFileDialog.FileName); } LibraryList = LibraryList; }
public MainForm() { InitializeComponent(); BookListView.MouseDoubleClick += new MouseEventHandler(BookListView_MouseDoubleClick); BookListView.View = View.Details; this.LibraryList = new List <Core.Library>(); LibraryList.Add(new Core.Library(0, "Oscars Bibliotek")); foreach (var library in LibraryList) { LibraryDropdown.Items.Add($"{library.Id} : {library.Name}"); } //var row = new string[] { "0", "Hello", "World!", "Yes" }; this.activeLibrary = LibraryList[0]; if (LibraryDropdown.SelectedItem != null) { foreach (var library in LibraryList) { if (LibraryDropdown.SelectedItem.ToString() == library.Name) { this.activeLibrary = library; break; } } } else { LibraryDropdown.SelectedItem = LibraryDropdown.Items[0]; } if (this.activeLibrary == null) { this.activeLibrary = LibraryList[0]; } for (int i = 0; i < 5; i++) { this.activeLibrary.AvailibleGenreList.Add("Genre: " + i); } foreach (string Genere in this.activeLibrary.AvailibleGenreList) { this.GenreSelectionBox.Items.Add(Genere); } for (int i = 0; i < 2; i++) { this.activeLibrary.AddBook("Hello World Volume." + i, "God"); } foreach (var Book in this.activeLibrary.BookList) { var row = new string[] { Book.Id.ToString(), Book.Titel, Book.Author, Book.Loaned.ToString() }; var lvi = new ListViewItem(row); lvi.Tag = "Book"; lvi.ToolTipText = "Doubble click to open or edit book!"; BookListView.Items.Add(lvi); } }