private void AddEmailRow(Email newEmail) { datatableEmails.NRows = RowNum + 1; var emailDataCombo = new yListComboBox(); emailDataCombo.WidthRequest = 100; emailDataCombo.SetRenderTextFunc((EmailType x) => x.Name); emailDataCombo.ItemsList = emailTypes; emailDataCombo.Binding.AddBinding(newEmail, e => e.EmailType, w => w.SelectedItem).InitializeFromSource(); datatableEmails.Attach(emailDataCombo, (uint)0, (uint)1, RowNum, RowNum + 1, AttachOptions.Fill | AttachOptions.Expand, (AttachOptions)0, (uint)0, (uint)0); yValidatedEntry emailDataEntry = new yValidatedEntry(); emailDataEntry.ValidationMode = ValidationType.email; emailDataEntry.Tag = newEmail; emailDataEntry.Binding.AddBinding(newEmail, e => e.Address, w => w.Text).InitializeFromSource(); datatableEmails.Attach(emailDataEntry, (uint)1, (uint)2, RowNum, RowNum + 1, AttachOptions.Expand | AttachOptions.Fill, (AttachOptions)0, (uint)0, (uint)0); Gtk.Button deleteButton = new Gtk.Button(); Gtk.Image image = new Gtk.Image(); image.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-delete", global::Gtk.IconSize.Menu); deleteButton.Image = image; deleteButton.Clicked += OnButtonDeleteClicked; datatableEmails.Attach(deleteButton, (uint)2, (uint)3, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); datatableEmails.ShowAll(); RowNum++; }
private void AddPhoneRow(Phone newPhone) { datatablePhones.NRows = RowNum + 1; var phoneDataCombo = new yListComboBox(); phoneDataCombo.WidthRequest = 100; phoneDataCombo.SetRenderTextFunc((PhoneType x) => x.Name); phoneDataCombo.ItemsList = phoneTypes; phoneDataCombo.Binding.AddBinding(newPhone, e => e.PhoneType, w => w.SelectedItem).InitializeFromSource(); datatablePhones.Attach(phoneDataCombo, (uint)0, (uint)1, RowNum, RowNum + 1, AttachOptions.Fill | AttachOptions.Expand, (AttachOptions)0, (uint)0, (uint)0); Gtk.Label textPhoneLabel = new Gtk.Label("+7"); datatablePhones.Attach(textPhoneLabel, (uint)1, (uint)2, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); var phoneDataEntry = new yValidatedEntry(); phoneDataEntry.ValidationMode = ValidationType.phone; phoneDataEntry.Tag = newPhone; phoneDataEntry.WidthChars = 19; phoneDataEntry.Binding.AddBinding(newPhone, e => e.Number, w => w.Text).InitializeFromSource(); datatablePhones.Attach(phoneDataEntry, (uint)2, (uint)3, RowNum, RowNum + 1, AttachOptions.Expand | AttachOptions.Fill, (AttachOptions)0, (uint)0, (uint)0); HandsetView handset = new HandsetView(newPhone.DigitsNumber); datatablePhones.Attach(handset, (uint)3, (uint)4, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); Gtk.Label textAdditionalLabel = new Gtk.Label("доб."); datatablePhones.Attach(textAdditionalLabel, (uint)4, (uint)5, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); var additionalDataEntry = new yEntry(); additionalDataEntry.WidthRequest = 50; additionalDataEntry.MaxLength = 10; additionalDataEntry.Binding.AddBinding(newPhone, e => e.Additional, w => w.Text).InitializeFromSource(); datatablePhones.Attach(additionalDataEntry, (uint)5, (uint)6, RowNum, RowNum + 1, AttachOptions.Fill, (AttachOptions)0, (uint)0, (uint)0); Gtk.Label labelName = new Gtk.Label("имя:"); datatablePhones.Attach(labelName, (uint)6, (uint)7, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); var entryName = new yEntry(); //entryName.WidthRequest = 50; entryName.MaxLength = 150; entryName.Binding.AddBinding(newPhone, e => e.Name, w => w.Text).InitializeFromSource(); datatablePhones.Attach(entryName, (uint)7, (uint)8, RowNum, RowNum + 1, AttachOptions.Expand | AttachOptions.Fill, (AttachOptions)0, (uint)0, (uint)0); Gtk.Button deleteButton = new Gtk.Button(); Gtk.Image image = new Gtk.Image(); image.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-delete", global::Gtk.IconSize.Menu); deleteButton.Image = image; deleteButton.Clicked += OnButtonDeleteClicked; datatablePhones.Attach(deleteButton, (uint)8, (uint)9, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); datatablePhones.ShowAll(); RowNum++; }
private void AddPhoneRow(Phone newPhone) { datatablePhones.NRows = RowNum + 1; var phoneDataCombo = new yListComboBox(); phoneDataCombo.WidthRequest = 100; phoneDataCombo.SetRenderTextFunc((PhoneType x) => x.Name); phoneDataCombo.ItemsList = phoneTypes; phoneDataCombo.Binding.AddBinding(newPhone, e => e.NumberType, w => w.SelectedItem).InitializeFromSource(); datatablePhones.Attach (phoneDataCombo, (uint)0, (uint)1, RowNum, RowNum + 1, AttachOptions.Fill | AttachOptions.Expand, (AttachOptions)0, (uint)0, (uint)0); Gtk.Label textPhoneLabel = new Gtk.Label ("+7"); datatablePhones.Attach (textPhoneLabel, (uint)1, (uint)2, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); var phoneDataEntry = new yValidatedEntry (); phoneDataEntry.ValidationMode = ValidationType.phone; phoneDataEntry.WidthChars = 19; phoneDataEntry.Binding.AddBinding(newPhone, e => e.Number, w => w.Text).InitializeFromSource(); datatablePhones.Attach (phoneDataEntry, (uint)2, (uint)3, RowNum, RowNum + 1, AttachOptions.Expand | AttachOptions.Fill, (AttachOptions)0, (uint)0, (uint)0); Gtk.Label textAdditionalLabel = new Gtk.Label ("доб."); datatablePhones.Attach (textAdditionalLabel, (uint)3, (uint)4, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); var additionalDataEntry = new yEntry (); additionalDataEntry.WidthRequest = 50; additionalDataEntry.MaxLength = 10; additionalDataEntry.Binding.AddBinding(newPhone, e => e.Additional, w => w.Text).InitializeFromSource(); datatablePhones.Attach (additionalDataEntry, (uint)4, (uint)5, RowNum, RowNum + 1, AttachOptions.Expand | AttachOptions.Fill, (AttachOptions)0, (uint)0, (uint)0); Gtk.Button deleteButton = new Gtk.Button (); Gtk.Image image = new Gtk.Image (); image.Pixbuf = Stetic.IconLoader.LoadIcon (this, "gtk-delete", global::Gtk.IconSize.Menu); deleteButton.Image = image; deleteButton.Clicked += OnButtonDeleteClicked; datatablePhones.Attach (deleteButton, (uint)5, (uint)6, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); datatablePhones.ShowAll (); RowNum++; }
private void DrawNewRow(Phone newPhone) { if (hBoxList?.FirstOrDefault() == null) { hBoxList = new List <HBox>(); } HBox hBox = new HBox(); var phoneDataCombo = new yListComboBox(); phoneDataCombo.WidthRequest = 100; phoneDataCombo.SetRenderTextFunc((PhoneType x) => x.Name); phoneDataCombo.ItemsList = viewModel.PhoneTypes; phoneDataCombo.Binding.AddBinding(newPhone, e => e.PhoneType, w => w.SelectedItem).InitializeFromSource(); phoneDataCombo.Binding.AddFuncBinding(viewModel, e => !e.ReadOnly, w => w.Sensitive).InitializeFromSource(); hBox.Add(phoneDataCombo); hBox.SetChildPacking(phoneDataCombo, true, true, 0, PackType.Start); Label textPhoneLabel = new Label("+7"); hBox.Add(textPhoneLabel); hBox.SetChildPacking(textPhoneLabel, false, false, 0, PackType.Start); var phoneDataEntry = new yValidatedEntry(); phoneDataEntry.ValidationMode = ValidationType.phone; phoneDataEntry.Tag = newPhone; phoneDataEntry.WidthRequest = 125; phoneDataEntry.WidthChars = 19; phoneDataEntry.Binding.AddBinding(newPhone, e => e.Number, w => w.Text).InitializeFromSource(); phoneDataEntry.Binding.AddFuncBinding(viewModel, e => !e.ReadOnly, w => w.IsEditable).InitializeFromSource(); hBox.Add(phoneDataEntry); hBox.SetChildPacking(phoneDataEntry, false, false, 0, PackType.Start); HandsetView handset = new HandsetView(newPhone.DigitsNumber); hBox.Add(handset); hBox.SetChildPacking(handset, false, false, 0, PackType.Start); var textAdditionalLabel = new Gtk.Label("доб."); hBox.Add(textAdditionalLabel); hBox.SetChildPacking(textAdditionalLabel, false, false, 0, PackType.Start); var additionalDataEntry = new yEntry(); additionalDataEntry.WidthRequest = 50; additionalDataEntry.MaxLength = 10; additionalDataEntry.Binding.AddBinding(newPhone, e => e.Additional, w => w.Text).InitializeFromSource(); additionalDataEntry.Binding.AddFuncBinding(viewModel, e => !e.ReadOnly, w => w.IsEditable).InitializeFromSource(); hBox.Add(additionalDataEntry); hBox.SetChildPacking(additionalDataEntry, false, false, 0, PackType.Start); var labelName = new Label("имя:"); hBox.Add(labelName); hBox.SetChildPacking(labelName, false, false, 0, PackType.Start); var entryName = new yEntry(); entryName.MaxLength = 150; entryName.Binding.AddBinding(newPhone, e => e.Name, w => w.Text).InitializeFromSource(); entryName.Binding.AddFuncBinding(viewModel, e => !e.ReadOnly, w => w.IsEditable).InitializeFromSource(); hBox.Add(entryName); hBox.SetChildPacking(entryName, true, true, 0, PackType.Start); yButton deleteButton = new yButton(); Image image = new Image(); image.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-delete", IconSize.Menu); deleteButton.Image = image; deleteButton.Clicked += (sender, e) => viewModel.DeleteItemCommand.Execute(hBox.Data["phone"] as Phone); deleteButton.Binding.AddFuncBinding(viewModel, e => !e.ReadOnly, w => w.Sensitive).InitializeFromSource(); hBox.Add(deleteButton); hBox.SetChildPacking(deleteButton, false, false, 0, PackType.Start); hBox.Data.Add("phone", newPhone); //Для свзяки виджета и телефона hBox.ShowAll(); vboxPhones.Add(hBox); vboxPhones.ShowAll(); hBoxList.Add(hBox); }
private void AddEmailRow(Email newEmail) { datatableEmails.NRows = RowNum + 1; var emailDataCombo = new yListComboBox(); emailDataCombo.WidthRequest = 100; emailDataCombo.SetRenderTextFunc ((EmailType x) => x.Name); emailDataCombo.ItemsList = emailTypes; emailDataCombo.Binding.AddBinding(newEmail, e => e.EmailType, w => w.SelectedItem).InitializeFromSource(); datatableEmails.Attach (emailDataCombo, (uint)0, (uint)1, RowNum, RowNum + 1, AttachOptions.Fill | AttachOptions.Expand, (AttachOptions)0, (uint)0, (uint)0); yValidatedEntry emailDataEntry = new yValidatedEntry(); emailDataEntry.ValidationMode = ValidationType.email; emailDataEntry.Binding.AddBinding(newEmail, e => e.Address, w => w.Text).InitializeFromSource(); datatableEmails.Attach (emailDataEntry, (uint)1, (uint)2, RowNum, RowNum + 1, AttachOptions.Expand | AttachOptions.Fill, (AttachOptions)0, (uint)0, (uint)0); Gtk.Button deleteButton = new Gtk.Button (); Gtk.Image image = new Gtk.Image (); image.Pixbuf = Stetic.IconLoader.LoadIcon (this, "gtk-delete", global::Gtk.IconSize.Menu); deleteButton.Image = image; deleteButton.Clicked += OnButtonDeleteClicked; datatableEmails.Attach (deleteButton, (uint)2, (uint)3, RowNum, RowNum + 1, (AttachOptions)0, (AttachOptions)0, (uint)0, (uint)0); datatableEmails.ShowAll (); RowNum++; }