using Prism.Commands;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media;
using Team.FFFeederService;
using Team.FFFeederService.Interfaces;
using TeamAAS_VP.Controls;
using TeamAAS_VP.Core;
using TeamAAS_VP.Interfaces;
namespace TeamAAS_VP.ViewModels.DebugMod
{
public class VisionSolutionViewModel : BindableBase, IConfirmNavigationRequest
{
IContainerProvider _container;
ISystemDatabaseService _systemDatabaseService;
private DelegateCommand _LoadedCommand;
public DelegateCommand LoadedCommand =>
_LoadedCommand ?? (_LoadedCommand = new DelegateCommand(ExecuteLoadedCommand));
public VisionSolutionViewModel(IContainerProvider container, ISystemDatabaseService systemDatabaseService)
{
_container = container;
_systemDatabaseService = systemDatabaseService;
}
void ExecuteLoadedCommand()
{
try
{
if (_systemDatabaseService.GetCurrentUser().userPart == Enums.UserPart.Operator)
{
IsAllowEdit = false;
}
else
{
IsAllowEdit = true;
}
}
catch (Exception)
{
}
}
#region 继承
///
/// 确认导航请求时调用。此方法允许您在导航之前执行一些操作。
///
///
///
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action continuationCallback)
{
continuationCallback(true);
}
///
/// 接收导航请求时调用。传入导航参数,包含有关导航目标的信息。
///
///
///
public async void OnNavigatedTo(NavigationContext navigationContext)
{
}
///
/// 是否允许导航到此视图模型。
///
///
///
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return true;
}
///
/// 导航离开此视图模型时调用。您可以在此处执行清理操作或保存状态。
///
///
public void OnNavigatedFrom(NavigationContext navigationContext)
{
}
#endregion
private bool _IsAllowEdit = false;
public bool IsAllowEdit
{
get { return _IsAllowEdit; }
set { SetProperty(ref _IsAllowEdit, value); }
}
private void LoginChange(Models.User user)
{
if (user.userPart == Enums.UserPart.Operator)
{
IsAllowEdit = false;
}
else
{
IsAllowEdit = true;
}
}
}
}