示例#1
0
        private void MenuItemAddItem_Click(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            try
            {
                ChartLiveData selected = null;

                foreach (var chartLiveData in AllCharts)
                {
                    if (chartLiveData.IsSelected)
                    {
                        selected = chartLiveData;
                        break;
                    }
                }

                if (selected == null)
                {
                    ShowMsgOnStatusBar("First select a item");
                    return;
                }

                //TODO Parameters
                if (ItemsForCompare.Count >= 15)
                {
                    ShowMsgOnStatusBar(string.Format("Maximum number of items(={0}) for Compare is reached", 15));
                    return;
                }

                if (ItemsForCompare.IndexOf(selected) >= 0)
                {
                    ShowMsgOnStatusBar("This item already exists in Compare List");
                    return;
                }

                ItemsForCompare.Add(selected);

                MenuItem newMenuItem = new MenuItem();
                newMenuItem.Header = selected.ItemsAioViewModel.ItemName;

                MenuItem newContextMenuItem = new MenuItem();
                newContextMenuItem.Header = selected.ItemsAioViewModel.ItemName;

                MenuItemItems.Items.Add(newMenuItem);
                ContextMenuItemItems.Items.Add(newContextMenuItem);
                MenuItemClearItems.IsEnabled        = true;
                ContextMenuItemClearItems.IsEnabled = true;
            }
            catch (Exception ex)
            {
                Logger.LogIndustrialMonitoring(ex);
            }
        }
示例#2
0
        private void OpenWindowsCharthistory(ChartType chartType)
        {
            try
            {
                ChartLiveData selected = null;

                foreach (var chartLiveData in AllCharts)
                {
                    if (chartLiveData.IsSelected)
                    {
                        selected = chartLiveData;
                        break;
                    }
                }

                if (selected == null)
                {
                    ShowMsgOnStatusBar("First select a item");
                    return;
                }


                Dictionary <int, int> dictionary = new Dictionary <int, int>();
                dictionary.Add(0, selected.ItemsAioViewModel.ItemId);
                WindowChartHistory windowChartHistory = new WindowChartHistory();
                windowChartHistory.ProcessDataServiceClient = this.ProcessDataServiceClient;
                windowChartHistory.ItemsId = dictionary;

                // TODO Parameter
                windowChartHistory.StartTime = DateTime.Now - new TimeSpan(0, 24, 0, 0);

                // TODO Parameter
                windowChartHistory.EndTime   = DateTime.Now;
                windowChartHistory.ChartType = chartType;

                windowChartHistory.Show();
                windowChartHistory.ShowData();
            }
            catch (Exception ex)
            {
                Logger.LogIndustrialMonitoring(ex);
            }
        }
示例#3
0
        private void MenuItemGrid_OnClick(object sender, RadRoutedEventArgs e)
        {
            try
            {
                ChartLiveData selected = null;

                foreach (var chartLiveData in AllCharts)
                {
                    if (chartLiveData.IsSelected)
                    {
                        selected = chartLiveData;
                        break;
                    }
                }

                if (selected == null)
                {
                    ShowMsgOnStatusBar("First select a item");
                    return;
                }

                WindowGridHistory windowChartHistory = new WindowGridHistory();
                windowChartHistory.ProcessDataServiceClient = this.ProcessDataServiceClient;
                windowChartHistory.ItemId = selected.ItemsAioViewModel.ItemId;

                // TODO Parameter
                windowChartHistory.StartTime = DateTime.Now - new TimeSpan(0, 24, 0, 0);

                // TODO Parameter
                windowChartHistory.EndTime = DateTime.Now;

                windowChartHistory.Show();
                windowChartHistory.ShowData();
            }
            catch (Exception ex)
            {
                Logger.LogIndustrialMonitoring(ex);
            }
        }
示例#4
0
        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);
            }
        }