public CensusReportFeatureAction()
    {
      if (OperationsDashboard.Instance == null)
        return;

      SelectedDataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == DataSourceId);
    }
        /// <summary>
        /// Execute is called when the user chooses the feature action from the feature actions context menu. Only called if
        /// CanExecute returned true.
        /// </summary>
        public async void Execute(ESRI.ArcGIS.OperationsDashboard.DataSource dataSource, client.Graphic feature)
        {
            //This feature action relies on a profile graph widget to create a graph based on the profile line
            //Check if the view has a ProfileGraphWidget widget to display the output graph
            ProfileGraphFromMap profileWidget = OperationsDashboard.Instance.Widgets.FirstOrDefault(w => w.GetType() == typeof(ProfileGraphFromMap)) as ProfileGraphFromMap;

            if (profileWidget == null)
            {
                MessageBox.Show("Add the Profile Graph Widget to the view to execute this feature action", "Profile Graph Widget Required");
                return;
            }

            //Send the feature to the Elevation Analysis service to get the profile line
            ProfileService service = new ProfileService();

            Profile = await service.GetProfileLine(feature.Geometry);

            if (Profile == null)
            {
                MessageBox.Show("Failed to get elevation profile");
                return;
            }

            //Send the result (Profile) to the profile graph widget and ask it to generate the graph
            profileWidget.MapWidget = MapWidget.FindMapWidget(dataSource);
            profileWidget.Profile   = Profile;
            profileWidget.UpdateControls();
        }
コード例 #3
0
        /// <summary>
        /// Determines if the feature action can be executed based on the specified data source and feature, before the option to execute
        /// the feature action is displayed to the user.
        /// </summary>
        /// <param name="dataSource">The data source which will be subsequently passed to the Execute method if CanExecute returns true.</param>
        /// <param name="feature">The data source which will be subsequently passed to the Execute method if CanExecute returns true.</param>
        /// <returns>True if the feature action should be enabled, otherwise false.</returns>
        public bool CanExecute(ESRI.ArcGIS.OperationsDashboard.DataSource dataSource, client.Graphic feature)
        {
            // Check if the data source and feature can be used with this feature action.

            // For example, identify if a MapWidget is ultimately providing the data source, and enable the feature action if that
            // MapWidget also has its Show Popups setting enabled.
            return(true);
        }
        public CensusReportFeatureAction()
        {
            if (OperationsDashboard.Instance == null)
            {
                return;
            }

            SelectedDataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == DataSourceId);
        }
コード例 #5
0
 /// <summary>
 /// Called when a DataSource is removed from the configuration.
 /// </summary>
 /// <param name="dataSource">The DataSource being removed.</param>
 public void OnRemove(OD.DataSource dataSource)
 {
     // Respond to data source being removed. The application framework will automatically show the widget as disabled
     // if it's currently configured data source is removed.
     if (dataSource.Id == DataSourceId)
     {
         DataSourceId = null;
     }
 }
コード例 #6
0
 /// <summary>
 /// Called when a DataSource is updated. Test the DataSource.Id to respond to the DataSource of interest.
 /// </summary>
 /// <param name="dataSource">The DataSource being updated.</param>
 public void OnRefresh(OD.DataSource dataSource)
 {
     if (dataSource.Id == DataSourceId)
     {
         // if required, respond to the update from the selected data source. consider using an async method.
         SetDataSource(dataSource);
         PopulateGrid();
     }
 }
 /// <summary>
 /// Called when a DataSource found in the DataSourceIds property is updated.
 /// </summary>
 /// <param name="dataSource">The DataSource being updated.</param>
 public void OnRefresh(DataSource ds)
 {
     dataSource = ds;
     //If a new instance of this view is opened....pass the items from the original view to the new view
     // otherwise do a standard query to the data
     if (!syncViews())
     {
         getData(dataSource);
     }
 }
コード例 #8
0
 public void SetRouteDataSource(DataSource routeDataSource)
 {
     if (_routeDataSource != routeDataSource)
     {
         StopViewModel vm = DataGridViewModel as StopViewModel;
         vm.SetRouteDataSource(routeDataSource);
         vm.RoutesRouteNameFieldName = RoutesRouteNameFieldName;
         _routeDataSource            = routeDataSource;
     }
 }
