public void LoadLocators() { this.cmbLocators.Items.Clear(); ISecureContext secureContext = _context as ISecureContext; if (secureContext.YutaiProject == null) { return; } XmlPlugin plugCfg = secureContext.YutaiProject.FindPlugin("2b81c89a-ee45-4276-9dc1-72bbbf07f53f"); if (plugCfg == null) { return; } //修改为从配置文件里面读取 string locatorXml = FileHelper.GetFullPath(plugCfg.ConfigXML); FileInfo fileInfo = new FileInfo(locatorXml); if (!fileInfo.Exists) { return; } using (var reader = new StreamReader(locatorXml)) { string state = reader.ReadToEnd(); var config = state.Deserialize <PluginConfig>(); _locators = config.Locators; foreach (XmlLocator locator in config.Locators) { this.cmbLocators.Items.Add(locator.Name); } _map = _context.MapControl.ActiveView as IMap; } }
public XmlProject(ISecureContext context, string filename) { /*int selectedHandle = context.Legend.SelectedLayerHandle; * * Layers = context.Legend.Layers.Select(l => new XmlLayer(l, l.Handle == selectedHandle)).ToList(); * * Groups = context.Legend.Groups.Select(g => new XmlGroup(g)).ToList();*/ Plugins = context.PluginManager.ActivePlugins.Select(p => new XmlPlugin() { Name = p.Identity.Name, Guid = p.Identity.Guid }).ToList(); /* Map = new XmlMap * { * Projection = context.Map.Projection.ExportToWkt(), * Envelope = new XmlEnvelope(context.Map.Extents), * TileProviderId = context.Map.Tiles.ProviderId * };*/ Settings = new XmlProjectSettings { SavedAsFilename = filename }; /* if (!context.Locator.Empty) * { * var service = context.Container.GetInstance<ImageSerializationService>(); * Locator = new XmlMapLocator(context.Locator, service); * }*/ }
private static void InitMapLegend(ISecureContext context) { var legendControl = context.GetDockPanelObject(MapLegendDockPanel.DefaultDockName); var legend = context.DockPanels.Add(legendControl as IDockPanelView, PluginIdentity.Default); //legend.Caption = "二维图例"; //legend.TabPosition = 1; //legend.DockTo(MapLegendDockPanel.DefaultDockName, DockPanelState.Left, PanelSize); //legend.SetIcon(Resources.ico_legend); }
private static void InitLegend(ISecureContext context) { var legendControl = context.GetDockPanelObject(DefaultDockPanel.Legend); var legend = context.DockPanels.Add(legendControl, DockPanelKeys.Legend, PluginIdentity.Default); legend.Caption = "Legend"; legend.DockTo(null, DockPanelState.Left, PanelSize); legend.SetIcon(Resources.ico_legend); }
private static void InitOverview(ISecureContext context) { var overviewControl = context.GetDockPanelObject(OverviewDockPanel.DefaultDockName); var overview = context.DockPanels.Add(overviewControl as IDockPanelView, PluginIdentity.Default); //overview.Caption = "鹰眼视图"; //overview.TabPosition = 2; // overview.DockTo(MapLegendDockPanel.DefaultDockName, DockPanelState.Bottom, PanelSize); //overview.SetIcon(Resources.ico_tasks); }
private static void InitToolbox(ISecureContext context) { var toolboxControl = context.GetDockPanelObject(DefaultDockPanel.Toolbox); var toolbox = context.DockPanels.Add(toolboxControl, DockPanelKeys.Toolbox, PluginIdentity.Default); toolbox.Caption = "Toolbox"; toolbox.DockTo(null, DockPanelState.Right, PanelSize); toolbox.SetIcon(Resources.ico_toolbox24); }
public override void OnClick() { ISecureContext secureContext = _context as ISecureContext; if (secureContext.YutaiProject != null && string.IsNullOrEmpty(secureContext.YutaiProject.SceneDocumentName) == false) { _plugin.SceneView.OpenSXD(secureContext.YutaiProject.SceneDocumentName); } }
public static void InitDocking(this ISecureContext context) { var panels = context.DockPanels; if (panels != null) { panels.Lock(); } panels.Unlock(); }
public override void OnClick() { ISecureContext sContext = _context as ISecureContext; DockPanel dock = _context.DockPanels.GetDockPanel(MapLegendDockPanel.DefaultDockName); if (dock == null) { return; } dock.Visible = !dock.Visible; }
private static void InitTasks(ISecureContext context) { var presenter = context.Container.Resolve <TasksPresenter>(); var tasks = context.DockPanels.Add(presenter.View, DockPanelKeys.Tasks, PluginIdentity.Default); tasks.Caption = "Tasks"; var toolbox = context.DockPanels.Toolbox; tasks.DockTo(toolbox, DockPanelState.Tabbed, PanelSize); tasks.SetIcon(Resources.ico_tasks); tasks.TabPosition = toolbox.TabPosition; }
public ProjectLoaderLegacy(IAppContext context) //, ImageSerializationService imageSerializationService, ILayerService layerService) { /* if (imageSerializationService == null) throw new ArgumentNullException("imageSerializationService"); * if (layerService == null) throw new ArgumentNullException("layerService"); * _imageSerializationService = imageSerializationService; * _layerService = layerService;*/ _context = context as ISecureContext; if (_context == null) { throw new InvalidCastException("Application context must support ISerializable_context interface."); } }
public XmlProject(ISecureContext context, string filename) { //ProjectName = context.VastProject.ProjectName; //Database = context.VastProject.Database; //AttachmentPath = context.VastProject.AttachmentPath; Plugins = context.PluginManager.ActivePlugins.Select(p => new XmlPlugin() { Name = p.Identity.Name, Guid = p.Identity.Guid }).ToList(); Settings = new XmlProjectSettings { SavedAsFilename = filename }; }
public ProjectLoader(IAppContext context, ImageSerializationService imageSerializationService, IBroadcasterService broadcaster) { if (imageSerializationService == null) { throw new ArgumentNullException("imageSerializationService"); } _imageSerializationService = imageSerializationService; _broadcaster = broadcaster; _context = context as ISecureContext; if (_context == null) { throw new InvalidCastException("Application context must support ISerializable_context interface."); } }
public static void InitDocking(this ISecureContext context) { var panels = context.DockPanels; panels.Lock(); InitLegend(context); InitLocator(context); InitToolbox(context); InitTasks(context); context.DockPanels.Legend.TabPosition = 0; }
public override void OnClick() { ISecureContext secureContext = _context as ISecureContext; if (secureContext.YutaiProject != null && !string.IsNullOrEmpty(secureContext.YutaiProject.MapDocumentName)) { if (MessageService.Current.Ask("当前打开的项目有链接的MXD文档,你确认需要进行替换吗?") == false) { return; } } OpenFileDialog dialog = new OpenFileDialog(); dialog.Title = "打开Mxd文档"; dialog.Filter = "MXD文档(*.mxd)|*.mxd"; dialog.Multiselect = false; dialog.CheckFileExists = true; DialogResult result = dialog.ShowDialog(); if (result != DialogResult.OK) { return; } string fileName = dialog.FileName; if (secureContext.YutaiProject == null) { secureContext.YutaiProject = new XmlProject(secureContext, ""); } if (_context.MainView.ControlType == GISControlType.MapControl) { _context.MapControl.LoadMxFile(dialog.FileName); secureContext.YutaiProject.MapDocumentName = fileName; } else if (_context.MainView.ControlType == GISControlType.PageLayout) { _context.MainView.PageLayoutControl.LoadMxFile(dialog.FileName); secureContext.YutaiProject.MapDocumentName = fileName; } else { _context.MainView.ActivateMap(); _context.MapControl.LoadMxFile(dialog.FileName); secureContext.YutaiProject.MapDocumentName = fileName; } }
public override void Initialize(IAppContext context) { _context = context; _menuGenerator = context.Container.GetInstance <MenuGenerator>(); ISecureContext secureContext = context as ISecureContext; if (secureContext.YutaiProject != null) { XmlPlugin xmlPlugin = secureContext.YutaiProject.FindPlugin("2fd39cff-e0d7-44cb-a6f7-b5e90499124c"); if (xmlPlugin != null) { string fileName = xmlPlugin.ConfigXML; //if (string.IsNullOrEmpty(fileName)) //{ // _printConfig.TemplateConnectionString = BuildDefaultConnectionString(); //} //else //{ // fileName = FileHelper.GetFullPath(fileName); // _printConfig.LoadFromXml(fileName); //} } } //if (string.IsNullOrEmpty(_printConfig.TemplateConnectionString)) //{ // _printConfig.TemplateConnectionString = BuildDefaultConnectionString(); //} //_templateGallery =new MapTemplateGallery(); //_templateGallery.SetWorkspace(_printConfig.TemplateConnectionString); //_menuListener = context.Container.GetInstance<MenuListener>(); //_mapListener = context.Container.GetInstance<MapListener>(); //_dockPanelService = context.Container.GetInstance<TemplateDockPanelService>(); //获取配置对象 // _pipelineConfig = context.Container.GetSingleton<PipelineConfig>(); //if (string.IsNullOrEmpty(_pipelineConfig.XmlFile)) //{ // string fileName = ((ISecureContext) _context).YutaiProject.FindPlugin("4a3bcaab-9d3e-4ca7-a19d-7ee08fb0629e").ConfigXML; // if (string.IsNullOrEmpty(fileName)) return; // //fileName = FileHelper.GetFullPath(fileName); // //_pipelineConfig.LoadFromXml(fileName); //} }
public static void InitDocking(this ISecureContext context) { var panels = context.DockPanels; panels.Lock(); InitMapLegend(context); InitOverview(context); /* InitLocator(context); * * InitToolbox(context); * * InitTasks(context);*/ panels.Unlock(); }
private static void InitLocator(ISecureContext context) { var locatorControl = context.GetDockPanelObject(DefaultDockPanel.Locator); if (locatorControl == null) { return; } var locator = context.DockPanels.Add(locatorControl, DockPanelKeys.Preview, PluginIdentity.Default); locator.Caption = "Overview"; locator.SetIcon(Resources.ico_zoom_to_layer); locator.DockTo(context.DockPanels.Legend, DockPanelState.Bottom, PanelSize); var size = locator.Size; locator.Size = new Size(size.Width, 250); }
public override void Initialize(IAppContext context) { _context = context; _menuGenerator = context.Container.GetInstance <MenuGenerator>(); ISecureContext secureContext = context as ISecureContext; _drawFence = true; _isDeign = false; _isLayout = false; if (secureContext.YutaiProject != null) { XmlPlugin xmlPlugin = secureContext.YutaiProject.FindPlugin("5e933989-b5a4-4a45-a5b7-2d9ded61df0f"); if (xmlPlugin != null) { string fileName = xmlPlugin.ConfigXML; if (string.IsNullOrEmpty(fileName)) { _printConfig.TemplateConnectionString = BuildDefaultConnectionString(); } else { fileName = FileHelper.GetFullPath(fileName); _printConfig.LoadFromXml(fileName); } } } if (string.IsNullOrEmpty(_printConfig.TemplateConnectionString)) { _printConfig.TemplateConnectionString = BuildDefaultConnectionString(); } _templateGallery = new MapTemplateGallery(); _templateGallery.SetWorkspace(_printConfig.TemplateConnectionString); ((IAppContextEvents)_context).OnActiveHookChanged += OnOnActiveHookChanged; _activeViewEvents = ((IActiveViewEvents_Event)_context.FocusMap); _activeViewEvents.AfterDraw += ActiveViewEventsOnAfterDraw; if (_fillSymbol == null) { _fillSymbol = SymbolHelper.CreateTransparentFillSymbol(Color.Blue) as ISymbol; _lineSymbol = SymbolHelper.CreateSimpleLineSymbol(Color.Blue, 1.5) as ISymbol; } }
public override void OnClick() { ISecureContext sContext = _context as ISecureContext; if (_dockService == null) { _dockService = _context.Container.GetInstance <DockPanelService>(); } if (sContext.YutaiProject == null) { MessageService.Current.Warn("当前项目没有设置定位器"); _dockService.Hide(); } else { _dockService.Show(); } }
/*private static void InitTasks(ISecureContext context) * { * var presenter = context.Container.Resolve<TasksPresenter>(); * var tasks = context.DockPanels.Add(presenter.View, DockPanelKeys.Tasks, PluginIdentity.Default); * tasks.Caption = "Tasks"; * var toolbox = context.DockPanels.Toolbox; * tasks.DockTo(toolbox, DockPanelState.Tabbed, PanelSize); * tasks.SetIcon(Resources.ico_tasks); * tasks.TabPosition = toolbox.TabPosition; * }*/ public static void SetViewStyle(this ISecureContext context, MapViewStyle viewStyle) { //TabSplitterContainer tabContainer = context.MainView.MapContainer as TabSplitterContainer; //if (viewStyle == MapViewStyle.View2D) //{ // tabContainer.PrimaryPages[0].Hide = false; // tabContainer.SecondaryPages[0].Hide = true; //} //if (viewStyle == MapViewStyle.View3D) //{ // tabContainer.SecondaryPages[0].Hide = false; // tabContainer.PrimaryPages[0].Hide = true; //} //if (viewStyle == MapViewStyle.ViewAll) //{ // tabContainer.SecondaryPages[0].Hide = false; // tabContainer.PrimaryPages[0].Hide = false; //} //tabContainer.Update(); }
public override void OnClick() { ISecureContext sContext = _context as ISecureContext; DockPanel dock = _context.DockPanels.GetDockPanel(OverviewDockPanel.DefaultDockName); if (dock == null) { return; } if (dock.Visible) { dock.Hide(); _checked = false; return; } else { dock.Show(); _checked = true; return; } }
public override void OnClick() { ISecureContext secureContext = _context as ISecureContext; if (secureContext.YutaiProject == null || string.IsNullOrEmpty(secureContext.YutaiProject.MapDocumentName)) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Title = "选择要保存的位置和文档名称"; DialogResult result = dialog.ShowDialog(); if (result != DialogResult.OK) { return; } secureContext.YutaiProject.MapDocumentName = dialog.FileName; } if (_context.MainView.ControlType == GISControlType.MapControl) { if (_context.MainView.MapControl.CheckMxFile(secureContext.YutaiProject.MapDocumentName)) { //create a new instance of a MapDocument IMapDocument mapDoc = new MapDocumentClass(); mapDoc.Open(secureContext.YutaiProject.MapDocumentName, string.Empty); //Make sure that the MapDocument is not readonly if (mapDoc.get_IsReadOnly(secureContext.YutaiProject.MapDocumentName)) { MessageBox.Show("Map document is read only!"); mapDoc.Close(); return; } //Replace its contents with the current map mapDoc.ReplaceContents((IMxdContents)_context.MainView.MapControl.Map); //save the MapDocument in order to persist it mapDoc.Save(mapDoc.UsesRelativePaths, false); //close the MapDocument mapDoc.Close(); return; } } else if (_context.MainView.ControlType == GISControlType.PageLayout) { if (_context.MainView.MapControl.CheckMxFile(secureContext.YutaiProject.MapDocumentName)) { //create a new instance of a MapDocument IMapDocument mapDoc = new MapDocumentClass(); mapDoc.Open(secureContext.YutaiProject.MapDocumentName, string.Empty); //Make sure that the MapDocument is not readonly if (mapDoc.get_IsReadOnly(secureContext.YutaiProject.MapDocumentName)) { MessageBox.Show("Map document is read only!"); mapDoc.Close(); return; } //Replace its contents with the current map mapDoc.ReplaceContents((IMxdContents)_context.MainView.PageLayoutControl); //save the MapDocument in order to persist it mapDoc.Save(mapDoc.UsesRelativePaths, false); //close the MapDocument mapDoc.Close(); return; } } }
public DeleteModel(ISecureContextFactory <Product, UserRef> dbContextFactory) { this.DbContext = dbContextFactory.Create(this.GetAuthenticatedUser); }
public OwnedContentContext(ISecureContext <Product> context, Func <UserRef> filterFactory) { this.Context = context; this.LazyOwner = new Lazy <UserRef>(filterFactory); }
public OwnedContentContextFactory(ISecureContext <Product> wrappedContext) { this.WrappedContext = wrappedContext; }