1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using PDF_Office.EventAggregators;
- using Prism.Commands;
- using Prism.Events;
- using Prism.Mvvm;
- using Prism.Regions;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Controls;
- namespace PDF_Office.ViewModels.EditTools.Background
- {
- public class BackgroundCreateBaseContentViewModel : BindableBase, INavigationAware
- {
- IEventAggregator eventAggregator;
- IRegionManager backgroundCreateRegion;
- private string backgroundCreateRegionName;
- public string BackgroundCreateRegionName
- {
- get => backgroundCreateRegionName;
- set => SetProperty(ref backgroundCreateRegionName, value);
- }
- private string _currentCreateName;
- public string CurrentCreateName
- {
- get => _currentCreateName;
- set=>_currentCreateName= value;
- }
- private System.Windows.Visibility backgroundCreateVisible;
- public System.Windows.Visibility BackgroundCreateVisible
- {
- get => backgroundCreateVisible;
- set => SetProperty(ref backgroundCreateVisible, value);
- }
- public DelegateCommand<object> ChangeCreateModCommand { get; set; }
- public DelegateCommand EnterTemplateListCommand { get; set; }
- public BackgroundCreateBaseContentViewModel(IRegionManager regionManager,IEventAggregator eventAggregator)
- {
- this.eventAggregator = eventAggregator;
- this.backgroundCreateRegion = regionManager;
- BackgroundCreateRegionName = Guid.NewGuid().ToString();
- ChangeCreateModCommand = new DelegateCommand<object>(ChangeCreateMod);
- EnterTemplateListCommand = new DelegateCommand(EnterTemplateList);
- EnterSelectedCreateMod("BackgroundCreateColorContent");
- }
- public void EnterTemplateList()
- {
- this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(EnumTemplateListOrCreate.StatusTemplate);
- }
- public void EnterSelectedCreateMod(string currentCreateName)
- {
- backgroundCreateRegion.RequestNavigate(BackgroundCreateRegionName, currentCreateName);
- backgroundCreateVisible = System.Windows.Visibility.Visible;
- }
- public void ChangeCreateMod(object e)
- {
- var args = e as Button;
- if (args != null)
- {
- CurrentCreateName = args.Name;
- EnterSelectedCreateMod(CurrentCreateName);
- }
- }
- public bool IsNavigationTarget(NavigationContext navigationContext)
- {
- return true;
- }
- public void OnNavigatedFrom(NavigationContext navigationContext)
- {
- }
- public void OnNavigatedTo(NavigationContext navigationContext)
- {
- }
- }
- }
|