コード例 #1
0
ファイル: UiMenuItemFactory.cs プロジェクト: kidaa/Pulse
        public static UiMenuItem Create(string title, ICommand command = null, object commandParameter = null)
        {
            Exceptions.CheckArgumentNullOrEmprty(title, "title");

            UiMenuItem menuItem = new UiMenuItem {Header = title, Command = command, CommandParameter = commandParameter};

            return menuItem;
        }
コード例 #2
0
        public static UiMenuItem Create(string title, ICommand command = null, object commandParameter = null)
        {
            Exceptions.CheckArgumentNullOrEmprty(title, "title");

            UiMenuItem menuItem = new UiMenuItem {
                Header = title, Command = command, CommandParameter = commandParameter
            };

            return(menuItem);
        }
コード例 #3
0
        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);
        }
コード例 #4
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;
        }
コード例 #5
0
ファイル: UiMainWindow.cs プロジェクト: kidaa/Pulse
        public UiMainWindow()
        {
            #region Construct

            Assembly assembly = Assembly.GetEntryAssembly();
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
            Title = String.Format("{0} {1} {2}", 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;
        }
コード例 #6
0
ファイル: UiContextMenu.cs プロジェクト: kidaa/Pulse
 public UiMenuItem AddChild(UiMenuItem item)
 {
     Exceptions.CheckArgumentNull(item, "item");
     Items.Add(item);
     return item;
 }
コード例 #7
0
 public UiMenuItem AddChild(UiMenuItem item)
 {
     Exceptions.CheckArgumentNull(item, "item");
     Items.Add(item);
     return(item);
 }