/// <summary> /// Loads collection of <see cref="Device"/> information stored in the database. /// </summary> /// <remarks>This method is overridden because MethodInfo.Invoke in the base class did not like optional parameters.</remarks> public override void Load() { Mouse.OverrideCursor = Cursors.Wait; List <int> pageKeys; try { if (OnBeforeLoadCanceled()) { throw new OperationCanceledException("Load was canceled."); } if ((object)ItemsKeys == null) { ItemsKeys = Device.LoadKeys(null, 0, m_searchText, SortMember, SortDirection); if ((object)SortSelector != null) { if (SortDirection == "ASC") { ItemsKeys = ItemsKeys.OrderBy(SortSelector).ToList(); } else { ItemsKeys = ItemsKeys.OrderByDescending(SortSelector).ToList(); } } if (string.IsNullOrEmpty(m_searchText)) { AllKeys = ItemsKeys; } } pageKeys = ItemsKeys.Skip((CurrentPageNumber - 1) * ItemsPerPage).Take(ItemsPerPage).ToList(); ItemsSource = Device.Load(null, pageKeys); OnLoaded(); } catch (Exception ex) { if ((object)ex.InnerException != null) { Popup(ex.Message + Environment.NewLine + "Inner Exception: " + ex.InnerException.Message, "Load Devices Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load Devices", ex.InnerException); } else { Popup(ex.Message, "Load Devices Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load Devices", ex); } } finally { Mouse.OverrideCursor = null; } }
/// <summary> /// Load output stream device phasors. /// </summary> public override void Load() { Mouse.OverrideCursor = Cursors.Wait; List <int> pageKeys = null; try { if (OnBeforeLoadCanceled()) { throw new OperationCanceledException("Load was canceled."); } // Load keys if LoadKeys method exists in data model if ((object)ItemsKeys == null) { ItemsKeys = OutputStreamDevicePhasor.LoadKeys(null, m_outputStreamDeviceID, SortMember, SortDirection); if ((object)SortSelector != null) { if (SortDirection == "ASC") { ItemsKeys = ItemsKeys.OrderBy(SortSelector).ToList(); } else { ItemsKeys = ItemsKeys.OrderByDescending(SortSelector).ToList(); } } } // Extract a single page of keys pageKeys = ItemsKeys.Skip((CurrentPageNumber - 1) * ItemsPerPage).Take(ItemsPerPage).ToList(); // If we were able to extract a page of keys, load only that page. // Otherwise, load the whole recordset. ItemsSource = OutputStreamDevicePhasor.Load(null, pageKeys); OnLoaded(); } catch (Exception ex) { if (ex.InnerException != null) { Popup(ex.Message + Environment.NewLine + "Inner Exception: " + ex.InnerException.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex.InnerException); } else { Popup(ex.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex); } } finally { Mouse.OverrideCursor = null; } }
/// <summary> /// Loads collection of <see cref="GSF.TimeSeries.UI.DataModels.Measurement"/> defined in the database. /// </summary> public override void Load() { List <Guid> pageKeys; try { if (!m_searching) { Mouse.OverrideCursor = Cursors.Wait; } if ((object)ItemsKeys == null) { ItemsKeys = DataModels.Measurement.LoadSignalIDs(null, FilterExpression, SortMember, SortDirection); if ((object)SortSelector != null) { if (SortDirection == "ASC") { ItemsKeys = ItemsKeys.OrderBy(SortSelector).ToList(); } else { ItemsKeys = ItemsKeys.OrderByDescending(SortSelector).ToList(); } } AllKeys = ItemsKeys; } pageKeys = ItemsKeys.Skip((CurrentPageNumber - 1) * ItemsPerPage).Take(ItemsPerPage).ToList(); ItemsSource = DataModels.Measurement.LoadFromKeys(null, pageKeys); } catch (Exception ex) { if (ex.InnerException != null) { Popup(ex.Message + Environment.NewLine + "Inner Exception: " + ex.InnerException.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex.InnerException); } else { Popup(ex.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex); } } finally { if (!m_searching) { Mouse.OverrideCursor = null; } } }
/// <summary> /// Load output stream device phasors. /// </summary> public override void Load() { Mouse.OverrideCursor = Cursors.Wait; List <int> pageKeys = null; try { if (OnBeforeLoadCanceled()) { throw new OperationCanceledException("Load was canceled."); } if ((object)ItemsKeys == null) { ItemsKeys = OutputStreamDeviceDigital.LoadKeys(null, m_outputStreamDeviceID, SortMember, SortDirection); if ((object)SortSelector != null) { if (SortDirection == "ASC") { ItemsKeys = ItemsKeys.OrderBy(SortSelector).ToList(); } else { ItemsKeys = ItemsKeys.OrderByDescending(SortSelector).ToList(); } } } pageKeys = ItemsKeys.Skip((CurrentPageNumber - 1) * ItemsPerPage).Take(ItemsPerPage).ToList(); ItemsSource = OutputStreamDeviceDigital.Load(null, pageKeys); CurrentItem.OutputStreamDeviceID = m_outputStreamDeviceID; OnLoaded(); } catch (Exception ex) { if (ex.InnerException != null) { Popup(ex.Message + Environment.NewLine + "Inner Exception: " + ex.InnerException.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex.InnerException); } else { Popup(ex.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex); } } finally { Mouse.OverrideCursor = null; } }
/// <summary> /// Loads collection of <see cref="PowerCalculation"/> information stored in the database. /// </summary> /// <remarks>This method is overridden because MethodInfo.Invoke in the base class did not like optional parameters.</remarks> public override void Load() { Mouse.OverrideCursor = Cursors.Wait; try { if (OnBeforeLoadCanceled()) { throw new OperationCanceledException("Load was canceled."); } if (ItemsKeys == null || m_filterChanged) { ItemsKeys = Phasor.LoadKeys(null, PhasorTypeFilter); m_filterChanged = false; if ((object)SortSelector != null) { if (SortDirection == "ASC") { ItemsKeys = ItemsKeys.OrderBy(SortSelector).ToList(); } else { ItemsKeys = ItemsKeys.OrderByDescending(SortSelector).ToList(); } } } var pageKeys = ItemsKeys.Skip((CurrentPageNumber - 1) * ItemsPerPage).Take(ItemsPerPage).ToList(); ItemsSource = Phasor.Load(null, pageKeys); OnLoaded(); } catch (Exception ex) { if (ex.InnerException != null) { Popup(ex.Message + Environment.NewLine + "Inner Exception: " + ex.InnerException.Message, "Load Phasors Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load Phasors", ex.InnerException); } else { Popup(ex.Message, "Load Phasors Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load Phasors", ex); } } finally { Mouse.OverrideCursor = null; } }
/// <summary> /// Loads collection of <see cref="Adapter"/> defined in the database. /// </summary> public override void Load() { Mouse.OverrideCursor = Cursors.Wait; List <int> pageKeys; try { if ((object)ItemsKeys == null) { ItemsKeys = Adapter.LoadIDs(null, m_adapterType, SortMember, SortDirection); if ((object)SortSelector != null) { if (SortDirection == "ASC") { ItemsKeys = ItemsKeys.OrderBy(SortSelector).ToList(); } else { ItemsKeys = ItemsKeys.OrderByDescending(SortSelector).ToList(); } } } pageKeys = ItemsKeys.Skip((CurrentPageNumber - 1) * ItemsPerPage).Take(ItemsPerPage).ToList(); ItemsSource = Adapter.Load(null, m_adapterType, pageKeys); CurrentItem.Type = m_adapterType; } catch (Exception ex) { if (ex.InnerException != null) { Popup(ex.Message + Environment.NewLine + "Inner Exception: " + ex.InnerException.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex.InnerException); } else { Popup(ex.Message, "Load " + DataModelName + " Exception:", MessageBoxImage.Error); CommonFunctions.LogException(null, "Load " + DataModelName, ex); } } finally { Mouse.OverrideCursor = null; } }