コード例 #1
0
ファイル: MapViewModel.cs プロジェクト: hansmei/PhotoVis
        public MapViewModel()
        {
            this._projectId                = -1;
            this._currentProject           = new ProjectModel(-1, "Empty");
            this._imageLocations           = new ImageAtLocationCollection();
            this._unassignedImageLocations = new ImageAtLocationCollection();

            App.MapVM = this;
        }
コード例 #2
0
ファイル: MapViewModel.cs プロジェクト: hansmei/PhotoVis
        public MapViewModel(ProjectModel model)
        {
            BingMapsCredentialsProvider bingMapsCredentials = new BingMapsCredentialsProvider();

            this.bingMapsCredentials = new ApplicationIdCredentialsProvider(bingMapsCredentials.Key);

            this._projectId                = model.ProjectId;
            this._currentProject           = model;
            this._imageLocations           = new ImageAtLocationCollection();
            this._unassignedImageLocations = new ImageAtLocationCollection();

            // Set this to capture the change events
            this._filteredUnassignedImageLocations.CollectionChanged += _unassignedImageLocations_CollectionChanged;

            App.MapVM = this; // Need this as this is not set until after the constructor is complete

            // Create first load of content
            Tuple <int, int, int> data = AssignmentIndexer.LoadImagesFromDatabase(this._projectId);
            int numAvailableImages     = data.Item1 + data.Item2;

            StatusText += string.Format("{0} Images loaded from database, where {1} are missing GPS information.\r\n",
                                        numAvailableImages, data.Item2);

            // Print error text that some images could not be found or is erased
            if (data.Item3 > 0)
            {
                StatusText += string.Format("{0} Images could no longer be found. They are either moved or erased.\r\n", data.Item3);
            }

            this.ApplyImageFilters();

            if (numAvailableImages == 0)
            {
                //this.StartIndexBackgroundworker(model);
                //this.StartIndexingAsync(model);
                Task.Delay(800).ContinueWith(
                    t => this.StartIndexBackgroundworker(model)
                    );
            }
        }