示例#1
0
        /*
         * public StopsViewModel() :
         * base(null)
         * {
         * Init();
         * }
         */

        public StopsViewModel(string routeName, FeatureLayerHelper flStops, FeatureLayerHelper flStopsPending) :
            base(flStops)
        {
            Init();
            _routeName      = routeName;
            _flStopsPending = flStopsPending;
        }
 /*
 public StopsViewModel() :
   base(null)
 {
   Init();
 }
 */
 public StopsViewModel(string routeName, FeatureLayerHelper flStops, FeatureLayerHelper flStopsPending)
     : base(flStops)
 {
     Init();
       _routeName = routeName;
       _flStopsPending = flStopsPending;
 }
示例#3
0
        public BaseItemsViewModel(FeatureLayerHelper featureLayerHelper)
        {
            Init();
            SetFeatureLayer(featureLayerHelper);

            ViewModel  = this;
            Properties = new Dictionary <string, string>();

            ConvertToLocalTimeZone = true;

            // init commands
            GroupByDelegatingCommand = new DelegatingCommand(OnGroupByAction);

            //hk Update(featureLayer);
        }
        public BaseItemsViewModel(FeatureLayerHelper featureLayerHelper)
        {
            Init();
              SetFeatureLayer(featureLayerHelper);

              ViewModel = this;
              Properties = new Dictionary<string, string>();

              ConvertToLocalTimeZone = true;

              // init commands
              GroupByDelegatingCommand = new DelegatingCommand(OnGroupByAction);

              //hk Update(featureLayer);
        }
示例#5
0
        public void SetFeatureLayer(FeatureLayerHelper featureLayerHelper)
        {
            if (featureLayerHelper == null || featureLayerHelper.FeatureLayer == null)
            {
                return;
            }

            if (_featureLayerHelper == null || _featureLayerHelper.FeatureLayer != featureLayerHelper.FeatureLayer)
            {
                // this will cause the schema to get recreated
                _schema = null;

                // clear the grouping
                _groupByColumnViewModels = null;
            }

            _featureLayerHelper = featureLayerHelper;
        }
