Beispiel #1
0
        private void OnApplicationEvent(object sender, ServerEventArgs e)
        {
            if (!(e.ServerEvent is PropertyChangedEvent))
            {
                return;
            }

            var ev = (PropertyChangedEvent)e.ServerEvent;

            if (ev.PropertyName == "Application")
            {
                ViewModel.IsLoading = false;

                _serverApplication = (ViewerApplication)ev.Value;

                ApplicationContext.Current.ViewerVersion = _serverApplication.VersionString;

                //TODO (CR May 2010): we don't unregister these
                EventMediator.RegisterEventHandler(_serverApplication.Viewer.Identifier, OnViewerEvent);
                ToolstripViewComponent.SetIconSize(_serverApplication.Viewer.ToolStripIconSize);
                ToolstripViewComponent.SetActionModel(_serverApplication.Viewer.ToolbarActions);
                _studyView.SetImageBoxes(_serverApplication.Viewer.ImageBoxes);
                return;
            }
        }
Beispiel #2
0
 void initializeDataContext(string appSettingsFileContents)
 {
     ViewerApplication = new ViewerApplication(appSettingsFileContents);
     if (DefaultApplicationSettings != null)
     {
         ViewerApplication.ArcGISOnlineSecure  = DefaultApplicationSettings.ArcGISOnlineSecure;
         ViewerApplication.ArcGISOnlineSharing = DefaultApplicationSettings.ArcGISOnlineSharing;
         ViewerApplication.BingMapsAppId       = DefaultApplicationSettings.BingMapsAppId;
         ViewerApplication.PortalAppId         = DefaultApplicationSettings.PortalAppId;
         ViewerApplication.GeometryService     = DefaultApplicationSettings.GeometryService;
         ViewerApplication.ArcGISOnlineProxy   = DefaultApplicationSettings.ArcGISOnlineProxy;
         ViewerApplication.Proxy = DefaultApplicationSettings.Proxy;
     }
     this.DataContext = ViewerApplication;
     ESRI.ArcGIS.Mapping.Controls.ArcGISOnline.ArcGISOnlineEnvironment.LoadConfig(ViewerApplication.ArcGISOnlineSharing, ViewerApplication.ArcGISOnlineSecure, ViewerApplication.ArcGISOnlineProxy,
                                                                                  true, false, false);
     ConfigurationStoreFilePath             = getUrl("/Config/Admin/ConfigurationStore.xml");
     ConnectionsFileFilePath                = getUrl("/Config/Admin/Connections.xml");
     SymbolConfigurationFilePath            = getUrl("/Config/Admin/Symbols.xml");
     SymbolFolderParentUrl                  = getUrl("/Config/Symbols", true);
     MapConfigurationFilePath               = getUrl("/Config/Map.xml");
     ToolsConfigurationFilePath             = getUrl("/Config/Tools.xml");
     BehaviorsConfigurationFilePath         = getUrl("/Config/Behaviors.xml");
     ControlsConfigurationFilePath          = getUrl("/Config/Controls.xml");
     HeatMapColorGradientsConfigFileUrl     = getUrl("/Config/ResourceDictionaries/HeatMapBrushes.xaml");
     ClassBreaksColorGradientsConfigFileUrl = getUrl("/Config/ResourceDictionaries/ThematicMapBrushes.xaml");
     ThemeFilePath             = getUrl("/Themes/Theme.thmx");
     ApplicationColorsFilePath = getUrl("/Config/Layouts/ResourceDictionaries/Common/Colors.xaml");
     LayoutFilePath            = getUrl(ViewerApplication.LayoutFilePath);
     downloadApplicationColorsFile();
 }
 private void IncrementVersionNumber(ViewerApplication application)
 {
     if (application != null && !string.IsNullOrWhiteSpace(application.Version))
     {
         Version version = null;
         if (Version.TryParse(application.Version, out version))
         {
             version             = new Version(version.Major, version.Minor, version.Build, version.Revision + 1);
             application.Version = version.ToString();
         }
     }
 }
Beispiel #4
0
        private void AddHelpLink_Click(object sender, RoutedEventArgs e)
        {
            if (ViewerApplicationControl.Instance == null ||
                ViewerApplicationControl.Instance.ViewerApplication == null)
            {
                return;
            }

            ViewerApplication va = ViewerApplicationControl.Instance.ViewerApplication;

            va.HelpLinks = va.HelpLinks ?? new System.Collections.ObjectModel.ObservableCollection <HelpLink>();
            va.HelpLinks.Add(new HelpLink()
            {
                DisplayText = Strings.NewLink, Url = "http://www.example.com"
            });
        }
Beispiel #5
0
        public virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                Shutdown();

                // Must do this beofre we work with the EventMediator
                ToolstripViewComponent.Dispose();

                if (_studyView != null)
                {
                    StudyViewContainer.Children.Clear();
                    if (disposing)
                    {
                        _studyView.Dispose();
                    }
                    _studyView = null;
                }

                if (EventMediator != null)
                {
                    if (_serverApplication != null)
                    {
                        EventMediator.UnregisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted);
                        EventMediator.UnregisterEventHandler(_serverApplication.Viewer.Identifier);
                        EventMediator.ServerApplicationStopped -= OnServerApplicationStopped;
                        _serverApplication = null;
                    }

                    EventMediator.Dispose();
                    EventMediator = null;
                }


                _disposed = true;
            }
        }
