private void UpdateButtonText(AssistantState state)
        {
            if (ButtonRecord.Dispatcher.CheckAccess())
            {
                switch (state)
                {
                case AssistantState.Listening:
                    ButtonRecordIcon.Text = "\xF12E";
                    ButtonRecordText.Text = state.ToString();
                    break;

                case AssistantState.Processing:
                    ButtonRecordIcon.Text = "\xE9F5";
                    ButtonRecordText.Text = state.ToString();
                    break;

                case AssistantState.Speaking:
                    ButtonRecordIcon.Text = "\xF5B0";
                    ButtonRecordText.Text = state.ToString();
                    break;

                case AssistantState.Inactive:
                    ButtonRecordIcon.Text = "\xE720";
                    ButtonRecordText.Text = "Press";
                    break;
                }
            }
            else
            {
                ButtonRecord.Dispatcher.BeginInvoke(new Action(() => UpdateButtonText(state)));
            }
        }
Ejemplo n.º 2
0
 public Assistant(Shop shop, EventHandler shopEvents)
 {
     Id              = idCount++;
     this.shop       = shop;
     this.shopEvents = shopEvents;
     state           = AssistantState.Waiting;
     shop.Subscribe <Shop.CustomerEnter>(CustomerWalkin);
 }
Ejemplo n.º 3
0
    private IEnumerator ChangeState(AssistantState newState, float delay)
    {
        CR_running = true;
        yield return(new WaitForSeconds(delay));

        activated    = false;
        currentState = newState;
        CR_running   = false;
    }
Ejemplo n.º 4
0
 private void UpdateButtonText(AssistantState state)
 {
     if (ButtonRecord.Dispatcher.CheckAccess())
     {
         ButtonRecord.Content = state == AssistantState.Inactive ? "Press" : state.ToString();
     }
     //else
     //ButtonRecord.Dispatcher.BeginInvoke(new Action(() => UpdateButtonText(state)));
 }
Ejemplo n.º 5
0
 private void FinishedTreating()
 {
     lock (stateLock) {
         currentCustomer.Ready();
         state = AssistantState.Waiting;
         shopEvents.Trigger <Shop.FinishedTreating>(currentCustomer);
         currentCustomer = null;
         shopEvents.Trigger <Shop.AssistantVacancy>(this);
     }
 }
Ejemplo n.º 6
0
 public void AssignCustomer(Customer customer)
 {
     lock (stateLock) {
         if (customer != null && state == AssistantState.Waiting && customer.Treat())
         {
             currentCustomer = customer;
             state           = AssistantState.TreatingCustomer;
             var thread = new Thread(TreatCustomer);
             thread.Start();
         }
     }
 }
Ejemplo n.º 7
0
 private void OnAssistantStateChanged(AssistantState state)
 {
     _assistantState = state;
     UpdateButtonText(state);
 }