コード例 #9
0
        //this method is called for data source configured for the widget
        public async void OnRefresh(ESRI.ArcGIS.OperationsDashboard.DataSource dataSource)
        {
            if (!String.IsNullOrEmpty(DataSourceId))
            {
                DataSource = dataSource;
                FeatureActionContextMenu.DataSource = DataSource;

                setUpFeatureGrid();
            }
            await PopulateDataGridAsync();
        }
コード例 #10
0
        async public void Update(OD.DataSource dataSource)
        {
            if (dataSource == null)
            {
                return;
            }
            if (SkipUpdates)
            {
                return;
            }
            if (InEditMode)
            {
                return;
            }

            // Execute an async query
            OD.Query query = new OD.Query()
            {
                SortField      = SortByFieldName1,
                SortOrder      = ESRI.ArcGIS.Client.Tasks.SortOrder.Ascending,
                ReturnGeometry = true
            };
            OD.QueryResult queryResult = await dataSource.ExecuteQueryAsync(query);

            if (queryResult.Canceled || queryResult.Features == null)
            {
                Items.Clear();
                return;
            }

            //hk - RESEARCH THIS APPROACH

            /*
             * List<ListItem> items = new List<ListItem>();
             * int i = 0;
             * foreach (var result in queryResult.Features)
             * {
             * items.Add(new ListItem(this, result, dataSource));
             * if (++i == ListWidget.MaxCount)
             *  break;
             * }
             */

            try
            {
                SetDataSource(dataSource);
                Update(queryResult.Features);
            }
            catch (Exception ex)
            {
                Log.TraceException("Updating " + dataSource.Name, ex);
            }
        }
コード例 #11
0
 private void SetDataSource(DataSource dataSource)
 {
     if (_dataSource != dataSource)
     {
         AlertViewModel vm = DataGridViewModel as AlertViewModel;
         vm.TrackIdFieldName = TrackIdFieldName;
         vm.GroupByFieldName = GroupByFieldName;
         vm.SortByFieldName1 = SortByFieldName1;
         vm.SortByFieldName2 = SortByFieldName2;
         vm.SetDataSource(dataSource);
         _dataSource = dataSource;
     }
 }
コード例 #12
0
        public GeoFenceViewModel(OD.DataSource dataSource)
            : base(dataSource)
        {
            // init the data members with default values
            TrackIdFieldName  = "GeoFenceId";
            NameFieldName     = "Name";
            CategoryFieldName = "Category";
            ActiveFieldName   = "Active";
            Properties["GeometryServiceUrl"]    = @"http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer";
            Properties["ServiceAreaServiceUrl"] = @"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Service%20Area";

            // init the commands
            ToggleActiveCommand = new DelegatingCommand(OnToggleActive);
        }
コード例 #13
0
 private void SetStopDataSource(DataSource stopDataSource)
 {
     if (_stopDataSource != stopDataSource)
     {
         StopViewModel vm = DataGridViewModel as StopViewModel;
         vm.SetDataSource(stopDataSource);
         vm.TrackIdFieldName        = TrackIdFieldName;
         vm.GroupByFieldName        = GroupByFieldName;
         vm.SortByFieldName1        = SortByFieldName1;
         vm.SortByFieldName2        = SortByFieldName2;
         vm.StopsRouteNameFieldName = StopsRouteNameFieldName;
         _stopDataSource            = stopDataSource;
     }
 }
        /// <summary>
        /// This function creates the buffer area from user's selected feature
        /// </summary>
        public void Execute(ESRI.ArcGIS.OperationsDashboard.DataSource BufferDS, client.Graphic BufferFeature)
        {
            //Clear any running task
            _geometryTask.CancelAsync();

            //Get the map that contains the feature used to generate the buffer
            client.Map mwMap = mapWidget.Map;

            //Define the params to pass to the buffer operation
            client.Tasks.BufferParameters bufferParameters = CreateBufferParameters(BufferFeature, mwMap);

            //Execute the GP tool
            _geometryTask.BufferAsync(bufferParameters);
        }
