private UiContextMenu CreateTreeViewContextMenu()
        {
            UiContextMenu menu = UiContextMenuFactory.Create();

            {
                menu.AddChild(UiMenuItemFactory.Create(Lang.Dockable.GameFileCommander.Unpack, new UiGameFileCommanderExtractCommand(() => _treeNodes)));
                menu.AddChild(UiMenuItemFactory.Create(Lang.Dockable.GameFileCommander.Pack, new UiGameFileCommanderInjectCommand(() => _treeNodes)));
            }
            return(menu);
        }
        public static UiDataProviderNode Create <T>(InfoProviderGroup <T> providers) where T : class
        {
            UiContextMenu menu = UiContextMenuFactory.Create();

            for (int index = 0; index < providers.Count; index++)
            {
                IInfoProvider <T> provider = providers[index];
                UiMenuItem        menuItem = UiMenuItemFactory.Create(provider.Title, new UiDataProviderNodeRefreshCommand(() => providers.Refresh(provider)));
                menuItem.ToolTip = provider.Description;
                menu.AddChild(menuItem);
            }

            UiDataProviderNode node = new UiDataProviderNode(providers.Title, providers.Description, menu);

            providers.InfoLost     += node.OnInfoLost;
            providers.InfoProvided += node.OnInfoProvided;

            return(node);
        }
Exemple #3
0
        public UiMainWindow()
        {
            #region Construct

            Assembly        assembly = Assembly.GetEntryAssembly();
            FileVersionInfo fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            Title = $"{fvi.ProductName} {fvi.FileVersion} {fvi.LegalCopyright}";

            Width  = 640;
            Height = 480;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            WindowState           = WindowState.Maximized;

            UiGrid root = UiGridFactory.Create(2, 1);
            root.RowDefinitions[0].Height = GridLength.Auto;

            DockingManager dockingManager = new DockingManager();
            {
                root.AddUiElement(dockingManager, 1, 0);
                _layoutSerializer = new XmlLayoutSerializer(dockingManager);
                _layoutSerializer.LayoutSerializationCallback += OnLayoutDeserialized;
            }

            _mainMenu = UiMenuFactory.Create();
            {
                _mainMenuView = _mainMenu.AddChild(UiMenuItemFactory.Create("Вид"));
                {
                    foreach (UiMainDockableControl dockable in UiMainDockableControl.CreateKnownDockables(dockingManager))
                    {
                        _mainMenuView.AddChild(dockable.CreateMenuItem());
                    }
                }

                root.AddUiElement(_mainMenu, 0, 0);
            }

            Content = root;

            #endregion

            Loaded  += OnLoaded;
            Closing += OnClosing;
        }
Exemple #4
0
 public UiMenuItem CreateMenuItem()
 {
     return(UiMenuItemFactory.Create(Header, MenuCommand.Instance, this));
 }