Example #1
0
        private bool Login()
        {
            bool result = false;

            _login.SetLoginCredentials(txtUsername.Text, txtPassword.Text);

            if (_login.Check())
            {
                FrmGlobespotter.LoginSuccesfull();
                result = true;
            }
            else
            {
                GlobeSpotterConfiguration conf = GlobeSpotterConfiguration.Instance;

                if (conf.LoginFailed)
                {
                    txtUsername.Focus();
                }

                if (conf.LoadException)
                {
                    MessageBox.Show(string.Format("Exception occurred: {0}.", conf.Exception.Message));
                    _mssgBoxShow = true;
                }
            }

            lblLoginStatus.Text = _login.Credentials ? LoginSuccessfully : LoginFailed;
            return(result);
        }
        public async void OnAPIReady()
        {
            if (_api != null)
            {
                GlobeSpotterConfiguration.Load();
                _api.SetMaxViewers((uint)_constants.MaxViewers);
                _api.SetCloseViewerEnabled(true);
                _api.SetViewerToolBarVisible(false);
                _api.SetViewerToolBarButtonsVisible(true);
                _api.SetViewerTitleBarVisible(false);
                _api.SetViewerWindowBorderVisible(false);
                _api.SetHideOverlaysWhenMeasuring(false);
                _api.SetImageInformationEnabled(true);
                _api.SetViewerBrightnessEnabled(true);
                _api.SetViewerSaveImageEnabled(true);
                _api.SetViewerOverlayAlphaEnabled(true);
                _api.SetViewerShowLocationEnabled(true);
                _api.SetViewerDetailImagesVisible(_settings.ShowDetailImages);
                _api.SetContextMenuEnabled(true);
                _api.SetKeyboardEnabled(true);
                _api.SetViewerRotationEnabled(true);
                _api.SetWindowingMode(MDIWindowingMode.VERTICAL);

                _api.SetMultiWindowCount((uint)_settings.CtrlClickHashTag);
                _api.SetWindowSpread((uint)_settings.CtrlClickDelta);
                _measurementList.Api = _api;

                if (GlobeSpotterConfiguration.AddLayerWfs)
                {
                    _api.SetViewerOverlayDrawDistanceEnabled(true);
                }

                if (GlobeSpotterConfiguration.MeasurePermissions)
                {
                    _api.SetMeasurementSeriesModeEnabled(true);
                }

                if (GlobeSpotterConfiguration.MeasureSmartClick)
                {
                    _api.SetMeasurementSmartClickModeEnabled(_settings.EnableSmartClickMeasurement);
                }

                DockPaneGlobeSpotter globeSpotter = (dynamic)DataContext;
                string location = globeSpotter.Location;

                globeSpotter.PropertyChanged          += OnGlobeSpotterPropertyChanged;
                _settings.PropertyChanged             += OnSettingsPropertyChanged;
                _cycloMediaGroupLayer.PropertyChanged += OnGroupLayerPropertyChanged;

                foreach (CycloMediaLayer layer in _cycloMediaGroupLayer)
                {
                    if (!_layers.Contains(layer))
                    {
                        _layers.Add(layer);
                        UpdateRecordingLayer(layer);
                        layer.PropertyChanged += OnLayerPropertyChanged;
                    }
                }

                if (string.IsNullOrEmpty(location))
                {
                    globeSpotter.Hide();
                }
                else
                {
                    await OpenImageAsync(false);
                }

                _vectorLayerList.LayerAdded   += OnAddVectorLayer;
                _vectorLayerList.LayerRemoved += OnRemoveVectorLayer;
                _vectorLayerList.LayerUpdated += OnUpdateVectorLayer;

                foreach (var vectorLayer in _vectorLayerList)
                {
                    vectorLayer.PropertyChanged += OnVectorLayerPropertyChanged;
                }

                await _vectorLayerList.LoadMeasurementsAsync();

                DrawCompleteEvent.Subscribe(OnDrawComplete);
            }
        }