Ejemplo n.º 1
0
 public static DEVICECATEGORY GetDeviceCategoryByDeviceName(STATIONNAME StationName, DEVICENAME DeviceName)
 {
     if (KeeperData != null)
     {
         StationHandler ThisSite = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);
         if (ThisSite != null)
         {
             return(ThisSite.GetDeviceCategoryByDeviceName(DeviceName));
         }
     }
     return(DEVICECATEGORY.NULL);
 }
Ejemplo n.º 2
0
        public static void SetActiveDevice(String ActiveDeviceNameStr)
        {
            UIHandler.ActiveDeviceNameStr = ActiveDeviceNameStr;
            DeviceGrid.Rows.Clear();

            StationHandler ThisStation = AstroData.KeeperData.FirstOrDefault(Item => Item.StationName == ActiveStation);
            DEVICENAME     ThisDevice  = Enum.GetValues(typeof(DEVICENAME)).Cast <DEVICENAME>().ToList().FirstOrDefault(Item => Item.ToString() == ActiveDeviceNameStr);
            DEVICECATEGORY DeviceName  = ThisStation.GetDeviceCategoryByDeviceName(ThisDevice);

            switch (DeviceName)
            {
            case DEVICECATEGORY.TS700MM:
                ConcurrentDictionary <TS700MM, INFORMATIONSTRUCT> TS700MMObject = (ConcurrentDictionary <TS700MM, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in TS700MMObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.ASTROHEVENDOME:
                ConcurrentDictionary <ASTROHEVENDOME, INFORMATIONSTRUCT> ASTROHEVENDOMEObject = (ConcurrentDictionary <ASTROHEVENDOME, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in ASTROHEVENDOMEObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.IMAGING:
                ConcurrentDictionary <IMAGING, INFORMATIONSTRUCT> IMAGINGObject = (ConcurrentDictionary <IMAGING, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in IMAGINGObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.SQM:
                ConcurrentDictionary <SQM, INFORMATIONSTRUCT> SQMObject = (ConcurrentDictionary <SQM, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in SQMObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.SEEING:
                ConcurrentDictionary <SEEING, INFORMATIONSTRUCT> SEEINGObject = (ConcurrentDictionary <SEEING, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in SEEINGObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.ALLSKY:
                ConcurrentDictionary <ALLSKY, INFORMATIONSTRUCT> ALLSKYObject = (ConcurrentDictionary <ALLSKY, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in ALLSKYObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.WEATHERSTATION:
                ConcurrentDictionary <WEATHERSTATION, INFORMATIONSTRUCT> WEATHERSTATIONObject = (ConcurrentDictionary <WEATHERSTATION, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in WEATHERSTATIONObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.LANOUTLET:
                ConcurrentDictionary <LANOUTLET, INFORMATIONSTRUCT> LANOUTLETObject = (ConcurrentDictionary <LANOUTLET, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in LANOUTLETObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.CCTV:
                ConcurrentDictionary <CCTV, INFORMATIONSTRUCT> CCTVObject = (ConcurrentDictionary <CCTV, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in CCTVObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.GPS:
                ConcurrentDictionary <GPS, INFORMATIONSTRUCT> GPSObject = (ConcurrentDictionary <GPS, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in GPSObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.ASTROCLIENT:
                ConcurrentDictionary <ASTROCLIENT, INFORMATIONSTRUCT> ASTROCLIENTObject = (ConcurrentDictionary <ASTROCLIENT, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in ASTROCLIENTObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;

            case DEVICECATEGORY.ASTROSERVER:
                ConcurrentDictionary <ASTROSERVER, INFORMATIONSTRUCT> ASTROSERVERObject = (ConcurrentDictionary <ASTROSERVER, INFORMATIONSTRUCT>)ThisStation.DeviceStroage.FirstOrDefault(Item => Item.Key.DeviceName == ThisDevice).Value;
                foreach (INFORMATIONSTRUCT ThisInformation in ASTROSERVERObject.Values)
                {
                    DisplayAllField(ActiveStation, ActiveDeviceNameStr, ThisInformation.FieldName, ThisInformation);
                }
                break;
            }

            //if (OnlineDevice == null)
            //    return;

            //String ThisDeviceStatus = OnlineDevice.FirstOrDefault(Item => Item == ActiveDeviceNameStr);
            //if (ThisDeviceStatus != null && ThisStation.IsStationConnected)
            //{
            //    DeviceStatus.ForeColor = System.Drawing.Color.Green;
            //    DeviceStatus.Text = "Online";
            //}
            //else
            //{
            //    DeviceStatus.ForeColor = System.Drawing.Color.Red;
            //    DeviceStatus.Text = "Offline";
            //}
        }