private void FillTable() { foreach (Note note in singleton.GetPesistentData()) { store.AddNode(new NoteTreeNode(note)); } }
public MainWindow() : base(WindowType.Toplevel) { VBox mainVBox = new VBox(false, 0); HBox nodeViewHBox = new HBox(true, 0); HBox crudButtonsHBox = new HBox(true, 0); HBox transactionContolButtonsHBox = new HBox(true, 0); Button refreshButton = new Button("Refresh"); Button createButton = new Button("Create"); Button deleteButton = new Button("Delete"); Button commitButton = new Button("Commit"); Button rollbackButton = new Button("Rollback"); refreshButton.Clicked += RefreshButtonClicked; createButton.Clicked += CreateButtonClicked; deleteButton.Clicked += DeleteButtonClicked; commitButton.Clicked += CommitButtonClicked; rollbackButton.Clicked += RollbackButtonClicked; HSeparator separator = new HSeparator(); view = new NodeView(Store); CellRendererText titleRenderer = new CellRendererText(); CellRendererText contentRenderer = new CellRendererText(); titleRenderer.Editable = true; contentRenderer.Editable = true; titleRenderer.Edited += NoteTitleEdited; contentRenderer.Edited += NoteContentEdited; view.AppendColumn("Title", titleRenderer, "text", 0); view.AppendColumn("Content", contentRenderer, "text", 1); ScrolledWindow scrolledWindow = new ScrolledWindow(); scrolledWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); scrolledWindow.AddWithViewport(view); try { //Если сервер и клиент запускаются из ИДЕ (по порядку, но практически одновременно), //сервер не успевает создать сокет, поэтому надо немного подождать System.Threading.Thread.Sleep(1000); RemotingConfiguration.Configure("remoteNotes.exe.config", false); clientActivated = new NotesClientActivated(); singleton = new NotesSingleton(); singlecall = new NotesTransactionSinglecall(); } catch (System.Net.WebException) { Logger.Write("Unable to connect"); return; } foreach (Note note in singleton.GetPesistentData()) { store.AddNode(new NoteTreeNode(note)); } nodeViewHBox.PackStart(scrolledWindow, false, true, 0); nodeViewHBox.SetSizeRequest(200, 200); crudButtonsHBox.PackStart(refreshButton, false, true, 0); crudButtonsHBox.PackStart(createButton, false, true, 0); crudButtonsHBox.PackStart(deleteButton, false, true, 0); transactionContolButtonsHBox.PackStart(commitButton, false, true, 0); transactionContolButtonsHBox.PackStart(rollbackButton, false, true, 0); mainVBox.PackStart(nodeViewHBox, true, false, 0); mainVBox.PackStart(crudButtonsHBox, true, false, 0); mainVBox.PackStart(separator, true, false, 2); mainVBox.PackStart(transactionContolButtonsHBox, true, false, 0); Add(mainVBox); mainVBox.ShowAll(); Build(); }