public void SelectAppPolicy(ApplicationPolicy appPolicy)
		{
			// リスト表示を更新
			var selectedListItem = AppPolicies.SingleOrDefault(x => x.AppPolicy == appPolicy);
			if (selectedListItem != null)
			{
				SelectedAppPolicy.Value = selectedListItem;
				selectedListItem.IsSelected = true;
			}
		}
		public AppOptionListItemViewModel(ApplicationPolicy appPolicy, AppOptionDeclarationBase decl)
		{
			AppPolicy = appPolicy;
			Declaration = decl;

			AppName = AppPolicy.AppName;
			OptionName = Declaration.Name;

			PropertyNames = Declaration
				.UserProperties.Select(x => x.ValiableName)
				.ToList();
		}
		/// <summary>
		/// use ApplicationPolicy.CreateExecuteSandbox()
		/// </summary>
		/// <param name="policy"></param>
		/// <param name="param"></param>
		/// <param name="context"></param>
		internal ApplicationExecuteSandbox(ApplicationPolicy policy, AppOptionInstance[] options)
		{
			AppPolicy = policy;
			Options = options;
		}
		public void ShowAppPolicyEditPage(ApplicationPolicy appPolicy)
		{
			PageManager.OpenAppPolicy(appPolicy.Guid);

			/*
			if (AppPolicyEditVM.Value?.AppPolicy != appPolicy)
			{
				if (AppPolicyEditVM.Value != null)
				{
					ExitEdit();
				}

				SetupEdit(appPolicy);
			}
			*/
		}
		internal async void DeleteAppPolicy(ApplicationPolicy appPolicy)
		{
			var result = await ShowAppPolicyDeleteConfirmDialog();

			if (result != null && ((bool)result) == true)
			{
				AppPolicyManager.RemoveAppPolicy(appPolicy);

				
				/*
				if (AppPolicyEditVM.Value?.AppPolicy == appPolicy)
				{
					AppPolicyEditVM.Value = null;
				}
				*/
			}

		}
		// TODO: アイコン画像

		public AppPolicyListItemViewModel(AppPolicyManagePageViewModel pageVM, ApplicationPolicy appPolicy)
		{
			PageVM = pageVM;
			AppPolicy = appPolicy;

			AppName = AppPolicy.ObserveProperty(x => x.AppName)
				.ToReactiveProperty();

			IsSelected = false;
		}
		private void DeletePolicyFile(ApplicationPolicy policy)
		{
			var filepath = GetSaveFilePath(policy);

			var fileInfo = new FileInfo(filepath);

			if (fileInfo.Exists)
			{
				fileInfo.Delete();
			}
		}
		public string GetSaveFilePath(ApplicationPolicy policy)
		{
			return Path.ChangeExtension(
				Path.Combine(this.SaveFolderInfo.FullName, policy.Guid.ToString())
				, ".rfpolicy.json"
				);
		}
		public void RemoveAppPolicy(ApplicationPolicy policy)
		{
			if (_Policies.Remove(policy))
			{
				DeletePolicyFile(policy);
			}
		}
		public void AddAppPolicy(ApplicationPolicy policy)
		{
			if (_Policies.Any(x => x.Guid == policy.Guid))
			{
				throw new Exception("Already exist ApplicationPolicy name: " + policy.AppName + " guid:" + policy.Guid);
			}


			_Policies.Add(policy);

			SavePolicyFile(policy);
		}
		/// <summary>
		/// comperer ApplicationPolicy.Guid
		/// </summary>
		/// <param name="policy"></param>
		/// <returns>if same Guid ApplicationPolicy then return true.</returns>
		public bool HasAppPolicy(ApplicationPolicy policy)
		{
			return _Policies.Any(x => x.Guid == policy.Guid);
		}
		public void SavePolicyFile(ApplicationPolicy policy)
		{
			var filepath = GetSaveFilePath(policy);

			FileSerializeHelper.Save(filepath, policy);
		}
		public void RollbackFrom(ApplicationPolicy backup)
		{
			this.AppName = backup.AppName;
			this.ApplicationPath = backup.ApplicationPath;
			this.InputPathType = backup.InputPathType;
			this.MaxProcessTime = backup.MaxProcessTime;


			// AcceptExtentions
			var remExtentions = this.AcceptExtentions.ToArray();
			foreach (var ext in remExtentions)
			{
				this.RemoveAcceptExtention(ext);
			}

			foreach (var ext in backup.AcceptExtentions)
			{
				this.AddAcceptExtention(ext);
			}

			// OptionDeclaration
			var remOptionDecls = this.OptionDeclarations.ToArray();
			foreach (var remOptionDecl in remOptionDecls)
			{
				this.RemoveOptionDeclaration(remOptionDecl);
			}

			foreach (var addOptionDecl in backup.OptionDeclarations)
			{
				this._OptionDeclarations.Add(addOptionDecl);
			}

			// OptionDeclaration
			var remOutputOptionDecls = this.OutputOptionDeclarations.ToArray();
			foreach (var remOutputOptionDecl in remOutputOptionDecls)
			{
				this.RemoveOutputOptionDeclaration(remOutputOptionDecl);
			}

			foreach (var addOutputOptionDecl in backup.OutputOptionDeclarations)
			{
				this._OutputOptionDeclarations.Add(addOutputOptionDecl);
			}
		}