Esempio n. 1
0
 private void toolPanel_OnButtonPressed(object sender, ToolPanelEventArgs e)
 {
     try
     {
         switch (e.Button)
         {
             case ToolPanelButton.Play:
                 {
                     if (visualsCtrl.CurrentVisualizer.State == VisualizerState.Stopped)
                         visualsCtrl.CurrentVisualizer.Run();
                     else if (visualsCtrl.CurrentVisualizer.State == VisualizerState.Paused)
                         visualsCtrl.CurrentVisualizer.Continue();
                     else
                         throw new InvalidOperationException("Неизветный контекст нажатия кнопки Play");
                     break;
                 }
             case ToolPanelButton.Pause:
                 {
                     visualsCtrl.CurrentVisualizer.Pause();
                     break;
                 }
             case ToolPanelButton.Step:
                 {
                     visualsCtrl.CurrentVisualizer.Step();
                     break;
                 }
             case ToolPanelButton.Stop:
                 {
                     visualsCtrl.CurrentVisualizer.Stop();
                     break;
                 }
         }
     }
     catch(Exception ex)
     {
         e.Success = false;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Генерирует соытие нажатой кнопки.
 /// </summary>
 /// <param name="btn">Кнопка.</param>
 private void DispatchClick(ToolPanelButton btn)
 {
     if (OnButtonPressed != null)
     {
         ToolPanelEventArgs args = new ToolPanelEventArgs(btn);
         OnButtonPressed(this, args);
     }
 }