/* private void Test(object state, EventArgs e) * { * string[] x = new string[8]; * x[0] = "sfas"; * x[1] = "sdfasd"; * x[2] = "sfas"; * x[3] = "sdfasd"; * x[4] = "sfas"; * x[5] = "sdfasd"; * x[6] = "sfas"; * x[7] = "sdfasd"; * _url = System.AppDomain.CurrentDomain.BaseDirectory + "Docs"; * string access = _url + "\\Test.txt"; * _plcServices.SaveCSV(x, access ); * }*/ private void ShowDialog(string message) { var view = new MessageView(); view.DataContext = _messageViewModel; _messageViewModel.Message = message; view.Show(); WDBTeufelberger model = new WDBTeufelberger(); }
private void ProgressAction(string text, Action <Action <bool> > action, bool needRefresh = false, bool cancel = true) { BlockUI?.Invoke(true); var messageView = new MessageView(); messageView.HeaderText = "Выполнение операции"; messageView.ContentText = text; messageView.Icon = Icon.Hourglass; if (cancel) { messageView.SetItems(new[] { new MessageItemInfo("Отмена", (m) => _manager.CancelOperation(_selectedController), Icon.Cancel) }); } messageView.StartAnimateProgress(); var callback = new Action <bool>((success) => { this.Dispatcher.BeginInvoke(new Action(() => { BlockUI?.Invoke(false); messageView.StopAnimateProgress(); if (!success) { messageView.Icon = Icon.Cancel; messageView.ContentText = "Операция не выполнена."; } else { messageView.Icon = Icon.Check; messageView.ContentText = "Операция выполнена успешно!"; if (needRefresh) { UpdateControllers(); } } messageView.SetItems(new[] { new MessageItemInfo("OK", (m) => messageView.Close()) }); })); }); messageView.Show(mainGrid); try { action?.Invoke(callback); } catch (Exception e) { MessageView.ShowMessage(e.Message, "Ошибка!", Icon.Bug, mainGrid); } }