コード例 #1
0
        /// <summary>
        ///  Provides functionality for the widget to be configured by the end user through a dialog.
        /// </summary>
        /// <param name="owner">The application window which should be the owner of the dialog.</param>
        /// <param name="dataSources">The complete list of DataSources in the configuration.</param>
        /// <returns>True if the user clicks ok, otherwise false.</returns>
        public bool Configure(Window owner, IList <OD.DataSource> dataSources)
        {
            AlertViewModel vm = DataGridViewModel as AlertViewModel;

            if (vm == null)
            {
                return(false);
            }

            try
            {
                vm.SkipUpdates = true;

                // Show the configuration dialog
                AlertWidgetDialog dialog = new AlertWidgetDialog
                                               (dataSources, Caption, DataSourceId, TrackIdFieldName,
                                               GroupByFieldName, SortByFieldName1, SortByFieldName2,
                                               SortByFieldOrder1, SortByFieldOrder2,
                                               vm.Properties)
                {
                    Owner = owner
                };

                if (dialog.ShowDialog() != true)
                {
                    DataGridViewModel.SkipUpdates = false;
                    return(false);
                }

                // Retrieve the selected values for the properties from the configuration dialog.
                Caption           = dialog.Caption;
                DataSourceId      = dialog.DataSource.Id;
                TrackIdFieldName  = dialog.TrackIdField.Name;
                GroupByFieldName  = dialog.GroupByField.Name;
                SortByFieldName1  = dialog.SortByField1.Name;
                SortByFieldName2  = dialog.SortByField2.Name;
                SortByFieldOrder1 = dialog.SortByFieldOrder1;
                SortByFieldOrder2 = dialog.SortByFieldOrder2;

                vm.TrackIdFieldName  = TrackIdFieldName;
                vm.GroupByFieldName  = GroupByFieldName;
                vm.SortByFieldName1  = SortByFieldName1;
                vm.SortByFieldName2  = SortByFieldName2;
                vm.SortByFieldOrder1 = SortByFieldOrder1;
                vm.SortByFieldOrder2 = SortByFieldOrder2;

                vm.GetProperties(Properties);

                vm.ApplySettings();
            }
            catch (Exception ex)
            {
                Log.TraceException("ResourceWidget::Configure", ex);
            }

            vm.SkipUpdates = false;
            return(true);
        }
コード例 #2
0
        /// <summary>
        ///  Provides functionality for the widget to be configured by the end user through a dialog.
        /// </summary>
        /// <param name="owner">The application window which should be the owner of the dialog.</param>
        /// <param name="dataSources">The complete list of DataSources in the configuration.</param>
        /// <returns>True if the user clicks ok, otherwise false.</returns>
        public bool Configure(Window owner, IList<OD.DataSource> dataSources)
        {
            AlertViewModel vm = DataGridViewModel as AlertViewModel;
              if (vm == null)
            return false;

              try
              {
            vm.SkipUpdates = true;

            // Show the configuration dialog
            AlertWidgetDialog dialog = new AlertWidgetDialog
              ( dataSources, Caption, DataSourceId, TrackIdFieldName,
            GroupByFieldName, SortByFieldName1, SortByFieldName2,
            SortByFieldOrder1, SortByFieldOrder2,
            vm.Properties ) { Owner = owner };

            if (dialog.ShowDialog() != true)
            {
              DataGridViewModel.SkipUpdates = false;
              return false;
            }

            // Retrieve the selected values for the properties from the configuration dialog.
            Caption           = dialog.Caption;
            DataSourceId      = dialog.DataSource.Id;
            TrackIdFieldName  = dialog.TrackIdField.Name;
            GroupByFieldName  = dialog.GroupByField.Name;
            SortByFieldName1  = dialog.SortByField1.Name;
            SortByFieldName2  = dialog.SortByField2.Name;
            SortByFieldOrder1 = dialog.SortByFieldOrder1;
            SortByFieldOrder2 = dialog.SortByFieldOrder2;

            vm.TrackIdFieldName  = TrackIdFieldName;
            vm.GroupByFieldName  = GroupByFieldName;
            vm.SortByFieldName1  = SortByFieldName1;
            vm.SortByFieldName2  = SortByFieldName2;
            vm.SortByFieldOrder1 = SortByFieldOrder1;
            vm.SortByFieldOrder2 = SortByFieldOrder2;

            vm.GetProperties(Properties);

            vm.ApplySettings();
              }
              catch (Exception ex)
              {
            Log.TraceException("ResourceWidget::Configure", ex);
              }

              vm.SkipUpdates = false;
              return true;
        }