コード例 #15
0
        /// <summary>
        /// Initialize the available feature actions using thre previously persisted feature actions
        /// </summary>
        private void InitializeFeatureActions()
        {
            FeatureActions = null;
            if (PersistedFeatureActions == null)
            {
                return;
            }

            List <IFeatureAction> featureActions = new List <IFeatureAction>();

            foreach (var persistedFeatureAction in PersistedFeatureActions)
            {
                switch (persistedFeatureAction)
                {
                case FeatureActionType.Highlight:
                    featureActions.Add(new HighlightFeatureAction()
                    {
                        UpdateExtent = HighlightUpdateType
                    });
                    break;

                case FeatureActionType.PanTo:
                    featureActions.Add(new PanToFeatureAction());
                    break;

                case FeatureActionType.ZoomTo:
                    featureActions.Add(new ZoomToFeatureAction());
                    break;

                case FeatureActionType.SearchNearby:
                {
                    ESRI.ArcGIS.OperationsDashboard.DataSource TargetDataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == TargetDataSourceId);
                    if (TargetDataSource != null)
                    {
                        featureActions.Add(new SearchNearbyFeatureAction(TargetDataSource, BufferDistance, BufferUnit));
                    }
                    else
                    {
                        featureActions.Add(new SearchNearbyFeatureAction(null, BufferDistance, BufferUnit));
                    }
                    break;
                }

                default:
                    throw new NotImplementedException(string.Format("Cannot create feature action of type: {0}", persistedFeatureAction.ToString()));
                }
            }
            FeatureActions = featureActions;
        }
コード例 #16
0
        public BufferMapToolBar(MapWidget mapWidget, String bufferDataSource, String bufferField)
        {
            InitializeComponent();
            this.DataContext = this;

            // Store a reference to the MapWidget that the toolbar has been installed to.
            _mapWidget = mapWidget;


            // The following parameters are used when user selecting features from a layer.
            // DataSource and Field names need to be specified in the tool settings.
            BufferLayers = new ObservableCollection <BufferLayer>();
            var selectLyr = new BufferLayer();


            if (bufferDataSource == null)
            {
                selectLyr.Name       = "Use Settings for buffer layer";
                selectLyr.DataSource = null;
                BufferLayers.Add(selectLyr);
            }
            else
            {
                _bufferDataSource = bufferDataSource;
                _bufferField      = bufferField;

                selectLyr.Name       = "Select a layer";
                selectLyr.DataSource = null;
                BufferLayers.Add(selectLyr);

                ESRI.ArcGIS.OperationsDashboard.DataSource layerDataSource = null;

                IEnumerable <ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources = OperationsDashboard.Instance.DataSources;
                foreach (ESRI.ArcGIS.OperationsDashboard.DataSource d in dataSources)
                {
                    if (d.Id == _bufferDataSource)
                    {
                        layerDataSource = d;
                        break;
                    }
                }

                BufferTypes = new ObservableCollection <BufferType>();
                var bufferLayer = new BufferLayer();
                bufferLayer.Name       = layerDataSource.Name;
                bufferLayer.DataSource = layerDataSource;
                BufferLayers.Add(bufferLayer);
            }
        }
コード例 #17
0
        public void SetDataSource(OD.DataSource dataSource)
        {
            if (_dataSource != dataSource)
            {
                // this will cause the schema to get recreated
                _schema = null;

                // clear the grouping
                _groupByColumnViewModels = null;

                _dataSource   = dataSource;
                _map          = GetMap();
                _featureLayer = FindFeatureLayer(_dataSource);
            }
        }
コード例 #18
0
        protected FeatureLayer FindFeatureLayer(OD.DataSource dataSource)
        {
            if (dataSource == null)
            {
                return(null);
            }
            MapWidget mapWidget = GetMapWidget(dataSource);

            if (mapWidget == null)
            {
                return(null);
            }

            return(mapWidget.FindFeatureLayer(dataSource));
        }
