예제 #1
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            DataSource = BufferLayer_DataSourceSelector.SelectedDataSource;
            Field      = (ESRI.ArcGIS.Client.Field)FieldComboBox.SelectedItem;

            DialogResult = true;
        }
        // Field - TODO
        internal static Dictionary <string, object> ToDictionary(this ESRI.ArcGIS.Client.Field field)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(field.Name))
            {
                dictionary.Add("name", field.Name);
            }

            // CHECK TOSTRING VALUES
            dictionary.Add("type", "esriFieldType" + field.Type.ToString());

            if (!string.IsNullOrEmpty(field.Alias))
            {
                dictionary.Add("alias", field.Alias);
            }
            if (field.Domain != null)
            {
                dictionary.Add("domain", field.Domain.ToDictionary());
            }

            dictionary.Add("length", field.Length);
            dictionary.Add("editable", field.Editable);
            dictionary.Add("nullable", field.Nullable);

            return(dictionary as Dictionary <string, object>);
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            DataSource = DataSourceSelector.SelectedDataSource;
            Caption = CaptionTextBox.Text;
            Field = (ESRI.ArcGIS.Client.Field)FieldComboBox.SelectedItem;

            DialogResult = true;
        }
예제 #4
0
        public AlertWidgetDialog(IList <DataSource> dataSources, string caption,
                                 string dataSourceId,
                                 string trackIdFieldName, string groupByFieldName,
                                 string sortByFieldName1, string sortByFieldName2,
                                 ListSortDirection sortByFieldOrder1, ListSortDirection sortByFieldOrder2,
                                 Dictionary <string, string> vmProperties)
        {
            this.Resources.MergedDictionaries.Add(AddInsShare.Resources.SharedDictionaryManager.SharedStyleDictionary);

            InitializeComponent();

            // When re-configuring, initialize the widget config dialog from the existing settings.
            _vmProperties = vmProperties;

            // Caption
            CaptionTextBox.Text = caption;

            // data source selector
            if (!string.IsNullOrEmpty(dataSourceId))
            {
                DataSource dataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == dataSourceId);
                if (dataSource != null)
                {
                    DataSourceSelector.SelectedDataSource = dataSource;
                    if (!string.IsNullOrEmpty(trackIdFieldName))
                    {
                        // Track Id Field Combo Box
                        client.Field field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == trackIdFieldName);
                        TrackIdFieldComboBox.SelectedItem = field;

                        // Group By Field Combo Box
                        field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == groupByFieldName);
                        GroupByFieldComboBox.SelectedItem = field;

                        // Group By Field Combo Box
                        field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == groupByFieldName);
                        GroupByFieldComboBox.SelectedItem = field;

                        // Sort By Field 1 Combo Box
                        field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == sortByFieldName1);
                        SortByField1ComboBox.SelectedItem = field;

                        // Sort By Field 2 Combo Box
                        field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == sortByFieldName2);
                        SortByField2ComboBox.SelectedItem = field;
                    }
                }
            }

            // Sort By Field Order Combo Boxes
            SortByFieldOrder1ComboBox.SelectedIndex = (sortByFieldOrder1 == ListSortDirection.Ascending ? 0 : 1);
            SortByFieldOrder2ComboBox.SelectedIndex = (sortByFieldOrder2 == ListSortDirection.Ascending ? 0 : 1);

            // Properties
            GepHostNameTextBox.Text  = vmProperties["GepHostName"];
            GepHttpPortTextBox.Text  = vmProperties["GepHttpPort"];
            GepHttpsPortTextBox.Text = vmProperties["GepHttpsPort"];
        }
        public RangeFanWidgetDialog(IList <DataSource> dataSources, string initialCaption, string initialDataSourceId, string initialField, IEnumerable <IFeatureAction> selectedFeatureActions, string currentMapWidgetId)
        {
            InitializeComponent();
            // When re-configuring, initialize the widget config dialog from the existing settings.
            CaptionTextBox.Text = initialCaption;
            if (!string.IsNullOrEmpty(initialDataSourceId))
            {
                DataSource dataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == initialDataSourceId);
                if (dataSource != null)
                {
                    DataSourceSelector.SelectedDataSource = dataSource;
                    if (!string.IsNullOrEmpty(initialField))
                    {
                        client.Field field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == initialField);
                        FieldComboBox.SelectedItem = field;
                    }
                }
            }
            //Initialize the DataSourceSelector and the filed combo box
            InitializeDataSource(initialDataSourceId, initialField);

            //Initialize the FeatureActionsList with the feature actions
            InitializeFeatureActions(selectedFeatureActions);

            // Retrieve a list of all map widgets from the application and bind this to a combo box
            // for the user to select a map from.
            IEnumerable <ESRI.ArcGIS.OperationsDashboard.IWidget> mapws = OperationsDashboard.Instance.Widgets.Where(w => w is MapWidget);

            MapWidgetComboBox.ItemsSource = mapws;

            // Disable the combo box if no map widgets found.
            if (mapws.Count() < 1)
            {
                MapWidgetComboBox.IsEnabled = false;
            }
            else
            {
                // If an existing MapWidgetId is already set, select this in the list. If not set, then select the first in the list.
                MapWidget currentWidget = OperationsDashboard.Instance.Widgets.FirstOrDefault(widget => widget.Id == currentMapWidgetId) as MapWidget;
                if (currentWidget == null)
                {
                    MapWidgetComboBox.SelectedItem = mapws.First();
                }
                else
                {
                    MapWidgetComboBox.SelectedItem = currentWidget;
                }
            }

            ValidateInput();
        }
