public async Task updateGUI() { SqlConnection connection = new SqlConnection("Data Source=mycsdb.civb68g6fy4p.us-east-2.rds.amazonaws.com;Initial Catalog=warehouse;User ID=masterUser;Password=master1234;"); using (connection) { await connection.OpenAsync(); SqlCommand getNumberOfRoutes = new SqlCommand("SELECT COUNT(DISTINCT route_id) FROM route_info", connection); SqlDataReader numRts = await getNumberOfRoutes.ExecuteReaderAsync(); numRts.Read(); checkCount = numRts.GetInt32(0); numRts.Close(); connection.Close(); } int count; if (checkCount == 0) { count = numCenterPoints + 1; } else { count = checkCount + 1; } RouteList.Items.Clear(); for (int i = 1; i < count; i++) { int routenum = 100 + i; System.Windows.Controls.ListBoxItem routeTitle = new ListBoxItem(); routeTitle.Content = "Route " + routenum; routeTitle.FontSize = 20; routeTitle.SetValue(ListBoxItem.FontWeightProperty, FontWeights.Bold); route = new ListBoxItem(); System.Windows.Controls.ListBox orders = new ListBox(); orders.FontSize = 12; orders.Height = 140; orders.Width = 390; orders.BorderBrush = Brushes.Black; orders.BorderThickness.Equals(2); route.Height = 150; route.Width = 400; route.SetValue(ListBoxItem.HorizontalAlignmentProperty, HorizontalAlignment.Center); route.BorderThickness.Equals(1); RouteList.Items.Add(routeTitle); connection = new SqlConnection("Data Source=mycsdb.civb68g6fy4p.us-east-2.rds.amazonaws.com;Initial Catalog=warehouse;User ID=masterUser;Password=master1234;"); using (connection) { await connection.OpenAsync(); SqlCommand getRoutes = new SqlCommand("SELECT * FROM routelist WHERE route_id = " + routenum + ";", connection); using (SqlDataReader readRoutes = await getRoutes.ExecuteReaderAsync()) { while (readRoutes.Read()) { System.Windows.Controls.ListBoxItem edit = new ListBoxItem(); edit.SetValue(ListBoxItem.HorizontalContentAlignmentProperty, HorizontalAlignment.Center); System.Windows.Controls.StackPanel stk = new StackPanel(); stk.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal); stk.SetValue(StackPanel.HorizontalAlignmentProperty, HorizontalAlignment.Left); System.Windows.Controls.TextBlock account = new TextBlock(); account.Width = 80; account.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Left); account.Text = Convert.ToString(readRoutes.GetInt32(0)); System.Windows.Controls.TextBlock name = new TextBlock(); name.Width = 250; name.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Left); name.Text = readRoutes.GetString(1); System.Windows.Controls.TextBlock totalbox = new TextBlock(); totalbox.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Right); totalbox.Width = 30; SqlConnection connection2 = new SqlConnection("Data Source=mycsdb.civb68g6fy4p.us-east-2.rds.amazonaws.com;Initial Catalog=warehouse;User ID=masterUser;Password=master1234;"); await connection2.OpenAsync(); SqlCommand getTotals = new SqlCommand("SELECT SUM(quantity) FROM orders WHERE acc_id = " + readRoutes.GetInt32(0) + ";", connection2); string tot = Convert.ToString(await getTotals.ExecuteScalarAsync()); connection2.Close(); totalbox.Text = tot; stk.Children.Add(account); stk.Children.Add(name); stk.Children.Add(totalbox); edit.Content = stk; edit.Selected += async delegate(object se, RoutedEventArgs es) { await order1_MouseDoubleClickAsync(se, es, Convert.ToInt32(account.Text)); }; orders.Items.Add(edit); } route.Content = orders; RouteList.Items.Add(route); readRoutes.Close(); } connection.Close(); } } }
public static void SetGivesHoverFeedback(ListBoxItem element, bool value) { element.SetValue(GivesHoverFeedbackProperty, value); }
public static void SetIsBroughtIntoViewWhenSelected(ListBoxItem listBoxItem, bool value) { listBoxItem.SetValue(IsBroughtIntoViewWhenSelectedProperty, value); }
public virtual void IsSelectionActiveTest () { IPoker p = CurrentControl; ListBoxItem item = new ListBoxItem (); Assert.IsFalse ((bool) item.GetValue (ListBox.IsSelectionActiveProperty), "#1"); Assert.Throws<InvalidOperationException> (() => item.SetValue (ListBox.IsSelectionActiveProperty, true)); Assert.IsFalse ((bool) item.GetValue (ListBox.IsSelectionActiveProperty), "#2"); p.Items.Add (item); p.SelectedItem = item; Assert.IsFalse ((bool) item.GetValue (ListBox.IsSelectionActiveProperty), "#3"); p.SelectedIndex = -1; Assert.IsFalse ((bool) item.GetValue (ListBox.IsSelectionActiveProperty), "#4"); Assert.AreSame (ComboBox.IsSelectionActiveProperty, ListBox.IsSelectionActiveProperty, "#5"); }
public static void SetIsSelectible(ListBoxItem element, bool value) { element.SetValue(IsSelectibleProperty, value); }
public static void SetIsRecent(ListBoxItem element, bool value) { element.SetValue(IsRecentProperty, value); }
/// <summary> /// Sets the IsBroughtIntoViewWhenSelected value /// </summary> /// <param name="listBoxItem"></param> /// <param name="value"></param> public static void SetBringIntoViewNewItems(ListBoxItem listBoxItem, bool value) { listBoxItem.SetValue(BringIntoViewNewItemsProperty, value); }
public static void SetHighlightForegroundBrush(ListBoxItem element, Brush value) { element.SetValue(HighlightForegroundBrushProperty, value); }
public static void SetIsEnabled(ListBoxItem element, bool value) { element.SetValue(IsEnabledProperty, value); }
public static void SetBaseStyle(ListBoxItem element, Style value) { element.SetValue(BaseStyleProperty, value); }
/// <summary> /// Sets the drag format when this instance is being dragged above or below another row. /// </summary> /// <param name="listBoxItem">The list box item.</param> /// <param name="format">The drag format used when this instance is being dragged above or below another row.</param> public static void SetMoveDragFormat(ListBoxItem listBoxItem, string format) { listBoxItem.SetValue(MoveDragFormatProperty, format); }
/// <summary> /// Sets the content template when this instance is being dragged above or below another row. /// </summary> /// <param name="listBoxItem">The list box item.</param> /// <param name="value">A data template used when this instance is being dragged above or below another row.</param> public static void SetMoveDragContentTemplate(ListBoxItem listBoxItem, DataTemplate value) { listBoxItem.SetValue(MoveDragContentTemplateProperty, value); }
/// <summary> /// Sets the command used to move another row below this one using drag and drop. /// </summary> /// <param name="listBoxItem">The list box item.</param> /// <param name="command">The command to move a row below this instance.</param> public static void SetMoveBelowCommand(ListBoxItem listBoxItem, ICommand command) { listBoxItem.SetValue(MoveBelowCommandProperty, command); }
/// <summary> /// Sets the deselection enabled property. If enabled, and the row is clicked while selected, the row is deselected. /// </summary> /// <param name="listBoxItem">The list box item.</param> /// <param name="value">if set to <c>true</c> deselects the row when selected and clicked.</param> public static void SetIsDeselectionEnabled(ListBoxItem listBoxItem, bool value) { listBoxItem.SetValue(IsDeselectionEnabledProperty, value); }