コード例 #19
0
        public StopViewModel(OD.DataSource dataSource, OD.DataSource routesDataSource, StopWidget view)
            : base(dataSource)
        {
            // init _wsTimer
            _webSocketKeepAliveTimer          = new DispatcherTimer();
            _webSocketKeepAliveTimer.Interval = new TimeSpan(0, 0, 2);
            _webSocketKeepAliveTimer.Tick    += new EventHandler(OnWebSocketKeepAliveTick);

            // init _progressDialogTimer
            _progressDialogTimer       = new DispatcherTimer();
            _progressDialogTimer.Tick += new EventHandler(OnProgressDialogTimeOut);

            // init the data members with default values
            StopsRouteNameFieldName                     = @"RouteName";
            RoutesRouteNameFieldName                    = @"Route";
            Properties["GepHostName"]                   = @"localhost";
            Properties["GepHttpPort"]                   = @"6180";
            Properties["GepHttpsPort"]                  = @"6143";
            Properties["GEP_LOAD_PLAN_ENDPOINT"]        = @"geoevent/rest/receiver/route-command-in";
            Properties["GEP_ROUTES_CALCULATE_ENDPOINT"] = @"geoevent/rest/receiver/route-update-in";
            Properties["GEP_ROUTES_UPDATE_ENDPOINT"]    = @"geoevent/rest/receiver/route-update-in";
            Properties["GEP_DISPATCH_ENDPOINT"]         = @"geoevent/rest/receiver/route-message-in";
            Properties["STOPS_ROUTE_NAME_FIELD_NAME"]   = @"RouteName";
            Properties["ROUTES_ROUTE_NAME_FIELD_NAME"]  = @"RouteName";
            Properties["ROUTES_UN_ASSIGNED_ROUTE_NAME"] = @"__Unassigned__";

            _unassignedRouteName = GetPropValue("ROUTES_UN_ASSIGNED_ROUTE_NAME");
            SetRouteDataSource(routesDataSource);

            // temp
            _view = view;

            // init commands
            DispatchCommand     = new DelegatingCommand(OnDispatch);
            DispatchAllCommand  = new DelegatingCommand(OnDispatchAll);
            UnassignCommand     = new DelegatingCommand(OnUnassign);
            CutCommand          = new DelegatingCommand(OnCut);
            PasteCommand        = new DelegatingCommand(OnPaste);
            PasteOnGroupCommand = new DelegatingCommand(OnPasteOnGroup);

            _edits = new HashSet <string>();

            // Web Socket Event Handlers
            _wsOnOpenEH    = new EventHandler(WebSocket_OnOpen);
            _wsOnCloseEH   = new EventHandler <CloseEventArgs>(WebSocket_OnClose);
            _wsOnErrorEH   = new EventHandler <ErrorEventArgs>(WebSocket_OnError);
            _wsOnMessageEH = new EventHandler <MessageEventArgs>(WebSocket_OnMessage);
        }
コード例 #20
0
        /// <summary>
        /// Determines if the feature action can be executed based on the specified data source and feature, before the option to execute
        /// the feature action is displayed to the user.
        /// </summary>
        /// <param name="dataSource">The data source which will be subsequently passed to the Execute method if CanExecute returns true.</param>
        /// <param name="feature">The data source which will be subsequently passed to the Execute method if CanExecute returns true.</param>
        /// <returns>True if the feature action should be enabled, otherwise false.</returns>
        public bool CanExecute(ESRI.ArcGIS.OperationsDashboard.DataSource dataSource, client.Graphic feature)
        {
            // Check if the data source and feature can be used with this feature action.
            bool available = false;

            foreach (var widget in OperationsDashboard.Instance.Widgets)
            {
                if (widget is RangeFanWid)
                {
                    available = true;
                }
                else
                {
                    available = false;
                }
            }
            return(available);
        }
コード例 #21
0
        internal MapWidget GetMapWidget(OD.DataSource dataSource)
        {
            if (OperationsDashboard.Instance == null)
            {
                return(null);
            }

            IWidget widget = OperationsDashboard.Instance.FindWidget(dataSource);

            if (widget is MapWidget)
            {
                MapWidget mapWidget = widget as MapWidget;
                mapWidget.IsDrawingProgressVisible = false;
                return(mapWidget);
            }

            return(null);
        }
