public DictionarySorter_SortShould() { _ds = new DictionarySorter(); }
private void buildMenu() { var menu = new HBox(false, (int)AppSettings.Margin); var searchBar = new Entry(); menu.PackStart(searchBar, true, true, 0); var searchButton = new Button("T. Search"); searchButton.Clicked += (object sender, EventArgs args) => { DictionarySorter.SortBySearchTerm( searchBar.Buffer.Text, true, ref Words ); updateWordDisplay(); }; menu.PackStart(searchButton, false, false, 0); var searchButton2 = new Button("W. Search"); searchButton2.Clicked += (object sender, EventArgs args) => { DictionarySorter.SortBySearchTerm( searchBar.Buffer.Text, false, ref Words ); updateWordDisplay(); }; menu.PackStart(searchButton2, false, false, 0); var nativeSortButton = new Button("T. Sort"); nativeSortButton.Clicked += (object sender, EventArgs args) => { DictionarySorter.SortByNativeWord(ref Words); updateWordDisplay(); }; menu.PackStart(nativeSortButton, false, false, 0); var conlangSortButton = new Button("W. Sort"); conlangSortButton.Clicked += (object sender, EventArgs args) => { DictionarySorter.SortByConlangWord(ref Words); updateWordDisplay(); }; menu.PackStart(conlangSortButton, false, false, 0); var addButton = new Button("+"); addButton.Clicked += (object sender, EventArgs args) => { var dialog = new Dialog( "Add New Word", AppWindow.Instance, DialogFlags.DestroyWithParent ); dialog.ContentArea.Add(new Label("Word:")); var wordInput = new Entry(); dialog.ContentArea.Add(wordInput); dialog.ContentArea.Add(new Label("Translation:")); var transInput = new Entry(); dialog.ContentArea.Add(transInput); dialog.ContentArea.Add(new Label("Part of Speech:")); var posInput = new Entry(); dialog.ContentArea.Add(posInput); dialog.ContentArea.Add(new Label("Additional Info:")); var infoBox = new ScrolledWindow(); var info = new TextView(); infoBox.Add(info); dialog.ContentArea.Add(infoBox); dialog.AddButton("Add Word", ResponseType.Accept); dialog.AddButton("Cancel", ResponseType.Cancel); dialog.ShowAll(); int width, height; dialog.GetSize(out width, out height); dialog.SetSizeRequest(width * 2, height); dialog.Resizable = false; if (dialog.Run() == (int)ResponseType.Accept) { Words.Insert( 0, new WordEntry { Word = wordInput.Buffer.Text, Translation = transInput.Buffer.Text, PartOfSpeech = posInput.Buffer.Text, Additional = info.Buffer.Text } ); updateWordDisplay(); } dialog.Dispose(); }; menu.PackStart(addButton, false, false, 0); PackStart(menu, false, false, AppSettings.Margin); }