Ejemplo n.º 1
0
 private void parkCombobox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.entranceGrid.Rows.Clear();
     ParkBuffer.Current.InValid();
     if (parkCombobox1.SelectedParkID > 0)
     {
         ParkInfo park = ParkBuffer.Current.GetPark(parkCombobox1.SelectedParkID);
         if (park != null)
         {
             foreach (EntranceInfo entrance in park.Entrances)
             {
                 int row = entranceGrid.Rows.Add();
                 entranceGrid.Rows[row].Tag = entrance;
                 entranceGrid.Rows[row].Cells["colEntranceName"].Value = entrance.EntranceName;
                 entranceGrid.Rows[row].Cells["colEntranceType"].Value = entrance.IsExitDevice ? Resource1.Entrance_Out : Resource1.Entrance_In;
                 DataGridViewComboBoxCell comboCell = entranceGrid.Rows[row].Cells["colCarType"] as DataGridViewComboBoxCell;
                 comboCell.Items.Add(Resource1.CarType_Car);
                 comboCell.Items.Add(Resource1.CarType_Motor);
                 comboCell.Value = Resource1.CarType_Car;
             }
         }
         ParkOutDoorLedManager settings = ParkOutDoorLedSettingsStorage.Get(park.ParkID);
         if (settings == null)
         {
             settings        = new ParkOutDoorLedManager();
             settings.ParkID = park.ParkID;
             ShowParkOutDoorSetting(settings);
         }
         else
         {
             ShowParkOutDoorSetting(settings);
         }
     }
 }
Ejemplo n.º 2
0
        private void ShowSetting(ParkInfo park)
        {
            ParkOutDoorLedManager settings = ParkOutDoorLedSettingsStorage.Get(park.ParkID);

            if (settings == null)
            {
                settings        = new ParkOutDoorLedManager();
                settings.ParkID = park.ParkID;
                ShowParkOutDoorSetting(settings);
            }
            else
            {
                ShowParkOutDoorSetting(settings);
            }
        }
Ejemplo n.º 3
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            ParkOutDoorLedManager settings = GetSettingFromInput();

            settings.LastUpdate = DateTime.Now;
            bool ret = ParkOutDoorLedSettingsStorage.Save(settings);

            if (ret)
            {
                AppSettings.CurrentSetting.SaveConfig("Park", settings.ParkID.ToString());
                AppSettings.CurrentSetting.SaveConfig("AutoFreshInterval", txtAutoFreshInterval.IntergerValue.ToString());
                settings.ShowLed();
                settings.SetBrightness();
                MessageBox.Show(Resource1.FrmMain_SaveSuccess);

                _AutoFreshInterval = txtAutoFreshInterval.IntergerValue;
                DoWork();
            }
        }
Ejemplo n.º 4
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            ShowLanguage();

            FrmConnect frm = new FrmConnect();

            if (frm.ShowDialog() != DialogResult.OK)
            {
                mnu_Exit_Click(this.mnu_Exit, EventArgs.Empty);
                return;
            }

            ParkBuffer.Current = new ParkBuffer(AppSettings.CurrentSetting.ParkConnect);
            ParkBuffer.Current.InValid();
            this.parkCombobox1.Init(string.Empty);
            CustomCardTypeSetting.Current = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <CustomCardTypeSetting>();

            string temp   = AppSettings.CurrentSetting.GetConfigContent("Park");
            int    parkid = 0;

            if (int.TryParse(temp, out parkid))
            {
                _Setting = ParkOutDoorLedSettingsStorage.Get(parkid);
                if (_Setting == null)
                {
                    _Setting = new ParkOutDoorLedManager();
                    ShowParkOutDoorSetting(_Setting);
                }
                else
                {
                    ShowParkOutDoorSetting(_Setting);
                    _Setting.ShowLed();

                    int interval = 0;
                    temp = AppSettings.CurrentSetting.GetConfigContent("AutoFreshInterval");
                    int.TryParse(temp, out interval);
                    this.txtAutoFreshInterval.IntergerValue = interval;
                    _AutoFreshInterval = interval;
                    DoWork();
                }
            }
        }
Ejemplo n.º 5
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            ParkOutDoorLedManager settings = GetSettingFromInput();

            if (ParkOutDoorLedSettingsStorage.Save(settings))
            {
                int ports  = settings.Areas.Sum(area => area != null && area.CardType != null ? area.CarPort : 0);
                int vacant = settings.Areas.Sum(area => area != null && area.CardType != null ? area.Vacant : 0);
                if (Park.Vacant != vacant || Park.TotalPosition != ports) //如果更新了车位数或余位数
                {
                    Park.Vacant        = (short)vacant;
                    Park.TotalPosition = (short)ports;
                    if ((new ParkBll(AppSettings.CurrentSetting.ParkConnect)).Update(Park).Result == ResultCode.Successful)
                    {
                        if (this.ItemUpdated != null)
                        {
                            this.ItemUpdated(this, new ItemUpdatedEventArgs(Park));
                        }
                    }
                }
            }
            this.Close();
        }
Ejemplo n.º 6
0
 private void AutoFresh_Thread()
 {
     try
     {
         int    parkid = 0;
         string temp   = AppSettings.CurrentSetting.GetConfigContent("Park");
         if (int.TryParse(temp, out parkid))
         {
             while (true)
             {
                 try
                 {
                     Thread.Sleep(_AutoFreshInterval * 1000);
                     ParkOutDoorLedManager man = ParkOutDoorLedSettingsStorage.Get(parkid);
                     if (man != null && man.LastUpdate != null)
                     {
                         if (man.LastUpdate != _Setting.LastUpdate) //数据有更新
                         {
                             _LastUpdateTime = DateTime.Now;
                             _Setting        = man;
                             _Setting.ShowLed();
                             Action action = delegate()
                             {
                                 ShowParkOutDoorSetting(_Setting);
                             };
                             this.BeginInvoke(action);
                         }
                         else
                         {
                             //如果数据没有更新,则过20秒后也将屏刷新一次
                             if (man.LastUpdate != null && _Setting.LastUpdate != null)
                             {
                                 TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - _LastUpdateTime.Ticks);
                                 if (Math.Abs(ts.TotalSeconds) >= 20)
                                 {
                                     _LastUpdateTime = DateTime.Now;
                                     _Setting        = man;
                                     _Setting.ShowLed();
                                 }
                             }
                         }
                     }
                 }
                 catch (ThreadAbortException ex)
                 {
                 }
                 catch (Exception ex)
                 {
                     Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
                 }
             }
         }
     }
     catch (ThreadAbortException ex)
     {
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
 }