예제 #6
0
        public TableWidgetDialog(IList <DataSource> dataSources, string caption,
                                 string dataSourceId,
                                 string trackIdFieldName, string groupByFieldName,
                                 string sortByFieldName1, string sortByFieldName2,
                                 ListSortDirection sortByFieldOrder1, ListSortDirection sortByFieldOrder2)
        {
            this.Resources.MergedDictionaries.Add(AddInsShare.Resources.SharedDictionaryManager.SharedStyleDictionary);

            InitializeComponent();

            // Caption
            CaptionTextBox.Text = caption;

            // data source selector
            if (!string.IsNullOrEmpty(dataSourceId))
            {
                DataSource dataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == dataSourceId);
                if (dataSource != null)
                {
                    DataSourceSelector.SelectedDataSource = dataSource;
                    if (!string.IsNullOrEmpty(trackIdFieldName))
                    {
                        // Track Id Field Combo Box
                        client.Field field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == trackIdFieldName);
                        TrackIdFieldComboBox.SelectedItem = field;

                        // Group By Field Combo Box
                        field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == groupByFieldName);
                        GroupByFieldComboBox.SelectedItem = field;

                        // Group By Field Combo Box
                        field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == groupByFieldName);
                        GroupByFieldComboBox.SelectedItem = field;

                        // Sort By Field 1 Combo Box
                        field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == sortByFieldName1);
                        SortByField1ComboBox.SelectedItem = field;

                        // Sort By Field 2 Combo Box
                        field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == sortByFieldName2);
                        SortByField2ComboBox.SelectedItem = field;
                    }
                }
            }

            // Sort By Field Order Combo Boxes
            SortByFieldOrder1ComboBox.SelectedIndex = (sortByFieldOrder1 == ListSortDirection.Ascending ? 0 : 1);
            SortByFieldOrder2ComboBox.SelectedIndex = (sortByFieldOrder2 == ListSortDirection.Ascending ? 0 : 1);
        }
 // ***********************************************************************************
 // * Initialize Resources/Facilities DataSource Layer
 // ***********************************************************************************
 private void InitializeDataSource(string initialDataSourceId, string initialField)
 {
     if (!string.IsNullOrEmpty(initialDataSourceId))
     {
         DataSource dataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == initialDataSourceId);
         if (dataSource != null)
         {
             ResourceLayer_DataSourceSelector.SelectedDataSource = dataSource;
             if (!string.IsNullOrEmpty(initialField))
             {
                 client.Field field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == initialField);
                 FieldComboBox.SelectedItem = field;
             }
         }
     }
 }
        public ProfileGraphFromMapDialog(IList <DataSource> dataSources, string initialCaption, string initialDataSourceId, string initialField)
        {
            InitializeComponent();

            // When re-configuring, initialize the widget config dialog from the existing settings.
            CaptionTextBox.Text = initialCaption;
            if (!string.IsNullOrEmpty(initialDataSourceId))
            {
                DataSource dataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == initialDataSourceId);
                if (dataSource != null)
                {
                    DataSourceSelector.SelectedDataSource = dataSource;
                    if (!string.IsNullOrEmpty(initialField))
                    {
                        client.Field field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == initialField);
                        FieldComboBox.SelectedItem = field;
                    }
                }
            }
        }
예제 #9
0
        //Determine if a field can be listed in the combobox as a valid field
        private bool IsValidField(client.Field field)
        {
            if (field.Type == client.Field.FieldType.Double ||
                field.Type == client.Field.FieldType.Integer ||
                field.Type == client.Field.FieldType.Single ||
                field.Type == client.Field.FieldType.SmallInteger)
            {
                if (field.Domain != null && field.Domain.GetType() == typeof(CodedValueDomain))
                {
                    return(false);
                }

                //The code here doesn't take subtype field into account.
                //Developers should add the logic to filter out subtype fields

                return(true);
            }

            return(false);
        }
