123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using OpenSEMI.ClientBase;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- namespace FurnaceUI.Views.Recipes
- {
- public class RecipePermissionSelectViewModel: DialogViewModel<string>
- {
- public RecipePermissionSelectViewModel(string DialogName="",string permission="", string comment = "")
- {
- this.DisplayName = DialogName;
- this.Comment = comment;
- switch(permission)
- {
- case "Read":
- CurrentPermission = 0;
- break;
- case "Read&Write":
- CurrentPermission = 1;
- break;
- case "Free":
- CurrentPermission = 2;
- break;
- default:
- CurrentPermission = 2;
- break;
- }
- }
- public ObservableCollection<string> permissionselections { get; set; }
- private int CurrentPermission;
- private string _comment;
- public string Comment
- {
- get
- {
- return _comment;
- }
- set
- {
- _comment = value;
- NotifyOfPropertyChange(nameof(Comment));
- }
- }
- private int _selectedPermission;
- public int SelectedPermission
- {
- get
- {
- return _selectedPermission;
- }
- set
- {
- _selectedPermission = value;
- NotifyOfPropertyChange(nameof(SelectedPermission));
- }
- }
- public string RecipePermission { get; set; }
- public string RecipeComment { get; set; }
- public string Dialogname { get; set; }
- protected override void OnInitialize()
- {
- base.OnInitialize();
-
- permissionselections = new ObservableCollection<string>() { "Read", "Read&Write","Free" };
- if (string.IsNullOrEmpty(CurrentPermission.ToString()))
- SelectedPermission = 2;
- else
- SelectedPermission = CurrentPermission;
- }
- protected override void OnActivate()
- {
- base.OnActivate();
-
- }
- public void OK()
- {
-
- RecipePermissionSelectView recipePermissionSelectView = ((Window)GetView()).Content as RecipePermissionSelectView;
- //RecipePermission = recipePermissionSelectView.cbPermission.Text;
- RecipePermission = "";
- RecipeComment = recipePermissionSelectView.tbComment.Text;
- IsCancel = false;
- TryClose(true);
- }
- public void Cancel()
- {
- IsCancel = true;
- TryClose(false);
- }
- }
- }
|