public EarthquakeWidgetDialog(IEnumerable<MapWidget> mapWidgets, EarthquakeWidget initialWidget)
        {
            InitializeComponent();

             CaptionTextBox.Text = initialWidget.Caption;

             // 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);
             MapWidgetCombo.ItemsSource = mapws;

             // Disable the combo box if no map widgets found.
             if (mapws.Count() < 1)
             {
            MapWidgetCombo.IsEnabled = false;
             }
             else
             {
            MapWidgetCombo.ItemsSource = mapWidgets;
            foreach (MapWidget mw in mapWidgets)
            {

               // If the initial settings match one of the found widgets, select that map widget in the combo box.
               if (mw.Id == initialWidget.MapWidgetId)
               {
                  MapWidgetCombo.SelectedItem = mw;
               }
            }
            if (MapWidgetCombo.SelectedItem == null)
               MapWidgetCombo.SelectedItem = MapWidgetCombo.Items[0];
             }
        }
Example #2
0
        public EarthquakeWidgetDialog(IEnumerable <MapWidget> mapWidgets, EarthquakeWidget initialWidget)
        {
            InitializeComponent();

            CaptionTextBox.Text = initialWidget.Caption;

            // 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);

            MapWidgetCombo.ItemsSource = mapws;

            // Disable the combo box if no map widgets found.
            if (mapws.Count() < 1)
            {
                MapWidgetCombo.IsEnabled = false;
            }
            else
            {
                MapWidgetCombo.ItemsSource = mapWidgets;
                foreach (MapWidget mw in mapWidgets)
                {
                    // If the initial settings match one of the found widgets, select that map widget in the combo box.
                    if (mw.Id == initialWidget.MapWidgetId)
                    {
                        MapWidgetCombo.SelectedItem = mw;
                    }
                }
                if (MapWidgetCombo.SelectedItem == null)
                {
                    MapWidgetCombo.SelectedItem = MapWidgetCombo.Items[0];
                }
            }
        }