Beispiel #6
0
        private void OnViewerEvent(object sender, ServerEventArgs e)
        {
            if (!(e.ServerEvent is PropertyChangedEvent))
            {
                return;
            }

            var ev = (PropertyChangedEvent)e.ServerEvent;

            //TODO (CR May 2010): this is in the method above, too.  Which one works?
            if (ev.PropertyName == "Application")
            {
                _serverApplication = (ViewerApplication)ev.Value;
                //TODO (CR May 2010): we don't unregister these
                EventMediator.RegisterEventHandler(_serverApplication.Viewer.Identifier, OnViewerEvent);
                ToolstripViewComponent.SetIconSize(_serverApplication.Viewer.ToolStripIconSize);
                ToolstripViewComponent.SetActionModel(_serverApplication.Viewer.ToolbarActions);
                _studyView.SetImageBoxes(_serverApplication.Viewer.ImageBoxes);
                return;
            }

            if (ev.PropertyName == "ImageBoxes")
            {
                var imageBoxes = (Collection <ImageBox>)ev.Value;
                _serverApplication.Viewer.ImageBoxes = imageBoxes;
                _studyView.SetImageBoxes(imageBoxes);
                return;
            }

            if (ev.PropertyName == "ToolbarActions")
            {
                var actionModel = (Collection <WebActionNode>)ev.Value;
                _serverApplication.Viewer.ToolbarActions = actionModel;
                ToolstripViewComponent.SetActionModel(_serverApplication.Viewer.ToolbarActions);
                return;
            }
        }
Beispiel #7
0
        public virtual void Dispose(bool disposing)
        {
            if(!_disposed)
            {
                Shutdown();

                // Must do this beofre we work with the EventMediator
                ToolstripViewComponent.Dispose();

                if (_studyView != null)
                {
                    StudyViewContainer.Children.Clear();
                    if (disposing)
                    {
                        _studyView.Dispose();
                    }
                    _studyView = null;
                }

                if (EventMediator != null)
                {
                    if (_serverApplication != null)
                    {
                        EventMediator.UnregisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted);
                        EventMediator.UnregisterEventHandler(_serverApplication.Viewer.Identifier);
                        EventMediator.ServerApplicationStopped -= OnServerApplicationStopped;
                        _serverApplication = null;
                    }

                    EventMediator.Dispose();
                    EventMediator = null;
                }


                _disposed = true;
            }
        }
Beispiel #8
0
		private void OnViewerEvent(object sender, ServerEventArgs e)
		{
			if (!(e.ServerEvent is PropertyChangedEvent))
				return;

			var ev = (PropertyChangedEvent)e.ServerEvent;

			//TODO (CR May 2010): this is in the method above, too.  Which one works?
            if (ev.PropertyName == "Application")
            {
                _serverApplication = (ViewerApplication)ev.Value;
				//TODO (CR May 2010): we don't unregister these
                EventMediator.RegisterEventHandler(_serverApplication.Viewer.Identifier, OnViewerEvent);
                ToolstripViewComponent.SetIconSize(_serverApplication.Viewer.ToolStripIconSize);
                ToolstripViewComponent.SetActionModel(_serverApplication.Viewer.ToolbarActions);
                _studyView.SetImageBoxes(_serverApplication.Viewer.ImageBoxes);
                return;
            }

            if (ev.PropertyName == "ImageBoxes")
            {
                var imageBoxes = (Collection<ImageBox>)ev.Value;
                _serverApplication.Viewer.ImageBoxes = imageBoxes;
                _studyView.SetImageBoxes(imageBoxes);
                return;
            }

            if (ev.PropertyName == "ToolbarActions")
            {
                var actionModel = (Collection<WebActionNode>)ev.Value;
                _serverApplication.Viewer.ToolbarActions = actionModel;
                ToolstripViewComponent.SetActionModel(_serverApplication.Viewer.ToolbarActions);
                return;
            }
		}
Beispiel #9
0
        private void OnApplicationEvent(object sender, ServerEventArgs e)
        {
            if (!(e.ServerEvent is PropertyChangedEvent))
                return;

            var ev = (PropertyChangedEvent)e.ServerEvent;

            if (ev.PropertyName == "Application")
            {
                ViewModel.IsLoading = false;

                _serverApplication = (ViewerApplication)ev.Value;

                ApplicationContext.Current.ViewerVersion = _serverApplication.VersionString;

				//TODO (CR May 2010): we don't unregister these
                EventMediator.RegisterEventHandler(_serverApplication.Viewer.Identifier, OnViewerEvent);
                ToolstripViewComponent.SetIconSize(_serverApplication.Viewer.ToolStripIconSize);
                ToolstripViewComponent.SetActionModel(_serverApplication.Viewer.ToolbarActions);
                _studyView.SetImageBoxes(_serverApplication.Viewer.ImageBoxes);
                return;
            }
        }