Пример #1
0
		/// <summary>
		/// Executes the selected command.
		/// </summary>
		/// <param name="command">Command to execute.</param>
		private async void ExecuteCommand(WF.Player.Core.Command command)
		{
			if (command == null)
			{
				return;
			}

			// Notify user
			App.Click();

			if (command.CmdWith) 
			{
				if (command.TargetObjects.Count > 0) 
				{
					// There are one or more targets for this command
					var cfg = new ActionSheetConfig().SetTitle(command.Text);

					foreach (Thing t in command.TargetObjects)
					{
						cfg.Add(
							t.Name, 
							() => 
							{
								App.Click();
								command.Execute(t);
							});
					}

					cfg.Cancel = new ActionSheetOption(Catalog.GetString("Cancel"), App.Click);

					UserDialogs.Instance.ActionSheet(cfg);
				} 
				else 
				{
					// There are no target for this command
					await UserDialogs.Instance.AlertAsync(command.EmptyTargetListText, command.Text, Catalog.GetString("Ok"));
					App.Click();
				}
			} 
			else 
			{
				command.Execute();
			}
		}