Ejemplo 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);
            }
        }
Ejemplo 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);
                    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;
            }
		}
Ejemplo n.º 3
0
 internal UserControl CreatePage(string name, DBDataProvider dataProvider)
 {
     if (name == PanelManager.StationIntroduction)
     {
         return(new StationInfoPage());
     }
     else if (name == PanelManager.CurrentCommStatus)
     {
         return(new CommStatusPage());
     }
     else if (name == PanelManager.HistoryCommStatus)
     {
         return(new CommStatusPage2());
     }
     else if (name == PanelManager.DataCounter)
     {
         return(new DataCounterPane());
     }
     else if (name == PanelManager.CinderellaRunStatus)
     {
         this.cinderellaPage = new CinderellaPage();
         this.cinderellaPage.SetDataProvider(dataProvider);
         return(this.cinderellaPage);
     }
     else if (name == PanelManager.DevicesRunStatus)
     {
         if (!Settings.Instance.IsCAS)
         {
             AllDevicesPage page = new AllDevicesPage();
             page.SetDataProvider(dataProvider);
             return(page);
         }
         else
         {
             AllDevicesPage2 page = new AllDevicesPage2();
             page.SetDataProvider(dataProvider);
             return(page);
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
 public void SetDataProvider(DBDataProvider dataProvider)
 {
     this.dataProvider = dataProvider;
 }
Ejemplo n.º 5
0
 public void SetDataProvider(DBDataProvider dataProvider)
 {
     this.dataProvider = dataProvider;
 }
Ejemplo n.º 6
0
 internal UserControl CreatePage(string name, DBDataProvider dataProvider)
 {
     if (name == PanelManager.StationIntroduction)
     {
         return new StationInfoPage();
     }
     else if (name == PanelManager.CurrentCommStatus)
     {
         return new CommStatusPage();
     }
     else if (name == PanelManager.HistoryCommStatus)
     {
         return new CommStatusPage2();
     }
     else if (name == PanelManager.DataCounter)
     {
         return new DataCounterPane();
     }
     else if (name == PanelManager.CinderellaRunStatus)
     {
         this.cinderellaPage = new CinderellaPage();
         this.cinderellaPage.SetDataProvider(dataProvider);
         return this.cinderellaPage;
     }
     else if (name == PanelManager.DevicesRunStatus)
     {
         if (!Settings.Instance.IsCAS)
         {
             AllDevicesPage page = new AllDevicesPage();
             page.SetDataProvider(dataProvider);
             return page;
         }
         else
         {
             AllDevicesPage2 page = new AllDevicesPage2();
             page.SetDataProvider(dataProvider);
             return page;
         }
     }
     return null;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="displayName">Display Name</param>
        /// <param name="interval">In Seconds</param>
        public ListViewPanel(DBDataProvider dataProvider, ConfigEntry entry)
        {
            InitializeComponent();
            this.deviceKey = entry.DeviceKey;
            this.DisplayName = entry.DisplayName;
            this.dataProvider = dataProvider;

            this.dbConn = this.dataProvider.GetMySqlConnection();

            var dbCmd = this.dbConn.CreateCommand();
            var dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick += (s, evt) =>
            {
                if (this.Shown && this.deviceKey != currentDeviceKey)
                {
                    currentDeviceKey = this.deviceKey;
                    this.ListRecentData(dbCmd);
                }
            };
            dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
            dispatcherTimer.Start();

        }
Ejemplo n.º 8
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);
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Load data Provider, and would set the provider into every ListViewPanel instance.
 /// </summary>
 private void LoadDataProvider()
 {
     DBDataProvider.Instance = new DBDataProvider();
     this.dataProvider       = DBDataProvider.Instance;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Load data Provider, and would set the provider into every ListViewPanel instance.
        /// </summary>
		private void LoadDataProvider()
		{
            DBDataProvider.Instance = new DBDataProvider();
            this.dataProvider = DBDataProvider.Instance;
		}