예제 #10
0
        private void setUpQueryFields(DataSource dataSource)
        {
            //wind direction
            client.Field windDirField = dataSource.Fields.FirstOrDefault(fld => fld.Name == WindDirectionFieldName);
            WindDirectionFieldList.ItemsSource = dataSource.Fields;

            if (windDirField != null)
            {
                WindDirectionFieldList.SelectedItem = windDirField;
            }
            else
            {
                WindDirectionFieldList.SelectedItem = dataSource.Fields[1];
            }

            //station name
            client.Field windStationFld = dataSource.Fields.FirstOrDefault(fld => fld.Name == WindStationNameFieldName);
            stationFieldList.ItemsSource = dataSource.Fields;

            if (windStationFld != null)
            {
                stationFieldList.SelectedItem = windStationFld;
            }
            else
            {
                stationFieldList.SelectedItem = dataSource.Fields[1];
            }

            //Recorded Date Field
            client.Field recordedDateFld = dataSource.Fields.FirstOrDefault(fld => fld.Name == WindDateFieldName);
            dateFieldList.ItemsSource = dataSource.Fields;

            if (recordedDateFld != null)
            {
                dateFieldList.SelectedItem = recordedDateFld;
            }
            else
            {
                dateFieldList.SelectedItem = dataSource.Fields[1];
            }
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            // Populate the data members from the widget config dialog

            Caption              = CaptionTextBox.Text;
            StopDataSource       = StopDataSourceSelector.SelectedDataSource as DataSource;
            RouteDataSource      = RouteDataSourceSelector.SelectedDataSource as DataSource;
            TrackIdField         = (client.Field)TrackIdFieldComboBox.SelectedItem;
            GroupByField         = (client.Field)GroupByFieldComboBox.SelectedItem;
            SortByField1         = (client.Field)SortByField1ComboBox.SelectedItem;
            SortByField2         = (client.Field)SortByField2ComboBox.SelectedItem;
            SortByFieldOrder1    = (ListSortDirection)SortByFieldOrder1ComboBox.SelectedItem;
            SortByFieldOrder2    = (ListSortDirection)SortByFieldOrder2ComboBox.SelectedItem;
            StopsRouteNameField  = (client.Field)StopsRouteNameComboBox.SelectedItem;
            RoutesRouteNameField = (client.Field)RoutesRouteNameComboBox.SelectedItem;

            _vmProperties["GepHostName"]  = GepHostNameTextBox.Text;
            _vmProperties["GepHttpPort"]  = GepHttpPortTextBox.Text;
            _vmProperties["GepHttpsPort"] = GepHttpsPortTextBox.Text;

            DialogResult = true;
        }
예제 #12
0
        public StatisticsSummaryDialog(
            string initialCaption,
            string initialDataSourceId,
            string initialField,
            List <Statistic> statistics,
            string leadingText,
            string trailingText)
        {
            InitializeComponent();

            // When re-configuring, initialize the widget config dialog from the existing settings.
            txtTitle.Text = initialCaption;
            if (!string.IsNullOrEmpty(initialDataSourceId))
            {
                DataSource dataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == initialDataSourceId);
                if (dataSource != null)
                {
                    DataSourceSelector.SelectedDataSource = dataSource;

                    if (!string.IsNullOrEmpty(initialField))
                    {
                        client.Field field = dataSource.Fields.FirstOrDefault(fld => fld.FieldName == initialField);
                        FieldComboBox.SelectedItem = field;
                    }
                }
            }

            //Instantized SelectedStatistics or set it with the exsting statistics
            SelectedStatistics = statistics == null ? new List <Statistic>() : statistics;
            ShowMax            = SelectedStatistics.Contains(Statistic.Max);
            ShowAvg            = SelectedStatistics.Contains(Statistic.Average);
            ShowMin            = SelectedStatistics.Contains(Statistic.Min);
            ShowSum            = SelectedStatistics.Contains(Statistic.Sum);

            LeadingText  = leadingText;
            TrailingText = trailingText;

            DataContext = this;
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            Caption           = CaptionTextBox.Text;
              DataSource        = DataSourceSelector.SelectedDataSource as DataSource;
              TrackIdField      = (client.Field)TrackIdFieldComboBox.SelectedItem;
              GroupByField      = (client.Field)GroupByFieldComboBox.SelectedItem;
              SortByField1      = (client.Field)SortByField1ComboBox.SelectedItem;
              SortByField2      = (client.Field)SortByField2ComboBox.SelectedItem;
              SortByFieldOrder1 = (ListSortDirection)SortByFieldOrder1ComboBox.SelectedItem;
              SortByFieldOrder2 = (ListSortDirection)SortByFieldOrder2ComboBox.SelectedItem;

              _vmProperties["GepHostName"]  = GepHostNameTextBox.Text;
              _vmProperties["GepHttpPort"]  = GepHttpPortTextBox.Text;
              _vmProperties["GepHttpsPort"] = GepHttpsPortTextBox.Text;

              DialogResult = true;
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            DataSource = BufferLayer_DataSourceSelector.SelectedDataSource;
            Field = (ESRI.ArcGIS.Client.Field)FieldComboBox.SelectedItem;

            DialogResult = true;
        }