public void ReloadListDeviceItems() { try { int index = 0; Int32.TryParse(mainWindow.DeviceItemsListDg.SelectedIndex.ToString(), out index); if (mainWindow.unityService.deviceRegistrationService.deviceItemList.Count > 0) { deviceItemsList.Clear(); foreach (DeviceItem device in mainWindow.unityService.deviceRegistrationService.deviceItemList) { deviceItemsList.Add(device); } if (GroupedDeviceItems.IsEditingItem) { GroupedDeviceItems.CommitEdit(); } if (GroupedDeviceItems.IsAddingNew) { GroupedDeviceItems.CommitNew(); } GroupedDeviceItems.Refresh(); if (mainWindow.DeviceItemsListDg.HasItems) { mainWindow.DeviceItemsListDg.SelectedItem = mainWindow.DeviceItemsListDg.Items[(index > -1) ? index : 0]; if (mainWindow.DeviceItemsListDg.SelectedItem != null) { DeviceItem temp = mainWindow.DeviceItemsListDg.SelectedItem as DeviceItem; mainWindow.canvasControlService.ReloadListOrderItems(temp); } } #region Khanh added 3 ALL_orderItemsList.Clear(); foreach (DeviceItem device in mainWindow.unityService.deviceRegistrationService.deviceItemList) { //deviceItemsList.Add(device); foreach (DeviceItem.OrderItem item in device.OrderedItemList) { ALL_orderItemsList.Add(item); } } ALL_OrderItems.Refresh(); //ALL_OrderItems.SortDescriptions.Clear(); //ALL_OrderItems.SortDescriptions.Add(new SortDescription("dateTime", ListSortDirection.Descending)); #endregion } } catch { Console.WriteLine("Error in ReloadListDeviceItems"); } }
public void ReloadListDeviceItems() { try { int index = 0; Int32.TryParse(mainWindow.DeviceItemsListDg.SelectedIndex.ToString(), out index); if (mainWindow.unityService.deviceRegistrationService.deviceItemList.Count > 0) { deviceItemsList.Clear(); foreach (DeviceItem device in mainWindow.unityService.deviceRegistrationService.deviceItemList) { deviceItemsList.Add(device); } if (GroupedDeviceItems.IsEditingItem) { GroupedDeviceItems.CommitEdit(); } if (GroupedDeviceItems.IsAddingNew) { GroupedDeviceItems.CommitNew(); } GroupedDeviceItems.Refresh(); if (mainWindow.DeviceItemsListDg.HasItems) { mainWindow.DeviceItemsListDg.SelectedItem = mainWindow.DeviceItemsListDg.Items[(index > -1) ? index : 0]; if (mainWindow.DeviceItemsListDg.SelectedItem != null) { DeviceItem temp = mainWindow.DeviceItemsListDg.SelectedItem as DeviceItem; mainWindow.canvasControlService.ReloadListOrderItems(temp); } } } } catch { Console.WriteLine("Error in ReloadListDeviceItems"); } }