Exemplo n.º 1
0
        private async void _apply_Click(object sender, RoutedEventArgs e)
        {
            if (_imagePreview.Source != null)
            {
                DemoAction action = _actions.SelectedItem as DemoAction;
                if (action != null)
                {
                    ClearLog();
                    _status.Text = "Start demo action " + action.Title + "...";
                    try
                    {
                        string resp = await action.Act(_imageInput.Text);

                        Log(resp);
                    }
                    catch (Exception ex)
                    {
                        Log(ex.StackTrace);
                    }
                    _status.Text = "End demo action " + action.Title;
                }
            }
            else
            {
                Log("Please provide a valid image");
            }
        }
 /// <summary>
 /// Inspector access - starts all actions
 /// </summary>
 public void OnClick_StartActions()
 {
     for (var a = 0; a < actions.Count; a++)
     {
         Lairinus.UI.ActionSlotUI actionSlot = actionSlots[a];
         DemoAction action = actions[a];
         TryStartAction(actionSlot, action);
     }
 }
 private void UpdateActionSlots()
 {
     for (var a = 0; a < actions.Count; a++)
     {
         DemoAction action = actions[a];
         if (a < actionSlots.Count)
         {
             if (actionSlots[a] != null)
             {
                 actionSlots[a].UpdateActionSlot(true);
             }
         }
     }
 }
    private void TryStartAction(Lairinus.UI.ActionSlotUI actionSlot, DemoAction action)
    {
        if (actionSlot != null)
        {
            if (!actionSlot.isEnabled)
            {
                return;
            }
        }

        if (action != null)
        {
            action.UseAction();
        }
    }