/// <summary> /// Constructor for creating new QSet /// </summary> /// <param name="navManager"></param> /// <param name="qSetsManager"></param> /// <param name="name"></param> /// <param name="path"></param> public QSetEditorUC(NavigationManager navManager, QSetsManager qSetsManager, string name, string path) : this(navManager, qSetsManager) { EditedQSet = new QSet(name, path); isNew = true; saved = false; SetCollectionViews(); }
/// <summary> /// Constructor for editing existing QSet /// </summary> /// <param name="navManager"></param> /// <param name="qSetsManager"></param> /// <param name="index"></param> public QSetEditorUC(NavigationManager navManager, QSetsManager qSetsManager, QSet qSet, int index) : this(navManager, qSetsManager) { EditedQSet = qSet; isNew = false; this.index = index; actualPath = qSet.Path; SetCollectionViews(); }
private void QSetsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { foreach (Button button in qSetActionButtons) { button.IsEnabled = QSetsListBox.SelectedItem != null; } selected = (QSet)QSetsListBox.SelectedItem; }
/// <summary> /// Constructs the object. /// </summary> public QSetExplorer() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); _queueSet = null; _queueSetTreeView.AfterLabelEdit += new NodeLabelEditEventHandler(_queueSetTreeView_AfterLabelEdit); }
/// <summary> /// Displays a QSet in the explorer. /// </summary> /// <param name="queueSet">QSet to display.</param> private void DisplayQSet(QSet queueSet) { _queueSetTreeView.Nodes.Clear(); if (_queueSet != null) { QSetItemTreeNode queueSetNode = new QSetItemTreeNode(_queueSet); _queueSetTreeView.Nodes.Add((QSetItemTreeNode)queueSetNode); DisplayQSetChildItems(queueSet, queueSetNode); } }
private void editButton_Click(object sender, RoutedEventArgs e) { try { QSet toEdit = FileManager.LoadQSetFromFile(selected.Path); navManager.ShowQSetEditor(toEdit, QSetsListBox.SelectedIndex); } catch (Exception ex) { MessageBox.Show("Soubor se nepodařilo načíst.\n" + ex.Message, "Chyba", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void importButton_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); openFileDialog.DefaultExt = ".csv"; openFileDialog.Filter = "Dokumenty CSV|*.csv"; bool?result = openFileDialog.ShowDialog(); if (result == true) { string file = openFileDialog.FileName; QSet newQSet = null; try { newQSet = FileManager.LoadQSetFromFile(file); if (qSetsManager.CheckName(newQSet.Name)) { MessageBox.Show("Sada otázek s názvem " + newQSet.Name + " už existuje. Pokud chcete přesto importovat, změňte název jedné ze sad.", "Chyba", MessageBoxButton.OK, MessageBoxImage.Error); return; } newQSet.Path = FileManager.GenerateFilePath(newQSet.Name); if (qSetsManager.CheckPath(newQSet.Path)) { MessageBox.Show("Pro název " + newQSet.Name + " nelze vygenerovat jedinečný název souboru.", "Chyba", MessageBoxButton.OK, MessageBoxImage.Error); return; } FileManager.ImportQSet(file, newQSet.Path); } catch (Exception ex) { MessageBox.Show(ex.Message, "Chyba", MessageBoxButton.OK, MessageBoxImage.Error); return; } qSetsManager.QuestionSets.Add(newQSet); qSetsManager.Sort(); QSetsListBox.ItemsSource = qSetsManager.QuestionSets; } }
private static void ContactsTest() { Console.WriteLine("ContactsTest"); var client = new QDataClient(); var qSet = new QSet <ContactDto>(); var query = qSet.QueryString("a", dto => new object[] { dto.EdvNr, dto.Customer.Firma11 }).Where(x => x.Id > 0); var descriptor = qSet.Serialize(query); var contacts = client.Get <ContactDto>(contactAccsessPoint, descriptor); if (contacts == null) { return; } foreach (var customer in contacts) { Console.WriteLine("id={0}", customer.Id); } }
/// <summary> /// Displays UserControl with QSet editor (editing existing QSet) /// </summary> /// <param name="qSet">QSet to edit</param> /// <param name="index">Index of QSet in original collection</param> public void ShowQSetEditor(QSet qSet, int index) { UserControl editor = new QSetEditorUC(this, QSetsManager, qSet, index); CurrentUC = editor; }