private void CheckNotifications(object state) { try { Dispatcher.BeginInvoke(new Action(() => { bool hastNotification = NotificationServiceClient.SystemHasNotification(Lib.Static.CurrentUser.UserId); if (hastNotification) { horn.Start(); List <string> tabs = NotificationServiceClient.TabsWithActiveNotification(Lib.Static.CurrentUser.UserId); foreach (var item in TabControlIOs.Items) { RadTabItem tabItem = (RadTabItem)item; TabHeaderUserControl tabHeader = (TabHeaderUserControl)tabItem.Header; string header = tabHeader.GetHeader(); if (tabs.Any(x => x.Equals(header))) { tabHeader.ShowAlarmAnimation(); } else { tabHeader.HideAlarmAnimation(); } } BlackAllTabs = true; } else { horn.Stop(); if (BlackAllTabs) { foreach (var item in TabControlIOs.Items) { RadTabItem tabItem = (RadTabItem)item; TabHeaderUserControl tabHeader = (TabHeaderUserControl)tabItem.Header; tabHeader.HideAlarmAnimation(); } BlackAllTabs = false; } } })); } catch (Exception ex) { Logger.LogIndustrialMonitoring(ex); } }
private void GenerateTab(Tab1 tabsViewModel) { try { Tab1 model = tabsViewModel; var items = ProcessDataServiceClient.GetItemsForTab(model.TabId); RadTabItem radTabItem = new RadTabItem(); radTabItem.Name = string.Format("TabItem{0}", tabsViewModel.TabName).Replace(" ", ""); radTabItem.MinWidth = 80; radTabItem.Height = 25; TabHeaderUserControl tabHeader = new TabHeaderUserControl(); tabHeader.SetHeader(tabsViewModel.TabName); radTabItem.Header = tabHeader; radTabItem.HorizontalContentAlignment = HorizontalAlignment.Center; radTabItem.VerticalContentAlignment = VerticalAlignment.Center; WrapPanel wrapPanel = new WrapPanel(); wrapPanel.Name = string.Format("WrapPanel{0}", tabsViewModel.TabName).Replace(" ", ""); ScrollViewer scrollViewer = new ScrollViewer(); scrollViewer.Name = string.Format("ScrollViewer{0}", tabsViewModel.TabName).Replace(" ", ""); scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = wrapPanel; radTabItem.Content = scrollViewer; TabControlIOs.Items.Add(radTabItem); foreach (var itemsAioViewModel in items) { if (!UserServiceClient.CheckPermission(Lib.Static.CurrentUser.UserId, itemsAioViewModel.ItemId)) { continue; } ChartLiveData chartLiveData = new ChartLiveData(); chartLiveData.ItemsAioViewModel = itemsAioViewModel; chartLiveData.ProcessDataServiceClient = this.ProcessDataServiceClient; chartLiveData.NotificationServiceClient = this.NotificationServiceClient; chartLiveData.MouseDoubleClick += chartLiveData_MouseDoubleClick; // TODO Parameter //chartLiveData.Width = 280; // TODO Parameter chartLiveData.Height = 200; // TODO Parameter chartLiveData.Margin = new Thickness(4, 2, 4, 2); wrapPanel.Children.Add(chartLiveData); AllCharts.Add(chartLiveData); chartLiveData.Start(); } } catch (Exception ex) { Logger.LogIndustrialMonitoring(ex); } }