示例#6
0
        public void Update(FeatureLayerHelper featureLayerHelper, string where)
        {
            if (SkipUpdates)
            {
                return;
            }
            if (featureLayerHelper == null || featureLayerHelper.FeatureLayer == null)
            {
                return;
            }
            if (featureLayerHelper.FeatureLayer.HasEdits)
            {
                return;
            }
            if (String.IsNullOrEmpty(where))
            {
                where = "1=1";
            }

            QueryTask queryTask = new QueryTask(featureLayerHelper.FeatureLayer.Url);
            Query     query     = new Query();

            query.Where          = where;
            query.ReturnGeometry = true;
            query.OutFields.AddRange(new string[] { "*" });
            queryTask.Execute(query);
            try
            {
                SetFeatureLayer(featureLayerHelper);
                Update(queryTask.LastResult);
            }
            catch (Exception ex)
            {
                Log.TraceException("Updating " + featureLayerHelper.FeatureLayer.DisplayName, ex);
            }
        }
 /*
 public MessagesViewModel() :
   base(null)
 {
   Init();
 }
 */
 public MessagesViewModel(FeatureLayerHelper featureLayerHelper)
     : base(featureLayerHelper)
 {
     Init();
 }
        private void MapLoaded(GetMapCompletedEventArgs args)
        {
            try
              {
            _flVehicles         = new FeatureLayerHelper(_map, _layerNameVehicles, FeatureLayer.QueryMode.Snapshot, true);
            _flWorkers          = new FeatureLayerHelper(_map, _layerNameWorkers, FeatureLayer.QueryMode.Snapshot, true);
            _flStops            = new FeatureLayerHelper(_map, _layerNameStops, FeatureLayer.QueryMode.Snapshot, true);
            _flRoutes           = new FeatureLayerHelper(_map, _layerNameRoutes, FeatureLayer.QueryMode.Snapshot, true);
            _flMessages         = new FeatureLayerHelper(_map, _layerNameMessages, FeatureLayer.QueryMode.Snapshot, false);
            _flStopsPending     = new FeatureLayerHelper(_map, _layerNameStopsPending, FeatureLayer.QueryMode.Snapshot, false);
            _flMessagesPending  = new FeatureLayerHelper(_map, _layerNameMessagesPending, FeatureLayer.QueryMode.Snapshot, false);
            _flRouteAssignment  = new FeatureLayerHelper(_map, _layerNameRouteAssignment, FeatureLayer.QueryMode.Snapshot, false);

            _routeName = QueryRouteNameByUserName();

            StopPanel.Visibility    = System.Windows.Visibility.Visible;
            MessagePanel.Visibility = System.Windows.Visibility.Visible;

            StopsListBox.SelectedIndex = 0;
            MessagesListBox.SelectedIndex = 0;
            DataContext = this;

            // Map refresh timer
            int mapRefreshRateSec = 0;
            if (!Int32.TryParse(ConfigurationManager.AppSettings.Get("MapRefreshRateSec"), out mapRefreshRateSec))
              mapRefreshRateSec = 5;

            _updateMapTimer = new DispatcherTimer();
            _updateMapTimer.Interval = new TimeSpan(0, 0, mapRefreshRateSec);
            _updateMapTimer.Tick += new EventHandler(UpdateMapTimer_Tick);
            //_updateMapTimer.Start();

            // Stops refresh timer
            int stopsRefreshRateSec = 0;
            if (!Int32.TryParse(ConfigurationManager.AppSettings.Get("StopsRefreshRateSec"), out stopsRefreshRateSec))
              stopsRefreshRateSec = 5;

            _updateStopsTimer = new DispatcherTimer();
            _updateStopsTimer.Interval = new TimeSpan(0, 0, stopsRefreshRateSec);
            _updateStopsTimer.Tick += new EventHandler(UpdateStopsTimer_Tick);
            //_updateStopsTimer.Start();

            // Messages refresh timer
            int messagesRefreshRateSec = 0;
            if (!Int32.TryParse(ConfigurationManager.AppSettings.Get("MessagesRefreshRateSec"), out messagesRefreshRateSec))
              messagesRefreshRateSec = 5;

            _updateMessagesTimer = new DispatcherTimer();
            _updateMessagesTimer.Interval = new TimeSpan(0, 0, messagesRefreshRateSec);
            _updateMessagesTimer.Tick += new EventHandler(UpdateMessagesTimer_Tick);
            //_updateMessagesTimer.Start();

            RefreshAll();
              }
              catch (Exception ex)
              {
            System.Diagnostics.Debug.WriteLine(ex.Message);
              }
        }
        public void Update(FeatureLayerHelper featureLayerHelper, string where)
        {
            if (SkipUpdates)
            return;
              if (featureLayerHelper == null || featureLayerHelper.FeatureLayer == null)
            return;
              if (featureLayerHelper.FeatureLayer.HasEdits)
            return;
              if (String.IsNullOrEmpty(where))
            where = "1=1";

              QueryTask queryTask = new QueryTask(featureLayerHelper.FeatureLayer.Url);
              Query query = new Query();
              query.Where = where;
              query.ReturnGeometry = true;
              query.OutFields.AddRange(new string[] { "*" });
              queryTask.Execute(query);
              try
              {
            SetFeatureLayer(featureLayerHelper);
            Update(queryTask.LastResult);
              }
              catch (Exception ex)
              {
            Log.TraceException("Updating " + featureLayerHelper.FeatureLayer.DisplayName, ex);
              }
        }
        public void SetFeatureLayer(FeatureLayerHelper featureLayerHelper)
        {
            if (featureLayerHelper == null || featureLayerHelper.FeatureLayer == null)
            return;

              if (_featureLayerHelper == null || _featureLayerHelper.FeatureLayer != featureLayerHelper.FeatureLayer)
              {
            // this will cause the schema to get recreated
            _schema = null;

            // clear the grouping
            _groupByColumnViewModels = null;
              }

              _featureLayerHelper = featureLayerHelper;
        }
        /*
         * public MessagesViewModel() :
         * base(null)
         * {
         * Init();
         * }
         */

        public MessagesViewModel(FeatureLayerHelper featureLayerHelper) :
            base(featureLayerHelper)
        {
            Init();
        }