You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
3.2 KiB
99 lines
3.2 KiB
using DevExpress.XtraBars; |
|
using DevExpress.XtraBars.Ribbon; |
|
using ESRI.ArcGIS.SystemUI; |
|
using KGIS.Framework.Maps; |
|
using KGIS.Framework.Menus.Services; |
|
using KGIS.Framework.Views; |
|
using Kingo.PluginServiceInterface; |
|
using System; |
|
using UIShell.OSGi; |
|
|
|
namespace Kingo.Plugin.MapView.Services |
|
{ |
|
public class MainViewClass : IMainView<IMapsView>, IRefreshMenuStatus |
|
{ |
|
IBundleContext _context; |
|
IMapsView _view; |
|
RibbonControl _mainMenu = null; |
|
IMenuService _MenuService = null; |
|
|
|
|
|
public MainViewClass(IBundleContext context) |
|
{ |
|
_context = context; |
|
_view = new MapsViewClass(_context); |
|
DocumentView = _view.ucMapCtrl; |
|
DefaultLeftDockPanel = _view.ucDataCatalog; |
|
Hook = _view.Hook; |
|
} |
|
public IDockPanel DefaultLeftDockPanel { get; set; } |
|
public IDocumentView DocumentView { get; set; } |
|
public IDockPanel DefaultRightDockPanel { get; set; } |
|
public IDockPanel DefaultBottomDockPanel { get; set; } |
|
public IDockPanel DefaultFloatDockPanel { get; set; } |
|
public object Hook { get; set; } |
|
|
|
public void InitUI(IMapsView t) |
|
{ |
|
} |
|
|
|
public void InitUI(RibbonControl pMainMenu) |
|
{ |
|
_mainMenu = pMainMenu; |
|
_MenuService = BundleRuntime.Instance.GetFirstOrDefaultService<IMenuService>(); |
|
_MenuService.MenuItemClick += (s, e) => { |
|
if (s is ICommand) |
|
{ |
|
(s as ICommand).OnClick(); |
|
} |
|
}; |
|
} |
|
|
|
public void InitUI() |
|
{ |
|
object o = MapsManager.Instance; |
|
} |
|
|
|
public void RefreshMenuOrToolState() |
|
{ |
|
MapsManager.Instance.MapService.RefreshToolState(); |
|
RefreshMenuState(null); |
|
} |
|
public void RefreshMenuState(object currentTool) |
|
{ |
|
try |
|
{ |
|
if (_mainMenu == null) return; |
|
foreach (RibbonPage page in _mainMenu.Pages) |
|
{ |
|
foreach (RibbonPageGroup group in page.Groups) |
|
{ |
|
foreach (BarItemLink item in group.ItemLinks) |
|
{ |
|
if (item.Item.Tag is ICommand) |
|
{ |
|
item.Item.Enabled = (item.Item.Tag as ICommand).Enabled; |
|
if (item.Item is BarCheckItem) |
|
{ |
|
(item.Item as BarCheckItem).Checked = (item.Item.Tag as ICommand).Checked; |
|
|
|
if (currentTool == item.Item.Tag) |
|
{ |
|
(item.Item as BarCheckItem).Checked = true; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
} |
|
catch (Exception ex) |
|
{ |
|
//LogAPI.Debug("刷新工具条状态时发生异常,异常信息如下:"); |
|
//LogAPI.Debug(ex); |
|
//LogAPI.Debug("异常信息结束"); |
|
} |
|
} |
|
} |
|
}
|
|
|