コード例 #22
0
        private bool SetDataSource(DataSource dataSource)
        {
            if (_dataSource != dataSource)
            {
                GeoFenceViewModel vm = DataGridViewModel as GeoFenceViewModel;
                vm.TrackIdFieldName  = TrackIdFieldName;
                vm.NameFieldName     = NameFieldName;
                vm.CategoryFieldName = CategoryFieldName;
                vm.ActiveFieldName   = ActiveFieldName;
                vm.GroupByFieldName  = GroupByFieldName;
                vm.SortByFieldName1  = SortByFieldName1;
                vm.SortByFieldName2  = SortByFieldName2;
                vm.SetDataSource(dataSource);
                _dataSource = dataSource;
            }

            return(SetMapWidget(dataSource));
        }
        /// <summary>
        /// Determines if the feature action can be executed based on:
        /// whether the data source is the one specified in the config window. If not, check if the data source is the selection data source of the one specified;
        /// whether the data source is broken;
        /// whether the feature's geometry is not null;
        /// whether the feature is a point feature
        /// </summary>
        public bool CanExecute(ESRI.ArcGIS.OperationsDashboard.DataSource dataSource, client.Graphic feature)
        {
            #region If there's a previously set DataSourceId, we try to use it
            if (!string.IsNullOrEmpty(DataSourceId))
            {
                SelectedDataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault(ds => ds.Id == DataSourceId);
            }
            if (SelectedDataSource == null)
            {
                return(false);
            }
            #endregion

            //Check if the data source picked by user is the one specified in the config window
            if (dataSource.Id != SelectedDataSource.Id)
            {
                //If not, check if the data source picked by user is the selection data source of the one specified in the config window
                if (SelectedDataSource.Name == string.Format("{0} Selection", dataSource.Name) && SelectedDataSource.IsSelectable)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            //Check if the data source is broken
            if (dataSource.IsBroken)
            {
                return(false);
            }
            //Check if the feature's geometry is null
            if (feature == null || feature.Geometry == null || string.IsNullOrEmpty(feature.Geometry.ToJson()))
            {
                return(false);
            }
            //Check if the feature is a point feature
            if (feature.Geometry.GetType() != typeof(client.Geometry.MapPoint))
            {
                return(false);
            }

            return(true);
        }
コード例 #24
0
        // ***********************************************************************************
        // * Query the selected resource layer to get the different resource types...
        // ***********************************************************************************
        private async void queryResourceLayer(ESRI.ArcGIS.OperationsDashboard.DataSource dataSource)
        {
            var query = new ESRI.ArcGIS.OperationsDashboard.Query();

            query.WhereClause    = "1=1";
            query.ReturnGeometry = false;
            query.Fields         = new string[] { _resourceTypeField };

            var result = await dataSource.ExecuteQueryAsync(query);

            if (result == null || result.Features == null)
            {
                return;
            }
            else
            {
                queryResourceLayer_ExecuteCompleted(result);
            }
        }
        /// <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 <DataSource> dataSources)
        {
            // Show the configuration dialog.
            Config.ConfigureSummaryReportResultViewDialog dialog = new Config.ConfigureSummaryReportResultViewDialog(dataSources, Caption, DataSourceId, MapWidgetId, Expressions, FieldNameAliasMap, NewFields, UseAliasName, AllSelected, UseExpandable)
            {
                Owner = owner
            };
            if (dialog.ShowDialog() != true)
            {
                return(false);
            }

            // Retrieve the selected values for the properties from the configuration dialog.
            Caption           = dialog.Caption;
            DataSourceId      = dialog.DataSource.Id;
            Expressions       = dialog.expressions;
            WhereClause       = dialog.activeWhereClause;
            FieldNameAliasMap = dialog.FieldNameAliasMap;
            NewFields         = dialog.NoteFields;
            UseAliasName      = dialog.UseAliasNameSelected;
            AllSelected       = dialog.AllSelected;
            UseExpandable     = dialog.fieldListControl.useExpandableList;

            mapWidget = dialog.mapWidget;

            AdditionalFields = new Dictionary <string, string>()
            {
            };

            foreach (var item in dialog.AdditionalFieldNames)
            {
                AdditionalFields.Add(item.Key, item.Value);
            }

            //get the datasource based on ID
            dataSource = OperationsDashboard.Instance.DataSources.FirstOrDefault((_dataSource) => _dataSource.Id == DataSourceId);

            //Query the datasource and populate the list
            getData(dataSource);

            return(true);
        }
コード例 #26
0
        public BaseDataGridViewModel(OD.DataSource dataSource)
        {
            ViewModel  = this;
            Properties = new Dictionary <string, string>();

            InEditMode             = false;
            ConvertToLocalTimeZone = true;

            // init commands
            PanToCommand             = new DelegatingCommand(OnPanTo);
            ZoomToCommand            = new DelegatingCommand(OnZoomTo);
            HighlightCommand         = new DelegatingCommand(OnHighlight);
            FollowCommand            = new DelegatingCommand(OnFollow);
            StopFollowCommand        = new DelegatingCommand(OnStopFollow);
            DeleteItemCommand        = new DelegatingCommand(OnDeleteItem);
            DeleteAllCommand         = new DelegatingCommand(OnDeleteAll);
            GroupByDelegatingCommand = new DelegatingCommand(OnGroupByAction);

            Update(dataSource);
        }
コード例 #27
0
        public AlertViewModel(OD.DataSource dataSource)
            : base(dataSource)
        {
            // init the data members with default values
            Properties["GepHostName"]                   = @"localhost";
            Properties["GepHttpPort"]                   = @"6180";
            Properties["GepHttpsPort"]                  = @"6143";
            Properties["GEP_INCIDENTS_ENDPOINT"]        = @"geoevent/admin/incidents";
            Properties["ALERT_ASSIGN_TO_FIELD_ALIAS"]   = @"Assigned To";
            Properties["ALERT_ASSIGN_TO_URI_PROP"]      = @"AssignedTo";
            Properties["ALERT_NOTE_FIELD_ALIAS"]        = @"Note";
            Properties["ALERT_NOTE_URI_PROP"]           = @"Note";
            Properties["ALERT_DISMISS_STATUS_URI_PROP"] = @"Dismissed";
            Properties["ALERT_DISMISSED_VALUE"]         = @"true";

            // init the commands
            DismissCommand  = new DelegatingCommand(OnDismiss);
            AssignToCommand = new DelegatingCommand(OnAssignTo);
            NoteCommand     = new DelegatingCommand(OnNote);
        }
コード例 #28
0
 /// <summary>
 /// Execute is called when the user chooses the feature action from the feature actions context menu. Only called if
 /// CanExecute returned true.
 /// </summary>
 public void Execute(ESRI.ArcGIS.OperationsDashboard.DataSource dataSource, client.Graphic feature)
 {
     try
     {
         // For example, in the MapWidget that ultimately provides the data source, show the popup window for the feature.
         MapWidget mw = MapWidget.FindMapWidget(dataSource);
         foreach (var widget in OperationsDashboard.Instance.Widgets)
         {
             if (widget is RangeFanWid)
             {
                 RangeFanWid pWidget = (RangeFanWid)widget;
                 pWidget.addToList(feature);
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
     }
 }
コード例 #29
0
 /// <summary>
 /// Execute is called when the user chooses the feature action from the feature actions context menu. Only called if
 /// CanExecute returned true.
 /// </summary>
 public void Execute(ESRI.ArcGIS.OperationsDashboard.DataSource dataSource, client.Graphic feature)
 {
     try
     {
         // Provide feature action implementation.
         // Check if the data source and feature can be used with this feature action.
         foreach (var widget in OperationsDashboard.Instance.Widgets)
         {
             if (widget is RangeFanWid)
             {
                 //((RangeFanWidget)widget).Visibility = System.Windows.Visibility.Visible;
                 RangeFanWid pWidget = (RangeFanWid)widget;
                 pWidget.removefromList(feature);
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
     }
 }
        /// <summary>
        /// Determines if the feature action can be executed based on the specified data source and feature, before the option to execute
        /// the feature action is displayed to the user.
        /// </summary>
        /// <param name="dataSource">The data source which will be subsequently passed to the Execute method if CanExecute returns true.</param>
        /// <param name="feature">The data source which will be subsequently passed to the Execute method if CanExecute returns true.</param>
        /// <returns>True if the feature action should be enabled, otherwise false.</returns>
        public bool CanExecute(ESRI.ArcGIS.OperationsDashboard.DataSource dataSource, client.Graphic feature)
        {
            //CanExecute = false if the feature's data source is a stand alone data source (i.e. map widget is null)
            MapWidget mw = MapWidget.FindMapWidget(dataSource);

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

            //CanExecute = false if the input feature's geometry is null
            if (feature.Geometry == null)
            {
                return(false);
            }

            //CanExecute = false if the input feature is not a polyline
            if (feature.Geometry.GetType() != typeof(client.Geometry.Polyline))
            {
                return(false);
            }

            return(true);
        }
コード例 #31
0
 public void SetRouteDataSource(DataSource routeDataSource)
 {
     if (_routeDataSource != routeDataSource)
       {
     StopViewModel vm = DataGridViewModel as StopViewModel;
     vm.SetRouteDataSource(routeDataSource);
     vm.RoutesRouteNameFieldName = RoutesRouteNameFieldName;
     _routeDataSource = routeDataSource;
       }
 }
コード例 #32
0
        public static async Task <GraphicsLayer> CreateCustomLayer(FeatureLayer featureLayer, OD.DataSource dataSource)
        {
            if (featureLayer == null || dataSource == null)
            {
                return(null);
            }

            GraphicsLayer customLayer = new GraphicsLayer();

            customLayer.DisplayName = "Edit - " + featureLayer.DisplayName;
            customLayer.Renderer    = featureLayer.Renderer;

            // Execute an async query
            OD.Query query = new OD.Query();
            query.ReturnGeometry = true;
            OD.QueryResult queryResult = await dataSource.ExecuteQueryAsync(query);

            if (queryResult.Canceled || queryResult.Features == null)
            {
                return(null);
            }

            CopyGraphics(queryResult.Features, customLayer.Graphics);
            return(customLayer);
        }
コード例 #33
0
 private void SetDataSource(DataSource dataSource)
 {
     if (_dataSource != dataSource)
       {
     TableViewModel vm = DataGridViewModel as TableViewModel;
     vm.TrackIdFieldName = TrackIdFieldName;
     vm.GroupByFieldName = GroupByFieldName;
     vm.SortByFieldName1 = SortByFieldName1;
     vm.SortByFieldName2 = SortByFieldName2;
     vm.SetDataSource(dataSource);
     _dataSource = dataSource;
       }
 }
コード例 #34
0
    public void SetDataSource(OD.DataSource dataSource)
    {
      if (_dataSource != dataSource)
      {
        // this will cause the schema to get recreated
        _schema = null;

        // clear the grouping
        _groupByColumnViewModels = null;

        _dataSource = dataSource;
        _map = GetMap();
        _featureLayer = FindFeatureLayer(_dataSource);
      }
    }
コード例 #35
0
 private void SetStopDataSource(DataSource stopDataSource)
 {
     if (_stopDataSource != stopDataSource)
       {
     StopViewModel vm = DataGridViewModel as StopViewModel;
     vm.SetDataSource(stopDataSource);
     vm.TrackIdFieldName = TrackIdFieldName;
     vm.GroupByFieldName = GroupByFieldName;
     vm.SortByFieldName1 = SortByFieldName1;
     vm.SortByFieldName2 = SortByFieldName2;
     vm.StopsRouteNameFieldName = StopsRouteNameFieldName;
     _stopDataSource = stopDataSource;
       }
 }
コード例 #36
0
        private bool SetDataSource(DataSource dataSource)
        {
            if (_dataSource != dataSource)
              {
            GeoFenceViewModel vm = DataGridViewModel as GeoFenceViewModel;
            vm.TrackIdFieldName  = TrackIdFieldName;
            vm.NameFieldName     = NameFieldName;
            vm.CategoryFieldName = CategoryFieldName;
            vm.ActiveFieldName   = ActiveFieldName;
            vm.GroupByFieldName  = GroupByFieldName;
            vm.SortByFieldName1  = SortByFieldName1;
            vm.SortByFieldName2  = SortByFieldName2;
            vm.SetDataSource(dataSource);
            _dataSource = dataSource;
              }

              return SetMapWidget(dataSource);
        }
コード例 #37
0
 public void SetRouteDataSource(OD.DataSource routeDataSource)
 {
   _routesDataSource = routeDataSource;
 }