/// <summary> /// показать окно с алертами /// </summary> public static void ShowAlertDialog() { if (_grid == null) { CreateGrid(); } if (_ui == null) {// если наше окно не висит уже посреди экрана создаём его _ui = new AlertMessageFullUi(_grid); _ui.Show(); _ui.Closed += _ui_Closed; } }
/// <summary> /// throw new alert /// выбросить новый алерт /// </summary> /// <param name="stream">music to be played/музыка, которая будет проигрываться</param> /// <param name="botName">name of robot that threw out alert/имя робота выбросившего алерт</param> /// <param name="message"> message being created/сообщение ради которого сыр бор</param> public static void ThrowAlert(Stream stream, string botName, string message) { if (!TextBoxFromStaThread.Dispatcher.CheckAccess()) { TextBoxFromStaThread.Dispatcher.Invoke( new Action <Stream, string, string>(ThrowAlert), stream, botName, message); return; } if (_grid == null) { // if our chart is not created, we call its creation method // если наша таблица не создана, вызываем метод её создания CreateGrid(); } // add new line // добавляем новую строку DataGridViewRow row = new DataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[0].Value = DateTime.Now.ToLongTimeString(); row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[1].Value = botName; row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[2].Value = message; _grid.Rows.Insert(0, row); // turn on music // включаем музыку if (stream != null) { SoundPlayer player = new SoundPlayer(stream); player.Play(); } if (_ui == null) { // if our window is not hanging in middle of screen we create it // если наше окно не висит уже посреди экрана создаём его _ui = new AlertMessageFullUi(_grid); _ui.Show(); _ui.Closed += _ui_Closed; } }
/// <summary> /// show window with alerts /// показать окно с алертами /// </summary> public static void ShowAlertDialog() { if (_grid == null) { CreateGrid(); } if (_ui == null) { // if our window is not hanging in middle of screen we create it // если наше окно не висит уже посреди экрана создаём его _ui = new AlertMessageFullUi(_grid); _ui.Show(); _ui.Closed += _ui_Closed; } }