private void InitializeRPMenuToolbarCommands() { _VMRPMenuToolbar.ChangeSubstationTemplate = new Command(p1 => _mainBlockViewModel.CreateSubstation(SubstationLibrary.GetTemplate(ShowTemplateLibrary())), p2 => Wrapper.True()); _VMRPMenuToolbar.ShowProjectManager = new Command(p1 => ShowProjectManager(), p2 => Wrapper.True()); _VMRPMenuToolbar.Rebuild = new Command(p1 => RebuildComposite(), p2 => true); _VMRPMenuToolbar.ChangeSubstationVisibility = _commonData.ProductType == ProductType.Continent_KTP ? Visibility.Visible : Visibility.Collapsed; _VMRPMenuToolbar.ShowProjectManagerVisibility = _commonData.ProductType != ProductType.NA ? Visibility.Visible : Visibility.Collapsed; _VMRPMenuToolbar.CreateViewBMZ = new Command(p1 => AddDrawView(), p2 => Wrapper.True()); }
public void SubstationContextMenu() { var contextMenu = new ContextMenu(); var showInfoMenu = new MenuItem { Header = "Просмотреть описание шаблона" }; showInfoMenu.Click += delegate { if (_controlsCollection.Any(x => x is SubstationBlock)) { var subData = ((SubstationBlock)_controlsCollection.First(x => x is SubstationBlock)).SubstationData; Wrapper.ShowNotify($"{ subData.Header }\n{ subData.Description }", Constants.AppName); } }; var changeTemplateMenu = new MenuItem { Header = "Сменить шаблон КТП" }; changeTemplateMenu.Click += new RoutedEventHandler((sender, e) => CreateSubstation(SubstationLibrary.GetTemplate(ShowTemplateLibrary()))); var RUVN_FileLoadMenu = new MenuItem { Header = "Загрузить конфигурацию РУВН" }; RUVN_FileLoadMenu.Click += delegate { FileLoad(Handler.RUVN, null); MainDataParsing(_iCommonData.RUVN_GetCommonData(), AreaType.HighVoltage); }; var RUNN_FileLoadMenu = new MenuItem { Header = "Загрузить конфигурацию РУНН" }; RUNN_FileLoadMenu.Click += delegate { FileLoad(Handler.RUNN, null); MainDataParsing(_iCommonData.RUVN_GetCommonData(), AreaType.LowVoltage); }; contextMenu.Items.Add(showInfoMenu); contextMenu.Items.Add(changeTemplateMenu); contextMenu.Items.Add(new Separator()); contextMenu.Items.Add(RUVN_FileLoadMenu); contextMenu.Items.Add(RUNN_FileLoadMenu); contextMenu.IsOpen = true; }