Exemple #1
0
        private void LoadCkbsStatus()
        {
            AndonEqmCtrl andonTypeUpdate          = AndonEqmCtrl.CreateInstance(Common.ConfigHelper.GetConfigValueFromXml("connectionStr", "defaultSqlDb", AppDomain.CurrentDomain.BaseDirectory + @"Config\mesMusicPlayerConfig.xml"));
            Dictionary <string, bool> andonStatus = andonTypeUpdate.LoadAndonEqmStatus(PlayerIndex);

            foreach (string item in andonStatus.Keys)
            {
                switch (item)
                {
                case "01":
                    ckbEqm.Checked = andonStatus[item];
                    break;

                case "02":
                    ckbPe.Checked = andonStatus[item];
                    break;

                case "03":
                    ckbProduct.Checked = andonStatus[item];
                    break;

                case "04":
                    ckbQc.Checked = andonStatus[item];
                    break;

                case "05":
                    ckbOther.Checked = andonStatus[item];
                    break;

                default:
                    break;
                }
            }
            andonTypeUpdate.UpdateHistroyAdn(OpenSftwTime, PlayerIndex);
        }
Exemple #2
0
        private void ckbCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox ckb       = sender as CheckBox;
            string   andonType = "UNKNOWN";

            switch (ckb.Name)
            {
            case "ckbEqm":
                andonType = "01";
                break;

            case "ckbPe":
                andonType = "02";
                break;

            case "ckbProduct":
                andonType = "03";
                break;

            case "ckbQc":
                andonType = "04";
                break;

            case "ckbOther":
                andonType = "05";
                break;

            default:
                andonType = "UNKNOWN";
                break;
            }
            AndonEqmCtrl andonTypeUpdate = AndonEqmCtrl.CreateInstance(Common.ConfigHelper.GetConfigValueFromXml("connectionStr", "defaultSqlDb", AppDomain.CurrentDomain.BaseDirectory + @"Config\mesMusicPlayerConfig.xml"));

            andonTypeUpdate.Update(PlayerIndex, andonType, ckb.Checked);
        }
Exemple #3
0
 /// <summary>
 /// 类的单例创建函数
 /// </summary>
 /// <param name="playerIndex">音乐播放器的序号</param>
 /// <param name="andonType">需要变动的安灯类型</param>
 /// <param name="conStr">Sql连接字符串</param>
 /// <returns></returns>
 public static AndonEqmCtrl CreateInstance(string conStr)
 {
     // 当第一个线程运行到这里时,此时会对locker对象 "加锁",
     // 当第二个线程运行该方法时,首先检测到locker对象为"加锁"状态,该线程就会挂起等待第一个线程解锁
     // lock语句运行完之后(即线程运行完之后)会对该对象"解锁"
     // 双重锁定只需要一句判断就可以了
     if (_andonEqmCtrl == null)
     {
         lock (_locker)
         {
             // 如果类的实例不存在则创建,否则直接返回
             if (_andonEqmCtrl == null)
             {
                 _andonEqmCtrl = new AndonEqmCtrl();
             }
         }
     }
     _andonEqmCtrl.SqlConStr = conStr;
     return(_andonEqmCtrl);
 }