Esempio n. 1
0
        public ListViewPanel CreateDataViewPanel(DBDataProvider dataProvider, ConfigEntry entry, bool showList = true)
        {
            string deviceKey   = entry.DeviceKey;
            string displayName = entry.DisplayName;

            if (this.panelDict.ContainsKey(deviceKey))
            {
                ListViewPanel panel = this.panelDict[deviceKey];
                if (this.currentPanel != panel)
                {
                    this.currentPanel.Visibility = Visibility.Hidden;
                }
                panel.Visibility  = Visibility.Visible;
                this.currentPanel = panel;
                return(panel);
            }
            else
            {
                // !
                ListViewPanel panel        = new ListViewPanel(dataProvider, entry);
                DataListener  dataListener = dataProvider.GetDataListener(deviceKey);
                panel.SetIcon(entry.Icon);
                panel.AddDataListener(dataListener);
                if (showList)
                {
                    panel.ListView        = this.ShowListView(panel, dataListener);
                    panel.SearchView      = this.ShowListView(panel, dataListener);
                    panel.GraphView       = this.ShowGraphView(panel, dataListener);
                    panel.GraphSearchView = this.ShowSearchGraphView(panel, dataListener);

                    // Notice; Comment 4-7.
                    // panel.ListRecentData();
                    // 是否显示 控制面板
                    if (deviceKey == DataProvider.DeviceKey_MDS)
                    {
                        panel.ControlPanel = this.ShowControlView(DataProvider.DeviceKey_MDS);
                    }
                    else if (deviceKey == DataProvider.DeviceKey_AIS)
                    {
                        panel.ControlPanel = this.ShowControlView(DataProvider.DeviceKey_AIS);
                    }
                    else if (deviceKey == DataProvider.DeviceKey_NaI)
                    {
                        panel.SetupContextMenu((ListView)panel.ListView);
                        panel.SetupContextMenu((ListView)panel.SearchView);
                        panel.EnergyPanel = this.ShowEnergyView(DataProvider.DeviceKey_NaI);
                    }
                }

                if (this.currentPanel != null)
                {
                    this.currentPanel.Visibility = Visibility.Hidden;
                }
                this.currentPanel = panel;

                this.panelDict.Add(deviceKey, panel);
                return(panel);
            }
        }
Esempio n. 2
0
        public ListViewPanel CreateDataViewPanel(DBDataProvider dataProvider, ConfigEntry entry, bool showList = true)
        {
            string deviceKey   = entry.DeviceKey;
            string displayName = entry.DisplayName;

            if (this.panelDict.ContainsKey(deviceKey))
            {
                ListViewPanel panel = this.panelDict[deviceKey];
                if (this.currentPanel != panel)
                {
                    this.currentPanel.Visibility = Visibility.Hidden;
                }
                panel.Visibility  = Visibility.Visible;
                this.currentPanel = panel;
                return(panel);
            }
            else
            {
                // !
                ListViewPanel panel        = new ListViewPanel(dataProvider, entry);
                DataListener  dataListener = dataProvider.GetDataListener(deviceKey);
                panel.SetIcon(entry.Icon);
                panel.AddDataListener(dataListener);
                if (showList)
                {
                    panel.ListView   = this.ShowListView(panel, dataListener);
                    panel.SearchView = this.ShowListView(panel, dataListener);

                    if (deviceKey != DataProvider.DeviceKey_Dwd && deviceKey != DataProvider.DeviceKey_Shelter)
                    {
                        panel.HasSerachDataChart = true;
                        if (deviceKey == DataProvider.DeviceKey_Hpic)
                        {
                            panel.GraphSearchView = this.ShowSearchHpicGraphView(panel, dataListener);
                        }
                        else
                        {
                            panel.GraphSearchView = this.ShowSearchGraphView(panel, dataListener);
                        }
                    }

                    if (deviceKey == DataProvider.DeviceKey_MDS)
                    {
                        panel.HasRealTimeChart = true;
                        panel.GraphView        = this.ShowGraphView(panel, dataListener);
                        panel.selectedField    = "flow";
                        panel.ControlPanel     = this.ShowControlView(DataProvider.DeviceKey_MDS);
                        panel.SttPanel         = this.ShowSttView(DataProvider.DeviceKey_MDS);
                    }
                    else if (deviceKey == DataProvider.DeviceKey_AIS)
                    {
                        panel.HasRealTimeChart = true;
                        panel.GraphView        = this.ShowGraphView(panel, dataListener);
                        panel.selectedField    = "flow";
                        panel.ControlPanel     = this.ShowControlView(DataProvider.DeviceKey_AIS);
                        panel.SttPanel         = this.ShowSttView(DataProvider.DeviceKey_AIS);
                    }
                    else if (deviceKey == DataProvider.DeviceKey_Weather)
                    {
                        panel.FieldSelect.Visibility    = Visibility.Visible;
                        panel.FieldSelect.SelectedIndex = 0;
                        panel.selectedField             = "temperature";
                    }
                    else if (deviceKey == DataProvider.DeviceKey_Hpic)
                    {
                        // panel.IntervalSelect.Visibility = Visibility.Visible;
                        panel.IntervalSelect.SelectedIndex = 0;
                        panel.selectedField = "doserate";
                    }
                    else if (deviceKey == DataProvider.DeviceKey_NaI)
                    {
                        panel.SetupContextMenu((ListView)panel.ListView);
                        panel.SetupContextMenu((ListView)panel.SearchView);
                        panel.EnergyPanel   = this.ShowEnergyView(DataProvider.DeviceKey_NaI);
                        panel.selectedField = "doserate";
                    }
                    else if (deviceKey == DataProvider.DeviceKey_Shelter)
                    {
                        panel.DoorPanel = this.ShowDoorView();
                    }
                }

                if (this.currentPanel != null)
                {
                    this.currentPanel.Visibility = Visibility.Hidden;
                }
                this.currentPanel = panel;

                this.panelDict.Add(deviceKey, panel);
                return(panel);
            }
        }