예제 #1
0
 /// <summary>
 /// 
 /// </summary>
 public void OnHardwareChanged(HardwareChangedEventArgs e)
 {
     if (HardwareChangedEvent != null)
     {
         HardwareChangedEvent(this, e);
     }
 }
예제 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hardwareType"></param>
        /// <param name="changedHardware"></param>
        /// <param name="changedType"></param>
        public void HardwareChanged(HardwareType hardwareType, object changedHardware, HardwareChangedType changedType)
        {
            //HardwareBuilderBase build = CommuniSoftFactory.HardwareBuilder;
            DBHardwareBuilderBase build = CommuniSoftFactory.HardwareBuilder as DBHardwareBuilderBase;
            Debug.Assert(build != null, "CommuniSoftFactory.HardwareBuilder is not DBHardwareBuilderBase");

            if (hardwareType == HardwareType.Station)
            {
                Station station = changedHardware as Station;
                switch (changedType)
                {
                    case HardwareChangedType.Add:
                        build.AddStation(station);
                        break;

                    case HardwareChangedType.Edit :
                        build.EditStation(station);
                        break;

                    case HardwareChangedType.Delete :
                        // TODO: delete station
                        //
                        break;
                }
            }
            else if (hardwareType == HardwareType.Device)
            {
                Device device = changedHardware as Device;
                switch (changedType)
                {
                    case HardwareChangedType.Add:
                        build.AddDevice(device);
                        break;

                    case HardwareChangedType.Edit:
                        build.EditDevice(device);
                        break;

                    case HardwareChangedType.Delete:
                        // TODO: delete device
                        //
                        break;
                }
            }

            HardwareChangedEventArgs e = new HardwareChangedEventArgs();
            e.HardwareType = hardwareType;
            e.ChangedHardware = changedHardware;
            e.ChangedType = changedType;
            OnHardwareChanged(e);
        }