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)));
            }
        }
Esempio 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);
 }
Esempio 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;
    }
Esempio 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)));
 }
Esempio 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);
     }
 }
Esempio 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();
         }
     }
 }
Esempio n. 7
0
 private void OnAssistantStateChanged(AssistantState state)
 {
     _assistantState = state;
     UpdateButtonText(state);
 }