AiButtonCommand gekoppelt durch Factory an: TestVersion > ModuleAiEnabled > UserPermission
This commit is contained in:
@@ -13,12 +13,22 @@ namespace BeWo.Core.Commands
|
||||
// new DelegateCommand(OpenAiWindow, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView) && !ViewModel.IsNew)
|
||||
public static DelegateCommand GetAiViewCommand(Action openView, UserRightType userRightType, Func<bool> additionalCheckup = null)
|
||||
{
|
||||
Func<UserRightType, bool> checkup = (right) => BeWoApp.AppSettings.ModuleAiEnabled && BeWoApp.HasLoggedOnUserRight(right);
|
||||
Func<bool> checkup1 = () => BeWoApp.AppSettings.ModuleAiEnabled;
|
||||
Func<UserRightType, bool> checkup2 = (right) => BeWoApp.HasLoggedOnUserRight(right);
|
||||
|
||||
Func<UserRightType, bool> checkup = (right) => CheckupTestVersion() && checkup1() && checkup2(right);
|
||||
|
||||
if (additionalCheckup == null)
|
||||
return new DelegateCommand(openView, () => checkup(userRightType));
|
||||
return new DelegateCommand(openView, () => checkup(userRightType), false);
|
||||
else
|
||||
return new DelegateCommand(openView, () => checkup(userRightType) && additionalCheckup());
|
||||
return new DelegateCommand(openView, () => checkup(userRightType) && additionalCheckup(), false);
|
||||
}
|
||||
|
||||
private static bool CheckupTestVersion()
|
||||
{
|
||||
var version = BeWoApp.Version.Split(' ');
|
||||
var test_string = version[version.Length - 1].ToLower();
|
||||
return test_string == "test";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@
|
||||
<Button
|
||||
Margin="3"
|
||||
HorizontalAlignment="Stretch"
|
||||
Command="{Binding Path=OpenAiWindowCommand, RelativeSource={RelativeSource AncestorType={x:Type localView:BeWoView}}}">
|
||||
Command="{Binding Path=OpenAiPopupCommand, RelativeSource={RelativeSource AncestorType={x:Type localView:BeWoView}}}">
|
||||
AI Chat Popup
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
Reference in New Issue
Block a user